Safe Haskell | None |
---|---|
Language | Haskell98 |
- class HasResource c where
- resource :: Lens' c Resource
- ralias :: Lens' c (HashSet Text)
- rattributes :: Lens' c (Container PValue)
- rid :: Lens' c RIdentifier
- rnode :: Lens' c NodeName
- rpos :: Lens' c PPosition
- rrelations :: Lens' c (HashMap RIdentifier (HashSet LinkType))
- rscope :: Lens' c [CurContainerDesc]
- rtags :: Lens' c (HashSet Text)
- rvirtuality :: Lens' c Virtuality
- data Resource = Resource !RIdentifier !(HashSet Text) !(Container PValue) !(HashMap RIdentifier (HashSet LinkType)) ![CurContainerDesc] !Virtuality !(HashSet Text) !PPosition !NodeName
- class HasResDefaults c where
- resDefaults :: Lens' c ResDefaults
- resDefPos :: Lens' c PPosition
- resDefSrcScope :: Lens' c Text
- resDefType :: Lens' c Text
- resDefValues :: Lens' c (Container PValue)
- data ResDefaults = ResDefaults !Text !Text !(Container PValue) !PPosition
- class HasLinkInformation c where
- linkInformation :: Lens' c LinkInformation
- linkPos :: Lens' c PPosition
- linkType :: Lens' c LinkType
- linkdst :: Lens' c RIdentifier
- linksrc :: Lens' c RIdentifier
- data LinkInformation = LinkInformation !RIdentifier !RIdentifier !LinkType !PPosition
- class HasRIdentifier c where
- rIdentifier :: Lens' c RIdentifier
- iname :: Lens' c Text
- itype :: Lens' c Text
- data RIdentifier = RIdentifier !Text !Text
- class HasScopeInformation c where
- scopeInformation :: Lens' c ScopeInformation
- scopeContainer :: Lens' c CurContainer
- scopeExtraTags :: Lens' c (HashSet Text)
- scopeOverrides :: Lens' c (HashMap RIdentifier ResRefOverride)
- scopeParent :: Lens' c (Maybe Text)
- scopeResDefaults :: Lens' c (Container ResDefaults)
- scopeVariables :: Lens' c (Container (Pair (Pair PValue PPosition) CurContainerDesc))
- data ScopeInformation = ScopeInformation !(Container (Pair (Pair PValue PPosition) CurContainerDesc)) !(Container ResDefaults) !(HashSet Text) !CurContainer !(HashMap RIdentifier ResRefOverride) !(Maybe Text)
- data ScopeEnteringContext
- class HasResourceModifier c where
- resourceModifier :: Lens' c ResourceModifier
- rmDeclaration :: Lens' c PPosition
- rmModifierType :: Lens' c ModifierType
- rmMutation :: Lens' c (Resource -> InterpreterMonad Resource)
- rmResType :: Lens' c Text
- rmSearch :: Lens' c RSearchExpression
- rmType :: Lens' c ResourceCollectorType
- data ResourceModifier = ResourceModifier !Text !ModifierType !ResourceCollectorType !RSearchExpression !(Resource -> InterpreterMonad Resource) !PPosition
- class HasIoMethods c m | c -> m where
- ioMethods :: Lens' c (IoMethods m)
- ioGetCurrentCallStack :: Lens' c (m [String])
- ioReadFile :: Lens' c ([Text] -> m (Either String Text))
- ioTraceEvent :: Lens' c (String -> m ())
- data IoMethods m = IoMethods (m [String]) ([Text] -> m (Either String Text)) (String -> m ())
- class HasCurContainer c where
- curContainer :: Lens' c CurContainer
- cctags :: Lens' c (HashSet Text)
- cctype :: Lens' c CurContainerDesc
- data CurContainer = CurContainer !CurContainerDesc !(HashSet Text)
- class HasNativeTypeMethods c where
- nativeTypeMethods :: Lens' c NativeTypeMethods
- puppetFields :: Lens' c (HashSet Text)
- puppetValidate :: Lens' c NativeTypeValidate
- data NativeTypeMethods = NativeTypeMethods NativeTypeValidate (HashSet Text)
- data NodeInfo = NodeInfo !NodeName !Bool !(Maybe UTCTime) !(Maybe UTCTime) !(Maybe UTCTime)
- class HasNodeInfo c where
- nodeInfo :: Lens' c NodeInfo
- nodeInfoCatalogT :: Lens' c (Maybe UTCTime)
- nodeInfoDeactivated :: Lens' c Bool
- nodeInfoFactsT :: Lens' c (Maybe UTCTime)
- nodeInfoName :: Lens' c NodeName
- nodeInfoReportT :: Lens' c (Maybe UTCTime)
- data FactInfo = FactInfo !NodeName !Text !PValue
- class HasFactInfo c where
- factInfo :: Lens' c FactInfo
- factInfoName :: Lens' c Text
- factInfoNodename :: Lens' c NodeName
- factInfoVal :: Lens' c PValue
- class HasWireCatalog c where
- wireCatalog :: Lens' c WireCatalog
- wireCatalogEdges :: Lens' c (Vector PuppetEdge)
- wireCatalogNodename :: Lens' c NodeName
- wireCatalogResources :: Lens' c (Vector Resource)
- wireCatalogTransactionUUID :: Lens' c Text
- wireCatalogVersion :: Lens' c Text
- data InterpreterInstr a where
- GetNativeTypes :: InterpreterInstr (Container NativeTypeMethods)
- GetStatement :: TopLevelType -> Text -> InterpreterInstr Statement
- ComputeTemplate :: Either Text Text -> InterpreterState -> InterpreterInstr Text
- ExternalFunction :: Text -> [PValue] -> InterpreterInstr PValue
- GetNodeName :: InterpreterInstr Text
- HieraQuery :: Container Text -> Text -> HieraQueryType -> InterpreterInstr (Maybe PValue)
- GetCurrentCallStack :: InterpreterInstr [String]
- IsIgnoredModule :: Text -> InterpreterInstr Bool
- IsExternalModule :: Text -> InterpreterInstr Bool
- IsStrict :: InterpreterInstr Bool
- PuppetPaths :: InterpreterInstr PuppetDirPaths
- ErrorThrow :: PrettyError -> InterpreterInstr a
- ErrorCatch :: InterpreterMonad a -> (PrettyError -> InterpreterMonad a) -> InterpreterInstr a
- WriterTell :: InterpreterWriter -> InterpreterInstr ()
- WriterPass :: InterpreterMonad (a, InterpreterWriter -> InterpreterWriter) -> InterpreterInstr a
- WriterListen :: InterpreterMonad a -> InterpreterInstr (a, InterpreterWriter)
- PDBInformation :: InterpreterInstr Doc
- PDBReplaceCatalog :: WireCatalog -> InterpreterInstr ()
- PDBReplaceFacts :: [(NodeName, Facts)] -> InterpreterInstr ()
- PDBDeactivateNode :: NodeName -> InterpreterInstr ()
- PDBGetFacts :: Query FactField -> InterpreterInstr [FactInfo]
- PDBGetResources :: Query ResourceField -> InterpreterInstr [Resource]
- PDBGetNodes :: Query NodeField -> InterpreterInstr [NodeInfo]
- PDBCommitDB :: InterpreterInstr ()
- PDBGetResourcesOfNode :: NodeName -> Query ResourceField -> InterpreterInstr [Resource]
- ReadFile :: [Text] -> InterpreterInstr Text
- TraceEvent :: String -> InterpreterInstr ()
- class HasInterpreterReader c m | c -> m where
- interpreterReader :: Lens' c (InterpreterReader m)
- readerExternalFunc :: Lens' c (Container ([PValue] -> InterpreterMonad PValue))
- readerExternalModules :: Lens' c (HashSet Text)
- readerGetStatement :: Lens' c (TopLevelType -> Text -> m (Either PrettyError Statement))
- readerGetTemplate :: Lens' c (Either Text Text -> InterpreterState -> InterpreterReader m -> m (Either PrettyError Text))
- readerHieraQuery :: Lens' c (HieraQueryFunc m)
- readerIgnoredModules :: Lens' c (HashSet Text)
- readerIoMethods :: Lens' c (IoMethods m)
- readerIsStrict :: Lens' c Bool
- readerNativeTypes :: Lens' c (Container NativeTypeMethods)
- readerNodename :: Lens' c Text
- readerPdbApi :: Lens' c (PuppetDBAPI m)
- readerPuppetPaths :: Lens' c PuppetDirPaths
- data InterpreterReader m = InterpreterReader !(Container NativeTypeMethods) (TopLevelType -> Text -> m (Either PrettyError Statement)) (Either Text Text -> InterpreterState -> InterpreterReader m -> m (Either PrettyError Text)) (PuppetDBAPI m) (Container ([PValue] -> InterpreterMonad PValue)) Text (HieraQueryFunc m) (IoMethods m) (HashSet Text) (HashSet Text) Bool PuppetDirPaths
- class HasInterpreterState c where
- interpreterState :: Lens' c InterpreterState
- curPos :: Lens' c PPosition
- curScope :: Lens' c [CurContainerDesc]
- definedResources :: Lens' c (HashMap RIdentifier Resource)
- extraRelations :: Lens' c [LinkInformation]
- loadedClasses :: Lens' c (Container (Pair ClassIncludeType PPosition))
- nestedDeclarations :: Lens' c (HashMap (TopLevelType, Text) Statement)
- resMod :: Lens' c [ResourceModifier]
- scopes :: Lens' c (Container ScopeInformation)
- data InterpreterState = InterpreterState !(Container ScopeInformation) !(Container (Pair ClassIncludeType PPosition)) !(HashMap RIdentifier Resource) ![CurContainerDesc] !PPosition !(HashMap (TopLevelType, Text) Statement) ![LinkInformation] ![ResourceModifier]
- data PValue
- data CurContainerDesc
- = ContRoot
- | ContClass !Text
- | ContDefine !Text !Text !PPosition
- | ContImported !CurContainerDesc
- | ContImport !NodeName !CurContainerDesc
- data ResourceCollectorType
- data RSearchExpression
- data Query a
- data ModifierType
- data NodeField
- data Strictness
- = Strict
- | Permissive
- data HieraQueryType
- data WireCatalog = WireCatalog {
- _wireCatalogNodename :: !NodeName
- _wireCatalogVersion :: !Text
- _wireCatalogEdges :: !(Vector PuppetEdge)
- _wireCatalogResources :: !(Vector Resource)
- _wireCatalogTransactionUUID :: !Text
- data TopLevelType
- data FactField
- data ResRefOverride = ResRefOverride {}
- data ResourceField
- data OverrideType
- data ClassIncludeType
- data PuppetEdge = PuppetEdge RIdentifier RIdentifier LinkType
- data PuppetDBAPI m = PuppetDBAPI {
- pdbInformation :: m Doc
- replaceCatalog :: WireCatalog -> ExceptT PrettyError m ()
- replaceFacts :: [(NodeName, Facts)] -> ExceptT PrettyError m ()
- deactivateNode :: NodeName -> ExceptT PrettyError m ()
- getFacts :: Query FactField -> ExceptT PrettyError m [FactInfo]
- getResources :: Query ResourceField -> ExceptT PrettyError m [Resource]
- getNodes :: Query NodeField -> ExceptT PrettyError m [NodeInfo]
- commitDB :: ExceptT PrettyError m ()
- getResourcesOfNode :: NodeName -> Query ResourceField -> ExceptT PrettyError m [Resource]
- newtype PrettyError = PrettyError {
- getError :: Doc
- type InterpreterMonad = ProgramT InterpreterInstr (State InterpreterState)
- type InterpreterWriter = [Pair Priority Doc]
- type FinalCatalog = HashMap RIdentifier Resource
- type NativeTypeValidate = Resource -> Either PrettyError Resource
- type NodeName = Text
- type Container = HashMap Text
- type HieraQueryFunc m = Container Text -> Text -> HieraQueryType -> m (Either PrettyError (Maybe PValue))
- type Scope = Text
- type Facts = Container PValue
- type EdgeMap = HashMap RIdentifier [LinkInformation]
- class Monad m => MonadThrowPos m where
- throwPosError :: Doc -> m a
- metaparameters :: HashSet Text
- showPos :: Position -> Doc
Record & lenses
class HasResource c where Source
resource :: Lens' c Resource Source
ralias :: Lens' c (HashSet Text) Source
rattributes :: Lens' c (Container PValue) Source
rid :: Lens' c RIdentifier Source
rnode :: Lens' c NodeName Source
rpos :: Lens' c PPosition Source
rrelations :: Lens' c (HashMap RIdentifier (HashSet LinkType)) Source
rscope :: Lens' c [CurContainerDesc] Source
rtags :: Lens' c (HashSet Text) Source
rvirtuality :: Lens' c Virtuality Source
A fully resolved puppet resource that will be used in the FinalCatalog
.
Resource !RIdentifier !(HashSet Text) !(Container PValue) !(HashMap RIdentifier (HashSet LinkType)) ![CurContainerDesc] !Virtuality !(HashSet Text) !PPosition !NodeName |
class HasResDefaults c where Source
resDefaults :: Lens' c ResDefaults Source
resDefPos :: Lens' c PPosition Source
resDefSrcScope :: Lens' c Text Source
resDefType :: Lens' c Text Source
resDefValues :: Lens' c (Container PValue) Source
data ResDefaults Source
From the evaluation of Resource Default Declaration
ResDefaults !Text !Text !(Container PValue) !PPosition |
class HasLinkInformation c where Source
linkInformation :: Lens' c LinkInformation Source
linkPos :: Lens' c PPosition Source
linkType :: Lens' c LinkType Source
linkdst :: Lens' c RIdentifier Source
linksrc :: Lens' c RIdentifier Source
data LinkInformation Source
class HasRIdentifier c where Source
data RIdentifier Source
RIdentifier !Text !Text |
Eq RIdentifier Source | |
Ord RIdentifier Source | |
Show RIdentifier Source | |
Generic RIdentifier Source | |
Hashable RIdentifier Source | |
ToJSON RIdentifier Source | |
FromJSON RIdentifier Source | |
HasRIdentifier RIdentifier Source | |
type Rep RIdentifier Source |
class HasScopeInformation c where Source
scopeInformation :: Lens' c ScopeInformation Source
scopeContainer :: Lens' c CurContainer Source
scopeExtraTags :: Lens' c (HashSet Text) Source
scopeOverrides :: Lens' c (HashMap RIdentifier ResRefOverride) Source
scopeParent :: Lens' c (Maybe Text) Source
scopeResDefaults :: Lens' c (Container ResDefaults) Source
scopeVariables :: Lens' c (Container (Pair (Pair PValue PPosition) CurContainerDesc)) Source
data ScopeInformation Source
ScopeInformation !(Container (Pair (Pair PValue PPosition) CurContainerDesc)) !(Container ResDefaults) !(HashSet Text) !CurContainer !(HashMap RIdentifier ResRefOverride) !(Maybe Text) |
class HasResourceModifier c where Source
resourceModifier :: Lens' c ResourceModifier Source
rmDeclaration :: Lens' c PPosition Source
rmModifierType :: Lens' c ModifierType Source
rmMutation :: Lens' c (Resource -> InterpreterMonad Resource) Source
rmResType :: Lens' c Text Source
rmSearch :: Lens' c RSearchExpression Source
rmType :: Lens' c ResourceCollectorType Source
data ResourceModifier Source
class HasIoMethods c m | c -> m where Source
ioMethods :: Lens' c (IoMethods m) Source
ioGetCurrentCallStack :: Lens' c (m [String]) Source
ioReadFile :: Lens' c ([Text] -> m (Either String Text)) Source
ioTraceEvent :: Lens' c (String -> m ()) Source
HasIoMethods (IoMethods m) m Source |
HasIoMethods (IoMethods m) m Source |
class HasCurContainer c where Source
curContainer :: Lens' c CurContainer Source
cctags :: Lens' c (HashSet Text) Source
cctype :: Lens' c CurContainerDesc Source
data CurContainer Source
TODO related to Scope: explain ...
CurContainer !CurContainerDesc !(HashSet Text) |
class HasNativeTypeMethods c where Source
nativeTypeMethods :: Lens' c NativeTypeMethods Source
puppetFields :: Lens' c (HashSet Text) Source
puppetValidate :: Lens' c NativeTypeValidate Source
data NativeTypeMethods Source
Attributes (and providers) of a puppet resource type bundled with validation rules
NativeTypeMethods NativeTypeValidate (HashSet Text) |
class HasNodeInfo c where Source
nodeInfo :: Lens' c NodeInfo Source
nodeInfoCatalogT :: Lens' c (Maybe UTCTime) Source
nodeInfoDeactivated :: Lens' c Bool Source
nodeInfoFactsT :: Lens' c (Maybe UTCTime) Source
nodeInfoName :: Lens' c NodeName Source
nodeInfoReportT :: Lens' c (Maybe UTCTime) Source
class HasFactInfo c where Source
factInfo :: Lens' c FactInfo Source
factInfoName :: Lens' c Text Source
factInfoNodename :: Lens' c NodeName Source
factInfoVal :: Lens' c PValue Source
class HasWireCatalog c where Source
wireCatalog :: Lens' c WireCatalog Source
wireCatalogEdges :: Lens' c (Vector PuppetEdge) Source
wireCatalogNodename :: Lens' c NodeName Source
wireCatalogResources :: Lens' c (Vector Resource) Source
wireCatalogTransactionUUID :: Lens' c Text Source
wireCatalogVersion :: Lens' c Text Source
Operational instructions
data InterpreterInstr a where Source
MonadThrowPos InterpreterMonad Source | |
MonadWriter InterpreterWriter InterpreterMonad Source | |
MonadError PrettyError InterpreterMonad Source |
class HasInterpreterReader c m | c -> m where Source
interpreterReader :: Lens' c (InterpreterReader m) Source
readerExternalFunc :: Lens' c (Container ([PValue] -> InterpreterMonad PValue)) Source
readerExternalModules :: Lens' c (HashSet Text) Source
readerGetStatement :: Lens' c (TopLevelType -> Text -> m (Either PrettyError Statement)) Source
readerGetTemplate :: Lens' c (Either Text Text -> InterpreterState -> InterpreterReader m -> m (Either PrettyError Text)) Source
readerHieraQuery :: Lens' c (HieraQueryFunc m) Source
readerIgnoredModules :: Lens' c (HashSet Text) Source
readerIoMethods :: Lens' c (IoMethods m) Source
readerIsStrict :: Lens' c Bool Source
readerNativeTypes :: Lens' c (Container NativeTypeMethods) Source
readerNodename :: Lens' c Text Source
readerPdbApi :: Lens' c (PuppetDBAPI m) Source
readerPuppetPaths :: Lens' c PuppetDirPaths Source
data InterpreterReader m Source
InterpreterReader !(Container NativeTypeMethods) (TopLevelType -> Text -> m (Either PrettyError Statement)) (Either Text Text -> InterpreterState -> InterpreterReader m -> m (Either PrettyError Text)) (PuppetDBAPI m) (Container ([PValue] -> InterpreterMonad PValue)) Text (HieraQueryFunc m) (IoMethods m) (HashSet Text) (HashSet Text) Bool PuppetDirPaths |
class HasInterpreterState c where Source
interpreterState :: Lens' c InterpreterState Source
curPos :: Lens' c PPosition Source
curScope :: Lens' c [CurContainerDesc] Source
definedResources :: Lens' c (HashMap RIdentifier Resource) Source
extraRelations :: Lens' c [LinkInformation] Source
loadedClasses :: Lens' c (Container (Pair ClassIncludeType PPosition)) Source
nestedDeclarations :: Lens' c (HashMap (TopLevelType, Text) Statement) Source
resMod :: Lens' c [ResourceModifier] Source
scopes :: Lens' c (Container ScopeInformation) Source
data InterpreterState Source
InterpreterState !(Container ScopeInformation) !(Container (Pair ClassIncludeType PPosition)) !(HashMap RIdentifier Resource) ![CurContainerDesc] !PPosition !(HashMap (TopLevelType, Text) Statement) ![LinkInformation] ![ResourceModifier] |
Sum types
data CurContainerDesc Source
ContRoot | Contained at node or root level |
ContClass !Text | Contained in a class |
ContDefine !Text !Text !PPosition | Contained in a define, along with the position where this define was ... defined |
ContImported !CurContainerDesc | Dummy container for imported resources, so that we know we must update the nodename |
ContImport !NodeName !CurContainerDesc | This one is used when finalizing imported resources, and contains the current node name |
data RSearchExpression Source
Pretty straightforward way to define the various PuppetDB queries
data ModifierType Source
ModifierCollector | For collectors, optional resources |
ModifierMustMatch | For stuff like realize |
data Strictness Source
The intepreter can run in two modes : a strict mode (recommended), and a permissive mode. The permissive mode let known antipatterns work with the interpreter.
Eq Strictness Source | |
Show Strictness Source | |
FromJSON Strictness Source |
data HieraQueryType Source
The different kind of hiera queries
Priority | standard hiera query |
ArrayMerge | hiera_array |
HashMerge | hiera_hash |
data WireCatalog Source
WireCatalog | |
|
Show WireCatalog Source | |
ToJSON WireCatalog Source | |
FromJSON WireCatalog Source | |
HasWireCatalog WireCatalog Source |
data TopLevelType Source
This type is used to differenciate the distinct top level types that are exposed by the DSL.
Eq TopLevelType Source | |
Generic TopLevelType Source | |
Hashable TopLevelType Source | |
type Rep TopLevelType Source |
Fields for the fact endpoint
data ResourceField Source
Fields for the resource endpoint
ToJSON ResourceField Source | |
FromJSON ResourceField Source |
data OverrideType Source
CantOverride | Overriding forbidden, will throw an error |
Replace | Can silently replace |
CantReplace | Silently ignore errors |
AppendAttribute | Can append values |
data ClassIncludeType Source
Puppet has two main ways to declare classes: include-like and resource-like https://docs.puppetlabs.com/puppet/latest/reference/lang_classes.html#include-like-vs-resource-like
ClassIncludeLike | using the include or contain function |
ClassResourceLike | resource like declaration |
PuppetDB
data PuppetEdge Source
Used to represent a relationship between two resources within the wired format (json). See http://docs.puppetlabs.com/puppetdb/2.3/api/wire_format/catalog_format_v5.html#data-type-edge
Show PuppetEdge Source | |
ToJSON PuppetEdge Source | |
FromJSON PuppetEdge Source |
data PuppetDBAPI m Source
newtype & synonym
newtype PrettyError Source
PrettyError | |
|
type InterpreterMonad = ProgramT InterpreterInstr (State InterpreterState) Source
The main monad
type InterpreterWriter = [Pair Priority Doc] Source
Log
type FinalCatalog = HashMap RIdentifier Resource Source
type NativeTypeValidate = Resource -> Either PrettyError Resource Source
type HieraQueryFunc m Source
= Container Text | All the variables that Hiera can interpolate, the top level ones being prefixed with :: |
-> Text | The query |
-> HieraQueryType | |
-> m (Either PrettyError (Maybe PValue)) |
The type of the Hiera API function
type EdgeMap = HashMap RIdentifier [LinkInformation] Source
Classes
class Monad m => MonadThrowPos m where Source
throwPosError :: Doc -> m a Source
definitions
metaparameters :: HashSet Text Source