{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.AppMesh.Types.TcpTimeout where
import Amazonka.AppMesh.Types.Duration
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data TcpTimeout = TcpTimeout'
{
TcpTimeout -> Maybe Duration
idle :: Prelude.Maybe Duration
}
deriving (TcpTimeout -> TcpTimeout -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TcpTimeout -> TcpTimeout -> Bool
$c/= :: TcpTimeout -> TcpTimeout -> Bool
== :: TcpTimeout -> TcpTimeout -> Bool
$c== :: TcpTimeout -> TcpTimeout -> Bool
Prelude.Eq, ReadPrec [TcpTimeout]
ReadPrec TcpTimeout
Int -> ReadS TcpTimeout
ReadS [TcpTimeout]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TcpTimeout]
$creadListPrec :: ReadPrec [TcpTimeout]
readPrec :: ReadPrec TcpTimeout
$creadPrec :: ReadPrec TcpTimeout
readList :: ReadS [TcpTimeout]
$creadList :: ReadS [TcpTimeout]
readsPrec :: Int -> ReadS TcpTimeout
$creadsPrec :: Int -> ReadS TcpTimeout
Prelude.Read, Int -> TcpTimeout -> ShowS
[TcpTimeout] -> ShowS
TcpTimeout -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TcpTimeout] -> ShowS
$cshowList :: [TcpTimeout] -> ShowS
show :: TcpTimeout -> String
$cshow :: TcpTimeout -> String
showsPrec :: Int -> TcpTimeout -> ShowS
$cshowsPrec :: Int -> TcpTimeout -> ShowS
Prelude.Show, forall x. Rep TcpTimeout x -> TcpTimeout
forall x. TcpTimeout -> Rep TcpTimeout x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TcpTimeout x -> TcpTimeout
$cfrom :: forall x. TcpTimeout -> Rep TcpTimeout x
Prelude.Generic)
newTcpTimeout ::
TcpTimeout
newTcpTimeout :: TcpTimeout
newTcpTimeout = TcpTimeout' {$sel:idle:TcpTimeout' :: Maybe Duration
idle = forall a. Maybe a
Prelude.Nothing}
tcpTimeout_idle :: Lens.Lens' TcpTimeout (Prelude.Maybe Duration)
tcpTimeout_idle :: Lens' TcpTimeout (Maybe Duration)
tcpTimeout_idle = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TcpTimeout' {Maybe Duration
idle :: Maybe Duration
$sel:idle:TcpTimeout' :: TcpTimeout -> Maybe Duration
idle} -> Maybe Duration
idle) (\s :: TcpTimeout
s@TcpTimeout' {} Maybe Duration
a -> TcpTimeout
s {$sel:idle:TcpTimeout' :: Maybe Duration
idle = Maybe Duration
a} :: TcpTimeout)
instance Data.FromJSON TcpTimeout where
parseJSON :: Value -> Parser TcpTimeout
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"TcpTimeout"
(\Object
x -> Maybe Duration -> TcpTimeout
TcpTimeout' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"idle"))
instance Prelude.Hashable TcpTimeout where
hashWithSalt :: Int -> TcpTimeout -> Int
hashWithSalt Int
_salt TcpTimeout' {Maybe Duration
idle :: Maybe Duration
$sel:idle:TcpTimeout' :: TcpTimeout -> Maybe Duration
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Duration
idle
instance Prelude.NFData TcpTimeout where
rnf :: TcpTimeout -> ()
rnf TcpTimeout' {Maybe Duration
idle :: Maybe Duration
$sel:idle:TcpTimeout' :: TcpTimeout -> Maybe Duration
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Duration
idle
instance Data.ToJSON TcpTimeout where
toJSON :: TcpTimeout -> Value
toJSON TcpTimeout' {Maybe Duration
idle :: Maybe Duration
$sel:idle:TcpTimeout' :: TcpTimeout -> Maybe Duration
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Key
"idle" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Duration
idle]
)