rancher/go-rancher-metadata

Name: go-rancher-metadata

Owner: Rancher

Description: Go Bindings for Rancher-metadata service

Created: 2015-10-15 18:12:02.0

Updated: 2017-11-04 18:41:34.0

Pushed: 2018-03-14 20:57:55.0

Homepage: null

Size: 71

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Go bindings for Rancher-metadata

This library is incomplete, but implements a variety of calls against rancher-metadata service

Example usage

age main

rt (
"time"

"github.com/Sirupsen/logrus"
"github.com/rancher/go-rancher-metadata/metadata"


t (
metadataUrl = "http://rancher-metadata/2015-12-19"


 main() {

:= metadata.NewClient(metadataUrl)

rsion := "init"

for {
    newVersion, err := m.GetVersion()
    if err != nil {
        logrus.Errorf("Error reading metadata version: %v", err)
    } else if version == newVersion {
        logrus.Debug("No changes in metadata version")
    } else {
        logrus.Debugf("Metadata Version has been changed. Old version: %s. New version: %s.", version, newVersion)
        version = newVersion
    }
    time.Sleep(5 * time.Second)
}


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.