diff --git a/htools/Ganeti/Luxi.hs b/htools/Ganeti/Luxi.hs index dd38c5a47e8ebb49fa81d7057ec58327c5291ea5..3afd41ffb72ecb4c6bbe77da1f5a3137d4c637b0 100644 --- a/htools/Ganeti/Luxi.hs +++ b/htools/Ganeti/Luxi.hs @@ -29,6 +29,7 @@ module Ganeti.Luxi ( LuxiOp(..) , QrViaLuxi(..) , ResultStatus(..) + , LuxiReq(..) , Client , checkRS , getClient @@ -144,6 +145,8 @@ $(genLuxiOp "LuxiOp" ) ]) +$(makeJSONInstance ''LuxiReq) + -- | The serialisation of LuxiOps into strings in messages. $(genStrOfOp ''LuxiOp "strOfOp") diff --git a/htools/Ganeti/THH.hs b/htools/Ganeti/THH.hs index 859eb81b15a641961b1f1f297662b45524375994..cc41388c3de356f4b9f0e076a93f0f2459fc2e16 100644 --- a/htools/Ganeti/THH.hs +++ b/htools/Ganeti/THH.hs @@ -543,7 +543,10 @@ genLuxiOp name cons = do cons let declD = DataD [] (mkName name) [] decl_d [''Show, ''Read] (savesig, savefn) <- genSaveLuxiOp cons - return [declD, savesig, savefn] + req_defs <- declareSADT "LuxiReq" . + map (\(str, _) -> ("Req" ++ str, mkName ("luxiReq" ++ str))) $ + cons + return $ [declD, savesig, savefn] ++ req_defs -- | Generates the \"save\" expression for a single luxi parameter. saveLuxiField :: Name -> LuxiParam -> Q Exp