Code Monkey home page Code Monkey logo

rust-azure-blob-storage-handler's Introduction

rust-azure-blob-storage-handler

Table of Contents

Summary

Repository demonstrating how to manage blobs in public Azure Storage Account Services container with Rust and required third-party crates.

References

Getting started

Precondition

  • 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

Build and run compiled source code

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 

(Optional) Bash or python scripts for testing out communication with azurite docker container

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.

rust-azure-blob-storage-handler's People

Contributors

mgthetrain avatar github-actions[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.