Help us shape the future of Go! Take the 2026 Go Developer Survey

hierasdk

module
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2020 License: Apache-2.0

README

Software Development Kit for hiera lookup functions

This module provides the API to create and run RESTful Hiera lookup plugins. Such a plugin can publish a set of Hiera lookup functions (i.e. data_dig, data_hash, or lookup_key functions) and make them available using https RESTful calls.

How to use

hierasdk is a Go module and is best installed using the command:

go get github.com/lyraproj/hierasdk
Example plugin

Skeleton plugin that provides one single data_hash function:

package main

import (
  "github.com/lyraproj/hierasdk/hiera"
  "github.com/lyraproj/hierasdk/plugin"
  "github.com/lyraproj/hierasdk/register"
  "github.com/lyraproj/hierasdk/vf"
)

func main() {
  // Register the data_hash function with the global registry
  register.DataHash(`my_data_hash`, myDataHash)

  // Start RESTful service that makes all registered functions available
  plugin.ServeAndExit()
}

func myDataHash(c hiera.ProviderContext) vf.Data {
  var dh map[string]interface{}
  // lookup data hash here and return it
  return vf.ToData(dh)
}

Third party dependencies

None.

Directories

Path Synopsis
Package hiera provides the lookup function types and the ProviderContext
Package hiera provides the lookup function types and the ProviderContext
Package plugin exposes the API for starting the RESTful plugin service.
Package plugin exposes the API for starting the RESTful plugin service.
Package register exposes the API for registering the Hiera lookup functions.
Package register exposes the API for registering the Hiera lookup functions.
Package routes provides the Register() function that creates the http.Handler.
Package routes provides the Register() function that creates the http.Handler.

Jump to

Keyboard shortcuts

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