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 Data.Text as T
import qualified TD.Data.ProxyType as ProxyType
data TestProxy
= TestProxy
{ TestProxy -> Maybe Text
server :: Maybe T.Text
, TestProxy -> Maybe Int
port :: Maybe Int
, TestProxy -> Maybe ProxyType
_type :: Maybe ProxyType.ProxyType
, 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
{ server :: TestProxy -> Maybe Text
server = Maybe Text
server_
, port :: TestProxy -> Maybe Int
port = Maybe Int
port_
, _type :: TestProxy -> Maybe ProxyType
_type = Maybe ProxyType
_type_
, 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
"server" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
server_
, String
"port" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
port_
, String
"_type" String -> Maybe ProxyType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ProxyType
_type_
, 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
{ server :: TestProxy -> Maybe Text
server = Maybe Text
server_
, port :: TestProxy -> Maybe Int
port = Maybe Int
port_
, _type :: TestProxy -> Maybe ProxyType
_type = Maybe ProxyType
_type_
, 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
"server" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
server_
, Key
"port" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
port_
, Key
"type" Key -> Maybe ProxyType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe ProxyType
_type_
, 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
{ server :: Maybe Text
server = Maybe Text
forall a. Maybe a
Nothing
, port :: Maybe Int
port = Maybe Int
forall a. Maybe a
Nothing
, _type :: Maybe ProxyType
_type = Maybe ProxyType
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
}