{-# LANGUAGE DeriveAnyClass #-} module Hercules.API.Agent.LifeCycle.AgentInfo where import Control.Applicative import Control.Lens (at, (%~)) import qualified Data.Aeson as A import Data.Aeson.Lens (_Object) import Data.Function import Hercules.API.Prelude data AgentInfo = AgentInfo { AgentInfo -> Text hostname :: Text, AgentInfo -> Text agentVersion :: Text, AgentInfo -> Text nixVersion :: Text, AgentInfo -> Int nixClientProtocolVersion :: Int, AgentInfo -> Int nixDaemonProtocolVersion :: Int, AgentInfo -> [Text] platforms :: [Text], AgentInfo -> [Text] systemFeatures :: [Text], AgentInfo -> [Text] cachixPushCaches :: [Text], AgentInfo -> [Text] pushCaches :: [Text], AgentInfo -> [Text] substituters :: [Text], AgentInfo -> Int concurrentTasks :: Int, AgentInfo -> Map Text Value labels :: Map Text A.Value } deriving ((forall x. AgentInfo -> Rep AgentInfo x) -> (forall x. Rep AgentInfo x -> AgentInfo) -> Generic AgentInfo forall x. Rep AgentInfo x -> AgentInfo forall x. AgentInfo -> Rep AgentInfo x forall a. (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a $cto :: forall x. Rep AgentInfo x -> AgentInfo $cfrom :: forall x. AgentInfo -> Rep AgentInfo x Generic, Int -> AgentInfo -> ShowS [AgentInfo] -> ShowS AgentInfo -> String (Int -> AgentInfo -> ShowS) -> (AgentInfo -> String) -> ([AgentInfo] -> ShowS) -> Show AgentInfo forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [AgentInfo] -> ShowS $cshowList :: [AgentInfo] -> ShowS show :: AgentInfo -> String $cshow :: AgentInfo -> String showsPrec :: Int -> AgentInfo -> ShowS $cshowsPrec :: Int -> AgentInfo -> ShowS Show, AgentInfo -> AgentInfo -> Bool (AgentInfo -> AgentInfo -> Bool) -> (AgentInfo -> AgentInfo -> Bool) -> Eq AgentInfo forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: AgentInfo -> AgentInfo -> Bool $c/= :: AgentInfo -> AgentInfo -> Bool == :: AgentInfo -> AgentInfo -> Bool $c== :: AgentInfo -> AgentInfo -> Bool Eq, AgentInfo -> () (AgentInfo -> ()) -> NFData AgentInfo forall a. (a -> ()) -> NFData a rnf :: AgentInfo -> () $crnf :: AgentInfo -> () NFData, [AgentInfo] -> Encoding [AgentInfo] -> Value AgentInfo -> Encoding AgentInfo -> Value (AgentInfo -> Value) -> (AgentInfo -> Encoding) -> ([AgentInfo] -> Value) -> ([AgentInfo] -> Encoding) -> ToJSON AgentInfo forall a. (a -> Value) -> (a -> Encoding) -> ([a] -> Value) -> ([a] -> Encoding) -> ToJSON a toEncodingList :: [AgentInfo] -> Encoding $ctoEncodingList :: [AgentInfo] -> Encoding toJSONList :: [AgentInfo] -> Value $ctoJSONList :: [AgentInfo] -> Value toEncoding :: AgentInfo -> Encoding $ctoEncoding :: AgentInfo -> Encoding toJSON :: AgentInfo -> Value $ctoJSON :: AgentInfo -> Value ToJSON) instance FromJSON AgentInfo where parseJSON :: Value -> Parser AgentInfo parseJSON = Options -> Value -> Parser AgentInfo forall a. (Generic a, GFromJSON Zero (Rep a)) => Options -> Value -> Parser a A.genericParseJSON Options A.defaultOptions (Value -> Parser AgentInfo) -> (Value -> Value) -> Value -> Parser AgentInfo forall b c a. (b -> c) -> (a -> b) -> a -> c . Value -> Value fixup where fixup :: A.Value -> A.Value fixup :: Value -> Value fixup Value v = Value v Value -> (Value -> Value) -> Value forall a b. a -> (a -> b) -> b & (HashMap Text Value -> Identity (HashMap Text Value)) -> Value -> Identity Value forall t. AsValue t => Prism' t (HashMap Text Value) _Object ((HashMap Text Value -> Identity (HashMap Text Value)) -> Value -> Identity Value) -> ((Maybe Value -> Identity (Maybe Value)) -> HashMap Text Value -> Identity (HashMap Text Value)) -> (Maybe Value -> Identity (Maybe Value)) -> Value -> Identity Value forall b c a. (b -> c) -> (a -> b) -> a -> c . Index (HashMap Text Value) -> Lens' (HashMap Text Value) (Maybe (IxValue (HashMap Text Value))) forall m. At m => Index m -> Lens' m (Maybe (IxValue m)) at Index (HashMap Text Value) "concurrentTasks" ((Maybe Value -> Identity (Maybe Value)) -> Value -> Identity Value) -> (Maybe Value -> Maybe Value) -> Value -> Value forall s t a b. ASetter s t a b -> (a -> b) -> s -> t %~ (Maybe Value -> Maybe Value -> Maybe Value forall (f :: * -> *) a. Alternative f => f a -> f a -> f a <|> Value -> Maybe Value forall a. a -> Maybe a Just (Scientific -> Value A.Number Scientific 2)) Value -> (Value -> Value) -> Value forall a b. a -> (a -> b) -> b & (HashMap Text Value -> Identity (HashMap Text Value)) -> Value -> Identity Value forall t. AsValue t => Prism' t (HashMap Text Value) _Object ((HashMap Text Value -> Identity (HashMap Text Value)) -> Value -> Identity Value) -> ((Maybe Value -> Identity (Maybe Value)) -> HashMap Text Value -> Identity (HashMap Text Value)) -> (Maybe Value -> Identity (Maybe Value)) -> Value -> Identity Value forall b c a. (b -> c) -> (a -> b) -> a -> c . Index (HashMap Text Value) -> Lens' (HashMap Text Value) (Maybe (IxValue (HashMap Text Value))) forall m. At m => Index m -> Lens' m (Maybe (IxValue m)) at Index (HashMap Text Value) "pushCaches" ((Maybe Value -> Identity (Maybe Value)) -> Value -> Identity Value) -> (Maybe Value -> Maybe Value) -> Value -> Value forall s t a b. ASetter s t a b -> (a -> b) -> s -> t %~ (Maybe Value -> Maybe Value -> Maybe Value forall (f :: * -> *) a. Alternative f => f a -> f a -> f a <|> Value -> Maybe Value forall a. a -> Maybe a Just (Array -> Value A.Array Array forall a. Monoid a => a mempty)) Value -> (Value -> Value) -> Value forall a b. a -> (a -> b) -> b & (HashMap Text Value -> Identity (HashMap Text Value)) -> Value -> Identity Value forall t. AsValue t => Prism' t (HashMap Text Value) _Object ((HashMap Text Value -> Identity (HashMap Text Value)) -> Value -> Identity Value) -> ((Maybe Value -> Identity (Maybe Value)) -> HashMap Text Value -> Identity (HashMap Text Value)) -> (Maybe Value -> Identity (Maybe Value)) -> Value -> Identity Value forall b c a. (b -> c) -> (a -> b) -> a -> c . Index (HashMap Text Value) -> Lens' (HashMap Text Value) (Maybe (IxValue (HashMap Text Value))) forall m. At m => Index m -> Lens' m (Maybe (IxValue m)) at Index (HashMap Text Value) "nixClientProtocolVersion" ((Maybe Value -> Identity (Maybe Value)) -> Value -> Identity Value) -> (Maybe Value -> Maybe Value) -> Value -> Value forall s t a b. ASetter s t a b -> (a -> b) -> s -> t %~ (Maybe Value -> Maybe Value -> Maybe Value forall (f :: * -> *) a. Alternative f => f a -> f a -> f a <|> Value -> Maybe Value forall a. a -> Maybe a Just (Scientific -> Value A.Number Scientific 0)) Value -> (Value -> Value) -> Value forall a b. a -> (a -> b) -> b & (HashMap Text Value -> Identity (HashMap Text Value)) -> Value -> Identity Value forall t. AsValue t => Prism' t (HashMap Text Value) _Object ((HashMap Text Value -> Identity (HashMap Text Value)) -> Value -> Identity Value) -> ((Maybe Value -> Identity (Maybe Value)) -> HashMap Text Value -> Identity (HashMap Text Value)) -> (Maybe Value -> Identity (Maybe Value)) -> Value -> Identity Value forall b c a. (b -> c) -> (a -> b) -> a -> c . Index (HashMap Text Value) -> Lens' (HashMap Text Value) (Maybe (IxValue (HashMap Text Value))) forall m. At m => Index m -> Lens' m (Maybe (IxValue m)) at Index (HashMap Text Value) "nixDaemonProtocolVersion" ((Maybe Value -> Identity (Maybe Value)) -> Value -> Identity Value) -> (Maybe Value -> Maybe Value) -> Value -> Value forall s t a b. ASetter s t a b -> (a -> b) -> s -> t %~ (Maybe Value -> Maybe Value -> Maybe Value forall (f :: * -> *) a. Alternative f => f a -> f a -> f a <|> Value -> Maybe Value forall a. a -> Maybe a Just (Scientific -> Value A.Number Scientific 0)) Value -> (Value -> Value) -> Value forall a b. a -> (a -> b) -> b & (HashMap Text Value -> Identity (HashMap Text Value)) -> Value -> Identity Value forall t. AsValue t => Prism' t (HashMap Text Value) _Object ((HashMap Text Value -> Identity (HashMap Text Value)) -> Value -> Identity Value) -> ((Maybe Value -> Identity (Maybe Value)) -> HashMap Text Value -> Identity (HashMap Text Value)) -> (Maybe Value -> Identity (Maybe Value)) -> Value -> Identity Value forall b c a. (b -> c) -> (a -> b) -> a -> c . Index (HashMap Text Value) -> Lens' (HashMap Text Value) (Maybe (IxValue (HashMap Text Value))) forall m. At m => Index m -> Lens' m (Maybe (IxValue m)) at Index (HashMap Text Value) "labels" ((Maybe Value -> Identity (Maybe Value)) -> Value -> Identity Value) -> (Maybe Value -> Maybe Value) -> Value -> Value forall s t a b. ASetter s t a b -> (a -> b) -> s -> t %~ (Maybe Value -> Maybe Value -> Maybe Value forall (f :: * -> *) a. Alternative f => f a -> f a -> f a <|> Value -> Maybe Value forall a. a -> Maybe a Just (HashMap Text Value -> Value A.Object HashMap Text Value forall a. Monoid a => a mempty))