@@ -62,6 +62,7 @@ module Database.Bloodhound.Types
62 , MonadBH(..)
62 , MonadBH(..)
63 , Version(..)
63 , Version(..)
64 , VersionNumber(..)
64 , VersionNumber(..)
65 , BuildHash(..)
66 , BuildHash(..)
66 , Status(..)
67 , Status(..)
67 , Existence(..)
68 , Existence(..)
@@ -4189,7 +4190,7 @@ data NodePluginInfo = NodePluginInfo {
4189 , nodePluginJVM :: Bool
4190 , nodePluginJVM :: Bool
4190 -- ^ Is this plugin running on the JVM
4191 -- ^ Is this plugin running on the JVM
4191 , nodePluginDescription :: Text
4192 , nodePluginDescription :: Text
4192− , nodePluginVersion :: Maybe VersionNumber
4193+ , nodePluginVersion :: MaybeNA VersionNumber
4193 , nodePluginName :: PluginName
4194 , nodePluginName :: PluginName
4194 } deriving (Eq, Show, Generic, Typeable)
4195 } deriving (Eq, Show, Generic, Typeable)
@@ -4875,7 +4876,7 @@ instance FromJSON NodeOSStats where
4875 swap <- o .: "swap"
4876 swap <- o .: "swap"
4876 mem <- o .: "mem"
4877 mem <- o .: "mem"
4877 cpu <- o .: "cpu"
4878 cpu <- o .: "cpu"
4878− load <- (Just <$> o .: "load_average" <|> pure Nothing)
4879+ load <- o .:? "load_average"
4879 NodeOSStats <$> swap .: "free_in_bytes"
4880 NodeOSStats <$> swap .: "free_in_bytes"
4880 <*> swap .: "used_in_bytes"
4881 <*> swap .: "used_in_bytes"
4881 <*> mem .: "actual_used_in_bytes"
4882 <*> mem .: "actual_used_in_bytes"
@@ -5047,7 +5048,7 @@ instance FromJSON NodePluginInfo where
5047 parse o = NodePluginInfo <$> o .: "site"
5048 parse o = NodePluginInfo <$> o .: "site"
5048 <*> o .: "jvm"
5049 <*> o .: "jvm"
5049 <*> o .: "description"
5050 <*> o .: "description"
5050− <*> (Just <$> (o .: "version") <|> pure Nothing)
5051+ <*> o .: "version"
5051 <*> o .: "name"
5052 <*> o .: "name"
5053instance FromJSON NodeHTTPInfo where
5054instance FromJSON NodeHTTPInfo where
@@ -5212,3 +5213,10 @@ instance FromJSON NodeNetworkInterface where
5212 parse o = NodeNetworkInterface <$> o .: "mac_address"
5213 parse o = NodeNetworkInterface <$> o .: "mac_address"
5213 <*> o .: "name"
5214 <*> o .: "name"
5214 <*> o .: "address"
5215 <*> o .: "address"
5217+newtype MaybeNA a = MaybeNA { unMaybeNA :: Maybe a }
5218+ deriving (Show, Eq)
5220+instance FromJSON a => FromJSON (MaybeNA a) where
5221+ parseJSON (String "NA") = pure $ MaybeNA Nothing
5222+ parseJSON o = MaybeNA . Just <$> parseJSON o