smithy-rs/tools/ci-cdk
Landon James d95cc86400
Add `aws-smithy-wasm` crate with WASI http client (#3409)
## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here -->
This change adds a new crate, `aws-smithy-wasm`, that exports a SDK
compatible WASI http client. This is a continuation of the work in #2520
using the now stabilized WASI 0.2.0 interfaces from the [wasi
crate](https://crates.io/crates/wasi). This supports, but does not
finalize the work for #2087

## Description
<!--- Describe your changes in detail -->

Add a new crate, `aws-smithy-wasm` which exports a function
`wasi_http_client` that will provide the user with a WASI compatible
http client. This client is implemented by using the
`wasi::http::outgoing_handler`
[ref](https://docs.rs/wasi/0.12.0+wasi-0.2.0/wasi/http/outgoing_handler/index.html)
along with some utility implementations of `TryFrom` to transform back
and worth between the types from the `http` crate and the `wasi::http`
types. It also exports a unit struct `WasmSleep` that impls the
`AsyncSleep` trait needed by the SDK.

## Testing
<!--- Please describe in detail how you tested your changes -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
This is tested via an integration test in
`aws/sdk/integration-tests/webassembly` that uses the wasi http-client
to vuild a config and an operation (that is not sent). It is further
tested in a new canary (`wasm_canary`) that calls the S3
`list_objects_v2` API.

## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [X] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._

---------

Co-authored-by: Eduardo Rodrigues <eduardomourar@users.noreply.github.com>
Co-authored-by: Eduardo de Moura Rodrigues <16357187+eduardomourar@users.noreply.github.com>
Co-authored-by: ysaito1001 <awsaito@amazon.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
Co-authored-by: Russell Cohen <rcoh@amazon.com>
Co-authored-by: John DiSanti <john@vinylsquid.com>
2024-02-27 23:40:42 +00:00
..
bin Set a region on the canary CDK stack to simplify deployment (#2954) 2023-08-29 21:54:59 +00:00
canary-lambda Add `aws-smithy-wasm` crate with WASI http client (#3409) 2024-02-27 23:40:42 +00:00
canary-runner Add `aws-smithy-wasm` crate with WASI http client (#3409) 2024-02-27 23:40:42 +00:00
canary-wasm Add `aws-smithy-wasm` crate with WASI http client (#3409) 2024-02-27 23:40:42 +00:00
lib Fix repo org move issues (#3166) 2023-11-10 18:51:04 +00:00
test Fix repo org move issues (#3166) 2023-11-10 18:51:04 +00:00
.eslintrc.json Improve the codegen diff bot (#918) 2021-12-03 20:04:05 +00:00
.gitignore Add `aws-smithy-wasm` crate with WASI http client (#3409) 2024-02-27 23:40:42 +00:00
.npmignore Improve the codegen diff bot (#918) 2021-12-03 20:04:05 +00:00
.prettierrc Improve the codegen diff bot (#918) 2021-12-03 20:04:05 +00:00
LICENSE Improve the codegen diff bot (#918) 2021-12-03 20:04:05 +00:00
README.md Add `aws-smithy-wasm` crate with WASI http client (#3409) 2024-02-27 23:40:42 +00:00
cdk.json Upgrade CDK infrastructure to CDK 2 (#1214) 2022-02-22 19:31:04 +00:00
jest.config.js Improve the codegen diff bot (#918) 2021-12-03 20:04:05 +00:00
package-lock.json Add new MRAP test to S3 canary (#3109) 2023-10-31 00:35:23 +00:00
package.json Update Canary OIDC provider, NPM commands, and previous version pagination test (#3142) 2023-11-02 18:08:30 +00:00
tsconfig.json Improve the codegen diff bot (#918) 2021-12-03 20:04:05 +00:00

README.md

CI CDK

This is the CDK infrastructure as code for smithy-lang/smithy-rs and awslabs/aws-sdk-rust continuous integration.

The cdk.json file tells the CDK Toolkit how to synthesize the infrastructure.

Canary local development

Sometimes it's useful to only deploy the canary resources to a test AWS account to iterate on the canary-runner and canary-lambda. To do this, run the following:

npm install
npm run build
npx cdk --app "node build/bin/canary-only.js" synth
npx cdk --app "node build/bin/canary-only.js" deploy --outputs-file cdk-outputs.json

From there, you can just point the canary-runner to the cdk-outputs.json to run it:

cd canary-runner
cargo run -- run --sdk-release-tag <version> --musl --cdk-output ../cdk-outputs.json

NOTE: You may want to add a --profile to the deploy command to select a specific credential profile to deploy to if you don't want to use the default.

Also, if this is a new test AWS account, be sure it CDK bootstrap it before attempting to deploy.

Useful commands

  • npm run lint: lint code
  • npm run format: auto-format code
  • npm run build: compile typescript to js
  • npm run watch: watch for changes and compile
  • npm run test: perform the jest unit tests
  • npx cdk deploy: deploy this stack to your default AWS account/region
  • npx cdk diff: compare deployed stack with current state
  • npx cdk synth: emits the synthesized CloudFormation template