Ionburst Go SDK

The Ionburst SDK for Go is available now as a Go module.

Repository

The source code for the Ionburst Go SDK is available here.

Installation

go get gitlab.com/ionburst/ionburst-sdk-go

Usage

Creating a Client

import (
ionburst "gitlab.com/ionburst/ionburst-sdk-go"
}
func main() {
// Create a new client using the default config
client, err := ionburst.NewClient()
// Create a client with implicit path and credentials profile name
client, err := ionburst.NewClientPathAndProfile(configFilePath, credentialsProfileName, setDebugMode [true/false])
}

Classifications

classifications, _ := client.GetClassifications()

Upload Data

// get a readable stream
ioReader, _ := os.Open(FilePath)
client.Put(FileID, ioReader, classification)
// if classification is an empty string ("") it won't be passed
// Upload from a filepath instead
client.PutFromFile(FileID, FilePath, classification)

Download Data

ioReader, err := client.Get(FileID)
// Download to a filepath instead
err := client.GetToFile(FileID, OutputFilePath)
// Download and output the size of the downloaded content
ioReader, sizeOfContent, err := client.GetWithLen(FileID)

Delete Data

err := client.Delete(FileID)

Upload Data (Deferred)

token, err := cli.PutDeferred(name, r, "")
if err != nil {
t.Error(err)
return
}

Download Data (Deferred)

token, err := cli.GetDeferred(name)
if err != nil {
t.Error(err)
return
}

Check Deferred Request

res, err = cli.CheckDeferred(tk)
if err != nil {
t.Error(err)
return
} else if !res.Success {
t.Error(fmt.Sprintf("ERR: %s - %d", res.Message, res.Status))
return
} else {
...
}res, err = cli.CheckDeferred(tk)
if err != nil {
t.Error(err)
return
} else if !res.Success {
t.Error(fmt.Sprintf("ERR: %s - %d", res.Message, res.Status))
return
} else {
...
}

Fetch Data (Deferred)

ioReader, err := cli.FetchDeferred(tk)
if err != nil {
t.Error(err)
return
}