module TD.Query.TestProxy
(TestProxy(..)
, defaultTestProxy
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified TD.Data.Proxy as Proxy
data TestProxy
= TestProxy
{ TestProxy -> Maybe Proxy
proxy :: Maybe Proxy.Proxy
, TestProxy -> Maybe Int
dc_id :: Maybe Int
, TestProxy -> Maybe Double
timeout :: Maybe Double
}
deriving (TestProxy -> TestProxy -> Bool
(TestProxy -> TestProxy -> Bool)
-> (TestProxy -> TestProxy -> Bool) -> Eq TestProxy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TestProxy -> TestProxy -> Bool
== :: TestProxy -> TestProxy -> Bool
$c/= :: TestProxy -> TestProxy -> Bool
/= :: TestProxy -> TestProxy -> Bool
Eq, Int -> TestProxy -> ShowS
[TestProxy] -> ShowS
TestProxy -> String
(Int -> TestProxy -> ShowS)
-> (TestProxy -> String)
-> ([TestProxy] -> ShowS)
-> Show TestProxy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TestProxy -> ShowS
showsPrec :: Int -> TestProxy -> ShowS
$cshow :: TestProxy -> String
show :: TestProxy -> String
$cshowList :: [TestProxy] -> ShowS
showList :: [TestProxy] -> ShowS
Show)
instance I.ShortShow TestProxy where
shortShow :: TestProxy -> String
shortShow
TestProxy
{ proxy :: TestProxy -> Maybe Proxy
proxy = Maybe Proxy
proxy_
, dc_id :: TestProxy -> Maybe Int
dc_id = Maybe Int
dc_id_
, timeout :: TestProxy -> Maybe Double
timeout = Maybe Double
timeout_
}
= String
"TestProxy"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"proxy" String -> Maybe Proxy -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Proxy
proxy_
, String
"dc_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
dc_id_
, String
"timeout" String -> Maybe Double -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Double
timeout_
]
instance AT.ToJSON TestProxy where
toJSON :: TestProxy -> Value
toJSON
TestProxy
{ proxy :: TestProxy -> Maybe Proxy
proxy = Maybe Proxy
proxy_
, dc_id :: TestProxy -> Maybe Int
dc_id = Maybe Int
dc_id_
, timeout :: TestProxy -> Maybe Double
timeout = Maybe Double
timeout_
}
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"testProxy"
, Key
"proxy" Key -> Maybe Proxy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Proxy
proxy_
, Key
"dc_id" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
dc_id_
, Key
"timeout" Key -> Maybe Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Double
timeout_
]
defaultTestProxy :: TestProxy
defaultTestProxy :: TestProxy
defaultTestProxy =
TestProxy
{ proxy :: Maybe Proxy
proxy = Maybe Proxy
forall a. Maybe a
Nothing
, dc_id :: Maybe Int
dc_id = Maybe Int
forall a. Maybe a
Nothing
, timeout :: Maybe Double
timeout = Maybe Double
forall a. Maybe a
Nothing
}