Repository demonstrating how to manage blobs in public Azure Storage Account Services container with Rust and required third-party crates.
- Install the Docker engine
- In VS Code install the
Dev Containers
extension - Either an Azure Storage Account service container needs to be deployed and accessible or an azurite docker container can be utilized.
In order to ramp up the azurite container execute:
cd devops/docker-compose
sudo docker compose up -d --build
NOTE: Experiments on Windows 10 OS with Virtual Box enabled docker and a running azurite docker container has failed
Create from the secrets.template.cfg in the templates folder a secrets.cfg
file in the project root directory and replace the PLACEHOLDER_*
values. The test_azure_blob_handler.rs and main.rs require environment variables listed in the secrets.cfg
file.
Afterwards execute the following to run the tests:
source secrets.cfg
cargo test
# for more logs execute
RUST_LOG=info cargo test
Build and run the cli tool/application binary with:
# Example upload:
RUST_LOG=info cargo run -- upload -b blob.txt -u assets/sample.txt
RUST_LOG=info cargo run -- upload --blob-name blob.txt --upload-file-path assets/sample.txt
# Example download:
RUST_LOG=info cargo run -- download -b blob.txt -d output/download.txt
RUST_LOG=info cargo run -- download --blob-name blob.txt --download-file-path "output/download.txt"
# Example delete:
RUST_LOG=info cargo run -- delete -b blob.txt
RUST_LOG=info cargo run -- delete --blob-name blob.txt
#####################################################################################################################
# Running the executable without cargo
cargo build
cp target/debug/azure_blob_handler.exe . # On Windows OS when utilizing Git Bash or WSL
source secrets.cfg
./azure_blob_handler --help
# Example upload (Note: Colored crates console logs might not work on certain terminals):
RUST_LOG=info ./azure_blob_handler upload --blob-name blob.txt --upload-file-path assets/sample.txt
Scripting language | Description |
---|---|
Bash | Navigate to the bash azurite-demo folder. Go trough the comments in the Dockerfile and utilize it as a reference for testing blob up- and downloads to/from the azurite docker container. |
Python | Navigate to the python azurite-demo folder. Go trough the comments in the Dockerfile and utilize it as a reference for testing blob uploads to the the azurite docker container. |