-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[examples] Sync SDK examples from
awsdocs/aws-doc-sdk-examples
Includes commit(s): b05a15969c3bbf11358241dd7a1ccfe7e21e246f Co-authored-by: David Souther <davidsouther+github@gmail.com>
- Loading branch information
1 parent
6a3cc60
commit c37b0c6
Showing
15 changed files
with
4,298 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[build] | ||
target = "wasm32-unknown-unknown" | ||
|
||
[target.wasm32-unknown-unknown] | ||
rustflags = ["-C", "target-feature=+atomics"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. | ||
[package] | ||
name = "aws-wasm" | ||
version = "0.1.0" | ||
authors = ["Eduardo Rodrigues <16357187+eduardomourar@users.noreply.github.com>"] | ||
edition = "2021" | ||
publish = false | ||
|
||
[workspace] | ||
|
||
[lib] | ||
crate-type = ["cdylib"] | ||
|
||
[dependencies] | ||
async-trait = "0.1.63" | ||
console_error_panic_hook = "0.1.7" | ||
http = "0.2.8" | ||
js-sys = "0.3.60" | ||
serde-wasm-bindgen = "0.6.0" | ||
wasm-bindgen = "0.2.83" | ||
wasm-bindgen-futures = "0.4.33" | ||
wasm-timer = "0.2.5" | ||
tracing-wasm = "0.2.1" | ||
tracing = "0.1.37" | ||
aws-config= { version = "1.1.8", path = "../../sdk/aws-config", default-features = false } | ||
aws-credential-types= { version = "1.1.8", path = "../../sdk/aws-credential-types", features = ["hardcoded-credentials"] } | ||
aws-sdk-lambda= { version = "1.17.0", path = "../../sdk/lambda", default-features = false } | ||
aws-smithy-async= { version = "1.1.8", path = "../../sdk/aws-smithy-async" } | ||
aws-smithy-runtime-api= { version = "1.2.0", path = "../../sdk/aws-smithy-runtime-api" } | ||
aws-smithy-types= { version = "1.1.8", path = "../../sdk/aws-smithy-types" } | ||
|
||
[dependencies.serde] | ||
version = "1.0.152" | ||
features = ["derive"] | ||
|
||
[dependencies.tokio] | ||
version = "1.24.2" | ||
features = ["macros", "rt"] | ||
|
||
[dependencies.web-sys] | ||
version = "0.3.60" | ||
features = ["console", "Headers", "Request", "RequestInit", "RequestMode", "Response", "Window"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# AWS SDK for Rust code examples using WebAssembly | ||
|
||
## Purpose | ||
|
||
This example demonstrates how to package in a WebAssembly module that uses the AWS SDK for Rust. | ||
|
||
## Code examples | ||
|
||
- [Show functions](./src/lib.rs) (ListFunctions) | ||
|
||
## Running the code examples | ||
|
||
### Prerequisites | ||
|
||
- You must have an AWS account, and have configured your default credentials and AWS Region as described in [https://github.com/awslabs/aws-sdk-rust](https://github.com/awslabs/aws-sdk-rust). | ||
|
||
- Install the latest stable version of [Node.js](https://nodejs.org/en/download/). | ||
|
||
- Install [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/#). | ||
|
||
### ⚠ Important | ||
|
||
Your must customize your AWS credentials in the file [www/env/credentials.js](./www/env/credentials.js). Otherwise, it will not make the request to the backend. | ||
|
||
### count-functions | ||
|
||
This example lists your Lambda functions and returns the total amount found in a certain Region. | ||
|
||
``` | ||
wasm-pack build --target web --out-dir www/pkg --dev | ||
``` | ||
|
||
From within the [www](./www) directory, run the following command to install project and start serving. | ||
|
||
``` | ||
npm ci | ||
npm start | ||
``` | ||
|
||
Access your page at `http://localhost:3000`. Make your selection and press `Run`: | ||
|
||
- **region** is the Region in which the client is created. | ||
If not supplied, defaults to **us-west-2**. | ||
- **verbose** displays additional information. | ||
|
||
## Resources | ||
|
||
- [AWS SDK for Rust repo](https://github.com/awslabs/aws-sdk-rust) | ||
- [AWS SDK for Rust API Reference Guide](https://awslabs.github.io/aws-sdk-rust/aws_sdk_config/index.html) | ||
|
||
## Contributing | ||
|
||
To propose a new code example to the AWS documentation team, | ||
see [CONTRIBUTING.md](https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/CONTRIBUTING.md). | ||
The team prefers to create code examples that show broad scenarios rather than individual API calls. | ||
|
||
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 |
Oops, something went wrong.