language-puppet-0.1.3: Tools to parse and evaluate the Puppet DSL.

Safe HaskellSafe-Infered

Puppet.NativeTypes.Helpers

Description

These are the function and data types that are used to define the Puppet native types.

Synopsis

Documentation

type PuppetTypeValidate = RResource -> Either String RResourceSource

This is a function type than can be bound. It is the type of all subsequent validators.

defaultValidate :: Set String -> PuppetTypeValidateSource

This helper will validate resources given a list of fields. It will run checkParameterList and then addDefaults.

checkParameterList :: Set String -> PuppetTypeValidateSource

This validator checks that no unknown parameters have been set (except tag)

addDefaults :: PuppetTypeValidateSource

This validator always accept the resources, but add the default parameters (such as title and name).

string :: String -> PuppetTypeValidateSource

This checks that a given parameter is a string. If it is a ResolvedInt or ResolvedBool it will convert them to strings.

values :: [String] -> String -> PuppetTypeValidateSource

Makes sure that the parameter, if defined, has a value among this list.

defaultvalue :: String -> String -> PuppetTypeValidateSource

This fills the default values of unset parameters.

integer :: String -> PuppetTypeValidateSource

Checks that a given parameter, if set, is a ResolvedInt. If it is a ResolvedString it will attempt to parse it.

parameterFunctions :: [(String, [String -> PuppetTypeValidate])] -> PuppetTypeValidateSource

Helper that takes a list of stuff and will generate a validator.