Code Monkey home page Code Monkey logo

erlazure's Introduction

erlazure (v0.2) Build Status

Erlazure is a library for accessing Windows Azure Storage Services. The API is subject to change.

Service APIs implemented:

  • Queue storage service (API ver. "2014-02-14")
  • Blob storage service (API ver. "2014-02-14")
  • Table storage service (API ver. "2014-02-14")

Requirements

Erlazure requires OTP version R16+.

Implemented API functions

  • Queue storage service

    • List queues
    • Get queue acl
    • Create queue
    • Delete queue
    • Put message
    • Get messages
    • Peek messages
    • Delete message
    • Clear messages
    • Update message
  • Blob storage service

    • List containers
    • Create container
    • Delete container
    • Put block blob
    • Put page blob
    • List blobs
    • Get blob
    • Snapshot blob
    • Copy blob
    • Delete blob
    • Put block
    • Put block list
    • Get block list
    • Lease container
  • Table storage service

    • List tables
    • New table
    • Delete table

Starting an instance of erlazure

Start an instance of erlazure by calling erlazure:start/2 where Account is Storage account name and Key is Storage account key.

{ok, Pid} = erlazure:start(Account, Key)

Account and Key are strings.

Calling Azure services

Almost each azure services request has three corresponding functions in erlazure module, the first has minimal set of parameters, the second has additionaly list of Options and the third has additionaly Timeout parameter.

Options as the name states is list of options supported by this azure services request, each options is tuple {OptionName, OptionValue} where OptionName is atom and OptionValue can be of any type, option is passed either as a header or as a query string parameter.

Timeout is number of milliseconds to wait for a reply from erlazure, infinity value is not supported. Note, that this is gen_server call timeout and isn't http request timeout (it's set to infinity by default) or azure service request timeout (you can specify it by sending option {timeout, _Timeout}). By default timeout is set to 30 seconds.

For a list of supported options for each azure service request please consult msdn documentation.

Examples

Upload block blob

{ok, Pid} = erlazure:start("storage", "2o4b4tHpoWifLU+BlyzsIG1VtlO9LgBRFyl1qLw/+w9/ZszSxKGIK8JYac/UEJp5r8HKgiOiG8YTqGS9otAYWA=="),
{ok, Binary} = file:read("/path/to/some/small/file"),
{ok, created} = erlazure:put_block_blob(Pid, "uploads", "test_upload.file", Binary).

Upload block blob with timeout set

Uploads block blob and waits no longer than 15 seconds for erlazure to finish the upload

{ok, Pid} = erlazure:start("storage", "2o4b4tHpoWifLU+BlyzsIG1VtlO9LgBRFyl1qLw/+w9/ZszSxKGIK8JYac/UEJp5r8HKgiOiG8YTqGS9otAYWA=="),
{ok, Binary} = file:read("/path/to/some/other/file"),
{ok, created} = erlazure:put_block_blob(Pid, "uploads", "test_upload2.file", Binary, [], 15000).

Get 20 messages from a queue

Retrieves max 20 messages from a queue

{ok, Pid} = erlazure:start("storage", "2o4b4tHpoWifLU+BlyzsIG1VtlO9LgBRFyl1qLw/+w9/ZszSxKGIK8JYac/UEJp5r8HKgiOiG8YTqGS9otAYWA=="),
{ok, Messages} = erlazure:get_messages(Pid, "test_queue", [{num_of_messages, 20}]).

License

Copyright ยฉ 2013โ€“2015 Dmitriy Kataskin

Licensed under BSD License (see LICENSE).

erlazure's People

Contributors

brunotcouto avatar dkataskin avatar jacobfunch avatar jparadasb avatar percygrunwald avatar yatagan avatar zhaox 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.