GithubHelp home page GithubHelp logo

spring-boot-azure-blob-storage's Introduction

Spring Boot App for operation on Azure Blob Storage

Azure blob storage code sample

Key concepts

This project is an example for communicating with the Azure Blob storage using the Spring Boot.

Prerequisites

Getting started

Configuration

The access of the Azure Blob Storage is based on the connection string of the storage account. We can access the connection string details under the Access Keys section. Refer the screenshot below.

Next thing to grab is container name. Under the storage account there is a tab sections which lists all the containers for the storage account. Refer the image to know it.

Now we can set this as part of the application.yml. Go to src/main/resources for the file.

azure:
  storage:
    connection-string: ${AZURE_STORAGE_CONNECTION_STRING}
    container-name: ${AZURE_STORAGE_CONTAINER_NAME}

Or we pass it as spring boot env arguments.

Build with Gradle

gradlew clean build

Run with Gradle

If AZURE_STORAGE_CONTAINER_NAME and AZURE_STORAGE_CONNECTION_STRING updated on the application.yml then we can start the server by

gradlew bootRun

OR this way if we want to pass it as env config.

set AZURE_STORAGE_CONTAINER_NAME=<container name> & set AZURE_STORAGE_CONNECTION_STRING=<connection_string> & gradlew bootRun

Operations

  • Call this endpoint URL to know the list of files under storage.

    curl -X "GET" http://localhost:8080/storage/files

  • Call this endpoint to upload a file

    curl -X "POST" -F 'file=@/home/petehouston/hello.txt' http://localhost:8080/storage/upload

  • Call this endpoint to delete a file

    curl -X "DELETE" http://localhost:8080/storage/delete/<filename>

  • Call this endpoint to download a file

    curl -X "GET" http://localhost:8080/storage/download/<filename>

References

Blob Reference

spring-boot-azure-blob-storage's People

Contributors

abhijit-seal-by avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  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.