Safe Haskell | None |
---|
Implementation of the Ganeti confd utilities.
This holds a few utility functions that could be useful in both clients and servers.
Synopsis
- maxClockSkew :: Integer
- 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
- data Pointer = Pointer [String]
- readInteger :: String -> Result Int
- pointerFromString :: String -> Result Pointer
- extractValue :: JSON a => Pointer -> a -> Result JSValue
- extractJSONPath :: JSON a => String -> a -> Result JSValue
Documentation
maxClockSkew :: Integer Source #
Type-adjusted max clock skew constant.
getClusterHmac :: IO HashKey Source #
Returns the HMAC key.
parseSignedMessage :: JSON a => HashKey -> String -> Result (String, String, a) Source #
Parses a signed message.
parseRequest :: HashKey -> String -> Integer -> Result (String, ConfdRequest) Source #
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) Source #
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 Source #
Signs a message with a given key and salt.
readInteger :: String -> Result Int Source #
Parse a fixed size Int.
pointerFromString :: String -> Result Pointer Source #
Parse a path for a JSON structure.
extractValue :: JSON a => Pointer -> a -> Result JSValue Source #
Use a Pointer to access any value nested in a JSON object.
extractJSONPath :: JSON a => String -> a -> Result JSValue Source #
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}] }