Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Ganeti.Confd.Utils
Description
Implementation of the Ganeti confd utilities.
This holds a few utility functions that could be useful in both clients and servers.
Synopsis
- getClusterHmac :: IO HashKey
- parseSignedMessage :: JSON a => HashKey -> String -> Result (String, String, a)
- parseRequest :: HashKey -> String -> Integer -> Result (String, ConfdRequest)
- parseReply :: HashKey -> String -> String -> Result (String, ConfdReply)
- signMessage :: HashKey -> String -> String -> SignedMessage
- getCurrentTime :: IO Integer
- extractJSONPath :: JSON a => String -> a -> Result JSValue
Documentation
getClusterHmac :: IO HashKey #
Returns the HMAC key.
parseSignedMessage :: JSON a => HashKey -> String -> Result (String, String, a) #
Parses a signed message.
parseRequest :: HashKey -> String -> Integer -> Result (String, ConfdRequest) #
Message parsing. This can either result in a good, valid request message, or fail in the Result monad.
parseReply :: HashKey -> String -> String -> Result (String, ConfdReply) #
Message parsing. This can either result in a good, valid reply message, or fail in the Result monad. It also checks that the salt in the message corresponds to the one that is expected
signMessage :: HashKey -> String -> String -> SignedMessage #
Signs a message with a given key and salt.
getCurrentTime :: IO Integer #
Returns the current time as an Integer
representing the number
of seconds from the Unix epoch.
extractJSONPath :: JSON a => String -> a -> Result JSValue #
Extract a JSValue
from an object at the position defined by the path.
The path syntax follows RCF6901. Error is returned if the path doesn't exist, Ok if the path leads to an valid value.
JSON pointer syntax according to RFC6901:
"/path/0/x" => Pointer ["path", "0", "x"]
This accesses 1 in the following JSON:
{ "path": { "0": { "x": 1 } } }
or the following:
{ "path": [{"x": 1}] }