go-rancher-metadata

command module
v0.0.0-...-7f4c936 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

README

Go bindings for Rancher-metadata

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

#Example usage

package main

import (
	"time"

	"github.com/rancher/go-rancher-metadata/metadata"
	"github.com/sirupsen/logrus"
)

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

func main() {

  m := metadata.NewClient(metadataUrl)
  
  version := "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)
	}
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL