Commit 72295708 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add missing luxi query 'QueryFields'



This was missed; we add the definition and the de-serialisation
support.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarAgata Murawska <agatamurawska@google.com>
parent 046fe3f5
......@@ -1954,6 +1954,7 @@ instance Arbitrary Luxi.LuxiOp where
lreq <- arbitrary
case lreq of
Luxi.ReqQuery -> Luxi.Query <$> arbitrary <*> getFields <*> genFilter
Luxi.ReqQueryFields -> Luxi.QueryFields <$> arbitrary <*> getFields
Luxi.ReqQueryNodes -> Luxi.QueryNodes <$> (listOf getFQDN) <*>
getFields <*> arbitrary
Luxi.ReqQueryGroups -> Luxi.QueryGroups <$> arbitrary <*>
......
......@@ -109,11 +109,15 @@ $(makeJSONInstance ''TagObject)
-- | Currently supported Luxi operations and JSON serialization.
$(genLuxiOp "LuxiOp"
[(luxiReqQuery,
[ (luxiReqQuery,
[ ("what", [t| Qlang.ItemType |])
, ("fields", [t| [String] |])
, ("qfilter", [t| Qlang.Filter |])
])
, (luxiReqQueryFields,
[ ("what", [t| Qlang.ItemType |])
, ("fields", [t| [String] |])
])
, (luxiReqQueryNodes,
[ ("names", [t| [String] |])
, ("fields", [t| [String] |])
......@@ -343,6 +347,12 @@ decodeCall (LuxiCall call args) =
ReqQuery -> do
(what, fields, qfilter) <- fromJVal args
return $ Query what fields qfilter
ReqQueryFields -> do
(what, fields) <- fromJVal args
fields' <- case fields of
JSNull -> return []
_ -> fromJVal fields
return $ QueryFields what fields'
ReqSubmitJob -> do
[ops1] <- fromJVal args
ops2 <- mapM (fromJResult (luxiReqToRaw call) . J.readJSON) ops1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment