hiera

package
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 Imports: 4 Imported by: 19

Documentation

Overview

Package hiera provides the lookup function types and the ProviderContext

Index

Constants

View Source
const MagicCookie = 0xBEBAC0DE

MagicCookie is a value that must be set in the environment variable HIERA_MAGIC_COOKIE in order to run the plugin. If it is not set, the plugin will terminate with a message informing the user that it isn't intended for normal execution.

View Source
const ProtoVersion = 1

ProtoVersion is the protocol version used in the initial negotionation between Hiera and a plugin

Variables

This section is empty.

Functions

This section is empty.

Types

type DataDig

type DataDig func(ic ProviderContext, key dgo.Array) dgo.Value

DataDig is a Hiera 'data_dig' function looks up a value by a key consisting of several segments. The segments are either strings or ints. No other types of segments are allowed.

type DataHash

type DataHash func(ic ProviderContext) dgo.Map

DataHash is a Hiera 'data_hash' function returns a Map that Hiera can use as the source for lookups.

type LookupKey

type LookupKey func(ic ProviderContext, key string) dgo.Value

LookupKey is a Hiera 'lookup_key' function returns the value that corresponds to the given key.

type ProviderContext

type ProviderContext interface {
	// Option returns the given option or nil if no such option exists
	Option(option string) dgo.Value

	// StringOption returns the option for the given name as a string and true provided that the option is present
	// and is a string. If its missing, or if its found to be something other than a string, this
	// method returns the empty string, false
	StringOption(option string) (string, bool)

	// BoolOption returns the option for the given name as a bool and true provided that the option is present
	// and is a bool. If its missing, or if its found to be something other than a bool, this
	// method returns false, false
	BoolOption(option string) (bool, bool)

	// IntOption returns the option for the given name as an int and true provided that the option is present
	// and is an int. If its missing, or if its found to be something other than an int, this method returns 0, false
	IntOption(option string) (int, bool)

	// FloatOption returns the option for the given name as a float64 and true provided that the option is present
	// and is an float64. If its missing, or if its found to be something other than a float64, this method
	// returns 0.0, false
	FloatOption(option string) (float64, bool)

	// OptionMap returns all options as an immutable Map
	OptionsMap() dgo.Map

	// ToData converts the given value into Data
	ToData(value interface{}) dgo.Value
}

ProviderContext provides utility functions to a provider function

func NewProviderContext

func NewProviderContext(q url.Values) ProviderContext

NewProviderContext creates a context containing the values of the the "options" key in the given url.Values.

func ProviderContextFromMap added in v0.3.0

func ProviderContextFromMap(m dgo.Map) ProviderContext

ProviderContextFromMap returns a ProviderContext that contains a frozen version of the given map

Jump to

Keyboard shortcuts

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