Skip to content

Software Development Kit for building lookup function plugins for Hiera

License

Notifications You must be signed in to change notification settings

lyraproj/hierasdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Software Development Kit for building lookup function plugins for Hiera

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages