Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Client = Client {}
- versionPrefix :: String
- buildUrl :: Client -> String -> String
- data Action
- data Response = Response {
- _resAction :: Action
- _resNode :: Node
- _resPrevNode :: Maybe Node
- data Error = Error
- data Node = Node {
- _nodeKey :: String
- _nodeValue :: Maybe String
- _nodeCreatedIndex :: Int
- _nodeModifiedIndex :: Int
- _nodeNodes :: Maybe [Node]
- type HR = Either Error Response
- httpGET :: String -> IO HR
- httpPOST :: String -> [(String, String)] -> IO HR
- runRequest :: IO HR -> IO HR
- ignoreExceptionWith :: a -> SomeException -> a
- createClient :: [String] -> IO Client
- listKeys :: Client -> String -> IO [Node]
- getKey :: Client -> String -> IO (Maybe Node)
- putKey :: Client -> String -> String -> IO ()
Documentation
versionPrefix :: String Source
The version prefix used in URLs. The current client supports v2.
Each response comes with an "action" field, which describes what kind of action was performed.
The server responds with this object to all successful requests.
Response | |
|
The server sometimes responds to errors with this error object.
Node | |
|
type HR = Either Error Response Source
- --------------------------------------------------------------------------
Low-level HTTP interface
The functions here are used internally when sending requests to etcd. If the server is running, the result is 'Either Error Response'. These functions may throw an exception if the server is unreachable or not responding.
runRequest :: IO HR -> IO HR Source
Run a low-level HTTP request. Catch any exceptions and convert them into a 'Left Error'.
ignoreExceptionWith :: a -> SomeException -> a Source
createClient :: [String] -> IO Client Source
- --------------------------------------------------------------------------
Public API
Create a new client and initialize it with a list of seed machines. The list must be non-empty.