module TD.Query.EditProxy
(EditProxy(..)
, defaultEditProxy
) 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 EditProxy
= EditProxy
{ EditProxy -> Maybe Int
proxy_id :: Maybe Int
, EditProxy -> Maybe Text
server :: Maybe T.Text
, EditProxy -> Maybe Int
port :: Maybe Int
, EditProxy -> Maybe Bool
enable :: Maybe Bool
, EditProxy -> Maybe ProxyType
_type :: Maybe ProxyType.ProxyType
}
deriving (EditProxy -> EditProxy -> Bool
(EditProxy -> EditProxy -> Bool)
-> (EditProxy -> EditProxy -> Bool) -> Eq EditProxy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EditProxy -> EditProxy -> Bool
== :: EditProxy -> EditProxy -> Bool
$c/= :: EditProxy -> EditProxy -> Bool
/= :: EditProxy -> EditProxy -> Bool
Eq, Int -> EditProxy -> ShowS
[EditProxy] -> ShowS
EditProxy -> String
(Int -> EditProxy -> ShowS)
-> (EditProxy -> String)
-> ([EditProxy] -> ShowS)
-> Show EditProxy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EditProxy -> ShowS
showsPrec :: Int -> EditProxy -> ShowS
$cshow :: EditProxy -> String
show :: EditProxy -> String
$cshowList :: [EditProxy] -> ShowS
showList :: [EditProxy] -> ShowS
Show)
instance I.ShortShow EditProxy where
shortShow :: EditProxy -> String
shortShow
EditProxy
{ proxy_id :: EditProxy -> Maybe Int
proxy_id = Maybe Int
proxy_id_
, server :: EditProxy -> Maybe Text
server = Maybe Text
server_
, port :: EditProxy -> Maybe Int
port = Maybe Int
port_
, enable :: EditProxy -> Maybe Bool
enable = Maybe Bool
enable_
, _type :: EditProxy -> Maybe ProxyType
_type = Maybe ProxyType
_type_
}
= String
"EditProxy"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"proxy_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
proxy_id_
, 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
"enable" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
enable_
, String
"_type" String -> Maybe ProxyType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ProxyType
_type_
]
instance AT.ToJSON EditProxy where
toJSON :: EditProxy -> Value
toJSON
EditProxy
{ proxy_id :: EditProxy -> Maybe Int
proxy_id = Maybe Int
proxy_id_
, server :: EditProxy -> Maybe Text
server = Maybe Text
server_
, port :: EditProxy -> Maybe Int
port = Maybe Int
port_
, enable :: EditProxy -> Maybe Bool
enable = Maybe Bool
enable_
, _type :: EditProxy -> Maybe ProxyType
_type = Maybe ProxyType
_type_
}
= [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
"editProxy"
, Key
"proxy_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
proxy_id_
, 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
"enable" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
enable_
, 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_
]
defaultEditProxy :: EditProxy
defaultEditProxy :: EditProxy
defaultEditProxy =
EditProxy
{ proxy_id :: Maybe Int
proxy_id = Maybe Int
forall a. Maybe a
Nothing
, server :: Maybe Text
server = Maybe Text
forall a. Maybe a
Nothing
, port :: Maybe Int
port = Maybe Int
forall a. Maybe a
Nothing
, enable :: Maybe Bool
enable = Maybe Bool
forall a. Maybe a
Nothing
, _type :: Maybe ProxyType
_type = Maybe ProxyType
forall a. Maybe a
Nothing
}