Safe Haskell | None |
---|---|
Language | Haskell98 |
Common data types for PuppetDB.
Synopsis
- dummyPuppetDB :: Monad m => PuppetDBAPI m
- getDefaultDB :: PDBType -> IO (Either PrettyError (PuppetDBAPI IO))
- pdbConnect :: Manager -> String -> IO (Either PrettyError (PuppetDBAPI IO))
- loadTestDB :: FilePath -> IO (Either PrettyError (PuppetDBAPI IO))
- generateWireCatalog :: NodeName -> FinalCatalog -> EdgeMap -> WireCatalog
- puppetDBFacts :: NodeName -> PuppetDBAPI IO -> IO (HashMap Text PValue)
- data PDBType
- data NodeInfo = NodeInfo {
- _nodeInfoName :: !NodeName
- _nodeInfoDeactivated :: !Bool
- _nodeInfoCatalogT :: !(Maybe UTCTime)
- _nodeInfoFactsT :: !(Maybe UTCTime)
- _nodeInfoReportT :: !(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 Query a
- data FactField
- data NodeField
- data ResourceField
- data PuppetDBAPI m = PuppetDBAPI {
- pdbInformation :: m Doc
- replaceCatalog :: WireCatalog -> ExceptT PrettyError m ()
- replaceFacts :: [(NodeName, Facts)] -> ExceptT PrettyError m ()
- deactivateNode :: NodeName -> ExceptT PrettyError m ()
- getPDBFacts :: 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]
Documentation
dummyPuppetDB :: Monad m => PuppetDBAPI m Source #
A dummy implementation of PuppetDBAPI
, that will return empty responses.
getDefaultDB :: PDBType -> IO (Either PrettyError (PuppetDBAPI IO)) Source #
Given a PDBType
, will try return a sane default implementation.
pdbConnect :: Manager -> String -> IO (Either PrettyError (PuppetDBAPI IO)) Source #
Given an URL (ie. http://localhost:8080
), will return an incomplete PuppetDBAPI
.
loadTestDB :: FilePath -> IO (Either PrettyError (PuppetDBAPI IO)) Source #
Initializes the test DB using a file to back its content
generateWireCatalog :: NodeName -> FinalCatalog -> EdgeMap -> WireCatalog Source #
Turns a FinalCatalog
and EdgeMap
into a document that can be
serialized and fed to puppet apply
.
puppetDBFacts :: NodeName -> PuppetDBAPI IO -> IO (HashMap Text PValue) Source #
The supported PuppetDB implementations.
PDBRemote | Your standard PuppetDB, queried through the HTTP interface. |
PDBDummy | A stupid stub, this is the default choice. |
PDBTest | A slow but handy PuppetDB implementation that is backed by a YAML file. |
NodeInfo | |
|
Instances
ToJSON NodeInfo Source # | |
Defined in PuppetDB.Core | |
FromJSON NodeInfo Source # | |
HasNodeInfo NodeInfo Source # | |
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 #
Instances
HasNodeInfo NodeInfo Source # | |
Pretty straightforward way to define the various PuppetDB queries
QEqual a Text | |
QG a Integer | |
QL a Integer | |
QGE a Integer | |
QLE a Integer | |
QMatch Text Text | |
QAnd [Query a] | |
QOr [Query a] | |
QNot (Query a) | |
QEmpty |
Instances
ToJSON a => ToJSON (Query a) Source # | |
Defined in PuppetDB.Core | |
FromJSON a => FromJSON (Query a) Source # | |
ToJSON a => ToHttpApiData (Query a) Source # | |
Defined in PuppetDB.Core toUrlPiece :: Query a -> Text # toEncodedUrlPiece :: Query a -> Builder # toHeader :: Query a -> ByteString # toQueryParam :: Query a -> Text # |
Fields for the fact endpoint
Fields for the node endpoint
data ResourceField Source #
Fields for the resource endpoint
Instances
ToJSON ResourceField Source # | |
Defined in PuppetDB.Core toJSON :: ResourceField -> Value # toEncoding :: ResourceField -> Encoding # toJSONList :: [ResourceField] -> Value # toEncodingList :: [ResourceField] -> Encoding # | |
FromJSON ResourceField Source # | |
Defined in PuppetDB.Core parseJSON :: Value -> Parser ResourceField # parseJSONList :: Value -> Parser [ResourceField] # |
data PuppetDBAPI m Source #
PuppetDBAPI | |
|