Wednesday, February 11, 2015

Introducing GoHaveAzureStorage

Motivation

In a private project, I wanted to reach Azure Table Storage from some Go applications. My only issue was, I couldn't find a proper Go Azure Table Storage library. So when I got hold on the Azure Table Storage REST API, I decided to do a Go Azure Table Storage lib, and then I decided to do a full Azure Storage lib.

GoHaveAzureStorage

I have used the Microsoft Azure Storage API documentation, as inspiration for the library. With this approach, I hope people who is experienced with programming against Azure will find GoHaveAzureStorage just as easy to use.

A small sample:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package main

import (
 "fmt"
 "gohaveazurestorage"
)

//Either the primary or the secondary key found on Azure Portal
var key = "PrimaryOrSecondaryKey"

//Storage account name
var account = "Account"

func main() {
 // Create an instance of the lib
 goHaveAzureStorage := gohaveazurestorage.New(account, key)

 // From the lib instace, we can create multiple client instances
 tableStorage := goHaveAzureStorage.TableStorage()

 //Creating a table
 httpStatusCode := tableStorage.CreateTable("Table")
 if httpStatusCode != 201 {
  fmt.Println("Create table error")
 }
}

For documentation and progress of the project:
https://github.com/ChristianHenrikReich/gohaveazurestorage

No comments:

Post a Comment