/go-jerakia

A Go client library for Jerakia

Primary LanguageGo

go-jerakia

A Go client library for Jerakia.

Quickstart

package main

import (
  "fmt"
  "net/http"

  "github.com/jtopjian/go-jerakia"
)

func main() {
  config := jerakia.ClientConfig{
    URL:   "http://localhost:9992/v1",
    Token: "mytok:abcd",
  }

  client := jerakia.NewClient(http.DefaultClient, config)

  lookupOpts := jerakia.LookupOpts{
    Namespace: "test",
    Metadata: map[string]string{
      "hostname": "example",
    },
  }

  result, err := jerakia.Lookup(&client, "users", &lookupOpts)
  if err != nil {
    panic(err)
  }

  fmt.Printf("%#v\n", result)
}

Development

Installation

$ go get github.com/jtopjian/go-jerakia

Unit Tests

$ cd $GOPATH/github.com/jtopjian/go-jerakia
$ make test

Acceptance Tests

Make sure you have the following environment variables set:

  • JERAKIA_URL
  • JERAKIA_TOKEN
$ cd $GOPATH/github.com/jtopjian/go-jerakia
$ make testacc

You can use the supplied acceptance/deploy.sh script to install all requirements (including Jerakia and Go) on an Ubuntu 16.04 system.

The script will create a ~/jrc file with all required environment variables set.

Vendor Dependencies

go-jerakia uses godep for dependencies.