Revision 518023a9 htools/Ganeti/Query/Query.hs

b/htools/Ganeti/Query/Query.hs
25 25

  
26 26
module Ganeti.Query.Query
27 27
    ( query
28
    , queryFields
28 29
    ) where
29 30

  
30 31
import Data.Maybe (fromMaybe)
......
79 80

  
80 81
query _ (Query qkind _ _) =
81 82
  return . Bad $ "Query '" ++ show qkind ++ "' not supported"
83

  
84
-- | Query fields call.
85
queryFields :: QueryFields -> Result QueryFieldsResult
86
queryFields (QueryFields QRNode fields) =
87
  let selected = if null fields
88
                   then map snd $ Map.toAscList nodeFieldsMap
89
                   else getSelectedFields nodeFieldsMap fields
90
  in Ok $ QueryFieldsResult (map fst selected)
91

  
92
queryFields (QueryFields qkind _) =
93
  Bad $ "QueryFields '" ++ show qkind ++ "' not supported"

Also available in: Unified diff