https://github.com/deislabs/azure-sdk-for-rust-wasi-samples
https://github.com/deislabs/azure-sdk-for-rust-wasi-samples
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/deislabs/azure-sdk-for-rust-wasi-samples
- Owner: deislabs
- License: mit
- Created: 2021-04-30T21:27:11.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-01T05:00:34.000Z (about 5 years ago)
- Last Synced: 2025-03-16T02:08:58.870Z (over 1 year ago)
- Language: Rust
- Size: 12.7 KB
- Stars: 1
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Using Azure services from WASI modules
This repo contains samples for using the [Azure Rust SDK][rust-sdk] from WASI
modules, using the [`wasi-experimental-http`][wasi-experimental-http] crate. The
samples are slightly modified versions of those from the [upstream SDK
repository][rust-sdk]. Note that not all SDKs are compilable to `wasm32-wasi`,
and this repo should be updated as more compatible SDKs are added.
The _very_ early work in progress can be tracked [here][fork].
### Building
```
$ cargo target add wasm32-wasi
$ cargo build --target wasm32-wasi --release --bin blob
$ cargo build --target wasm32-wasi --release --bin cosmos
$ cargo build --target wasm32-wasi --release --bin eventgrid
$ cargo build --target wasm32-wasi --release --bin iothub
```
At this point, the easiest way to test the resulting module is to execute it
using the helper binary that can be found [here][bin]:
```
$ wasmtime-http target/wasm32-wasi/release/blob.wasm --env STORAGE_MASTER_KEY= --env STORAGE_ACCOUNT= -a https://.blob.core.windows.net
$ wasmtime-http target/wasm32-wasi/release/cosmos.wasm --env COSMOS_MASTER_KEY= --env COSMOS_ACCOUNT= -a https://.documents.azure.com
$ wasmtime-http target/wasm32-wasi/release/eventgrid.wasm --env TOPIC_HOST_NAME= --env TOPIC_KEY= -a https://..eventgrid.azure.net
$ wasmtime-http target/wasm32-wasi/release/iothub.wasm --env IOTHUB_CONNECTION_STRING= -a https://.azure-devices.net
```
[rust-sdk]: https://github.com/Azure/azure-sdk-for-rust
[wasi-experimental-http]: https://github.com/deislabs/wasi-experimental-http/
[bin]: https://github.com/deislabs/wasi-experimental-http/pull/57
[fork]:
https://github.com/radu-matei/azure-sdk-for-rust/tree/enable-wasi-experimental-http