Add export_list RPC call definitions
authorIustin Pop <iustin@google.com>
Thu, 21 Feb 2013 13:54:19 +0000 (14:54 +0100)
committerIustin Pop <iustin@google.com>
Mon, 25 Feb 2013 09:36:59 +0000 (10:36 +0100)
This is straightforward, as the call has no parameters and a very simple return type.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

src/Ganeti/Rpc.hs

index 3f86e3d..73d22ca 100644 (file)
@@ -66,6 +66,9 @@ module Ganeti.Rpc
   , RpcCallTestDelay(..)
   , RpcResultTestDelay(..)
 
+  , RpcCallExportList(..)
+  , RpcResultExportList(..)
+
   , rpcTimeoutFromRaw -- FIXME: Not used anywhere
   ) where
 
@@ -440,7 +443,6 @@ instance Rpc RpcCallStorageList RpcResultStorageList where
 
 -- ** TestDelay
 
-
 -- | Call definition for test delay.
 $(buildObject "RpcCallTestDelay" "rpcCallTestDelay"
   [ simpleField "duration" [t| Double |]
@@ -464,3 +466,23 @@ instance RpcCall RpcCallTestDelay where
 
 instance Rpc RpcCallTestDelay RpcResultTestDelay where
   rpcResultFill _ res = fromJSValueToRes res id
+
+-- ** ExportList
+
+-- | Call definition for export list.
+
+$(buildObject "RpcCallExportList" "rpcCallExportList" [])
+
+-- | Result definition for export list.
+$(buildObject "RpcResultExportList" "rpcResExportList"
+  [ simpleField "exports" [t| [String] |]
+  ])
+
+instance RpcCall RpcCallExportList where
+  rpcCallName _          = "export_list"
+  rpcCallTimeout _       = rpcTimeoutToRaw Fast
+  rpcCallAcceptOffline _ = False
+  rpcCallData _          = J.encode
+
+instance Rpc RpcCallExportList RpcResultExportList where
+  rpcResultFill _ res = fromJSValueToRes res RpcResultExportList