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

Safe HaskellNone
LanguageHaskell98

Puppet.NativeTypes.Helpers

Description

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

Synopsis

Documentation

module Puppet.PP

string :: Text -> NativeTypeValidate Source

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

values :: [Text] -> Text -> NativeTypeValidate Source

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

defaultvalue :: Text -> Text -> NativeTypeValidate Source

This fills the default values of unset parameters.

nameval :: Text -> NativeTypeValidate Source

Copies the "name" value into the parameter if this is not set. It implies the string validator.

defaultValidate :: HashSet Text -> NativeTypeValidate Source

Validate resources given a list of valid parameters:

  • checks that no unknown parameters have been set (except metaparameters)

parameterFunctions :: [(Text, [Text -> NativeTypeValidate])] -> NativeTypeValidate Source

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

integer :: Text -> NativeTypeValidate Source

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

mandatory :: Text -> NativeTypeValidate Source

Checks that a given parameter is set.

mandatoryIfNotAbsent :: Text -> NativeTypeValidate Source

Checks that a given parameter is set unless the resources "ensure" is set to absent

runarray :: Text -> (Text -> PValue -> NativeTypeValidate) -> NativeTypeValidate Source

Helper function that runs a validor on a PArray

perror :: Doc -> Either PrettyError Resource Source

Useful helper for buiding error messages