Revision 525bfb36 htools/Ganeti/HTools/Rapi.hs
b/htools/Ganeti/HTools/Rapi.hs | ||
---|---|---|
57 | 57 |
|
58 | 58 |
#else |
59 | 59 |
|
60 |
-- | The curl options we use |
|
60 |
-- | The curl options we use.
|
|
61 | 61 |
curlOpts :: [CurlOption] |
62 | 62 |
curlOpts = [ CurlSSLVerifyPeer False |
63 | 63 |
, CurlSSLVerifyHost 0 |
... | ... | |
97 | 97 |
getGroups body = loadJSArray "Parsing group data" body >>= |
98 | 98 |
mapM (parseGroup . fromJSObject) |
99 | 99 |
|
100 |
-- | Generates a fake group list. |
|
100 | 101 |
getFakeGroups :: Result [(String, Group.Group)] |
101 | 102 |
getFakeGroups = |
102 | 103 |
return [(defaultGroupID, |
... | ... | |
173 | 174 |
tags_body <- getUrl $ printf "%s/2/tags" url |
174 | 175 |
return (group_body, node_body, inst_body, tags_body) |
175 | 176 |
|
176 |
-- | Builds the cluster data from the raw Rapi content |
|
177 |
-- | Builds the cluster data from the raw Rapi content.
|
|
177 | 178 |
parseData :: (Result String, Result String, Result String, Result String) |
178 | 179 |
-> Result ClusterData |
179 | 180 |
parseData (group_body, node_body, inst_body, tags_body) = do |
... | ... | |
191 | 192 |
tags_data <- tags_body >>= (fromJResult "Parsing tags data" . decodeStrict) |
192 | 193 |
return (ClusterData group_idx node_idx inst_idx tags_data) |
193 | 194 |
|
194 |
-- | Top level function for data loading |
|
195 |
-- | Top level function for data loading.
|
|
195 | 196 |
loadData :: String -- ^ Cluster or URL to use as source |
196 | 197 |
-> IO (Result ClusterData) |
197 | 198 |
loadData = fmap parseData . readData |
Also available in: Unified diff