ganeti
Safe HaskellNone

Ganeti.HTools.Backend.Rapi

Description

Implementation of the RAPI client interface.

Synopsis

Documentation

filePrefix :: String Source #

File method prefix.

getUrl :: MonadFail m => String -> IO (m String) Source #

Read an URL via curl and return the body if successful.

connTimeout :: Long Source #

Connection timeout (when using non-file methods).

queryTimeout :: Long Source #

The default timeout for queries (when using non-file methods).

curlOpts :: [CurlOption] Source #

The curl options we use.

ioErrToResult :: IO a -> IO (Result a) Source #

Helper to convert I/O errors in Bad values.

formatHost :: String -> String Source #

Append the default port if not passed in.

getInstances :: NameAssoc -> String -> Result [(String, Instance)] Source #

Parse a instance list in JSON format.

getNodes :: NameAssoc -> String -> Result [(String, Node)] Source #

Parse a node list in JSON format.

getGroups :: String -> Result [(String, Group)] Source #

Parse a group list in JSON format.

parseInstance :: NameAssoc -> JSRecord -> Result (String, Instance) Source #

Construct an instance from a JSON object.

parseNode :: NameAssoc -> JSRecord -> Result (String, Node) Source #

Construct a node from a JSON object.

parseGroup :: JSRecord -> Result (String, Group) Source #

Construct a group from a JSON object.

parseCluster :: JSObject JSValue -> Result ([String], IPolicy, String, Hypervisor) Source #

Parse cluster data from the info resource.

readDataHttp Source #

Arguments

:: String

Cluster or URL to use as source

-> IO (Result String, Result String, Result String, Result String) 

Loads the raw cluster data from an URL.

readDataFile Source #

Arguments

:: String

Path to the directory containing the files

-> IO (Result String, Result String, Result String, Result String) 

Loads the raw cluster data from the filesystem.

readData Source #

Arguments

:: String

URL to use as source

-> IO (Result String, Result String, Result String, Result String) 

Loads data via either readDataFile or readDataHttp.

parseData :: (Result String, Result String, Result String, Result String) -> Result ClusterData Source #

Builds the cluster data from the raw Rapi content.

loadData Source #

Arguments

:: String

Cluster or URL to use as source

-> IO (Result ClusterData) 

Top level function for data loading.