{-# 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.HttpTimeout where
import Amazonka.AppMesh.Types.Duration
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data HttpTimeout = HttpTimeout'
{
HttpTimeout -> Maybe Duration
idle :: Prelude.Maybe Duration,
HttpTimeout -> Maybe Duration
perRequest :: Prelude.Maybe Duration
}
deriving (HttpTimeout -> HttpTimeout -> Bool
(HttpTimeout -> HttpTimeout -> Bool)
-> (HttpTimeout -> HttpTimeout -> Bool) -> Eq HttpTimeout
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HttpTimeout -> HttpTimeout -> Bool
$c/= :: HttpTimeout -> HttpTimeout -> Bool
== :: HttpTimeout -> HttpTimeout -> Bool
$c== :: HttpTimeout -> HttpTimeout -> Bool
Prelude.Eq, ReadPrec [HttpTimeout]
ReadPrec HttpTimeout
Int -> ReadS HttpTimeout
ReadS [HttpTimeout]
(Int -> ReadS HttpTimeout)
-> ReadS [HttpTimeout]
-> ReadPrec HttpTimeout
-> ReadPrec [HttpTimeout]
-> Read HttpTimeout
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HttpTimeout]
$creadListPrec :: ReadPrec [HttpTimeout]
readPrec :: ReadPrec HttpTimeout
$creadPrec :: ReadPrec HttpTimeout
readList :: ReadS [HttpTimeout]
$creadList :: ReadS [HttpTimeout]
readsPrec :: Int -> ReadS HttpTimeout
$creadsPrec :: Int -> ReadS HttpTimeout
Prelude.Read, Int -> HttpTimeout -> ShowS
[HttpTimeout] -> ShowS
HttpTimeout -> String
(Int -> HttpTimeout -> ShowS)
-> (HttpTimeout -> String)
-> ([HttpTimeout] -> ShowS)
-> Show HttpTimeout
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HttpTimeout] -> ShowS
$cshowList :: [HttpTimeout] -> ShowS
show :: HttpTimeout -> String
$cshow :: HttpTimeout -> String
showsPrec :: Int -> HttpTimeout -> ShowS
$cshowsPrec :: Int -> HttpTimeout -> ShowS
Prelude.Show, (forall x. HttpTimeout -> Rep HttpTimeout x)
-> (forall x. Rep HttpTimeout x -> HttpTimeout)
-> Generic HttpTimeout
forall x. Rep HttpTimeout x -> HttpTimeout
forall x. HttpTimeout -> Rep HttpTimeout x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HttpTimeout x -> HttpTimeout
$cfrom :: forall x. HttpTimeout -> Rep HttpTimeout x
Prelude.Generic)
newHttpTimeout ::
HttpTimeout
newHttpTimeout :: HttpTimeout
newHttpTimeout =
HttpTimeout' :: Maybe Duration -> Maybe Duration -> HttpTimeout
HttpTimeout'
{ $sel:idle:HttpTimeout' :: Maybe Duration
idle = Maybe Duration
forall a. Maybe a
Prelude.Nothing,
$sel:perRequest:HttpTimeout' :: Maybe Duration
perRequest = Maybe Duration
forall a. Maybe a
Prelude.Nothing
}
httpTimeout_idle :: Lens.Lens' HttpTimeout (Prelude.Maybe Duration)
httpTimeout_idle :: (Maybe Duration -> f (Maybe Duration))
-> HttpTimeout -> f HttpTimeout
httpTimeout_idle = (HttpTimeout -> Maybe Duration)
-> (HttpTimeout -> Maybe Duration -> HttpTimeout)
-> Lens HttpTimeout HttpTimeout (Maybe Duration) (Maybe Duration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpTimeout' {Maybe Duration
idle :: Maybe Duration
$sel:idle:HttpTimeout' :: HttpTimeout -> Maybe Duration
idle} -> Maybe Duration
idle) (\s :: HttpTimeout
s@HttpTimeout' {} Maybe Duration
a -> HttpTimeout
s {$sel:idle:HttpTimeout' :: Maybe Duration
idle = Maybe Duration
a} :: HttpTimeout)
httpTimeout_perRequest :: Lens.Lens' HttpTimeout (Prelude.Maybe Duration)
httpTimeout_perRequest :: (Maybe Duration -> f (Maybe Duration))
-> HttpTimeout -> f HttpTimeout
httpTimeout_perRequest = (HttpTimeout -> Maybe Duration)
-> (HttpTimeout -> Maybe Duration -> HttpTimeout)
-> Lens HttpTimeout HttpTimeout (Maybe Duration) (Maybe Duration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpTimeout' {Maybe Duration
perRequest :: Maybe Duration
$sel:perRequest:HttpTimeout' :: HttpTimeout -> Maybe Duration
perRequest} -> Maybe Duration
perRequest) (\s :: HttpTimeout
s@HttpTimeout' {} Maybe Duration
a -> HttpTimeout
s {$sel:perRequest:HttpTimeout' :: Maybe Duration
perRequest = Maybe Duration
a} :: HttpTimeout)
instance Core.FromJSON HttpTimeout where
parseJSON :: Value -> Parser HttpTimeout
parseJSON =
String
-> (Object -> Parser HttpTimeout) -> Value -> Parser HttpTimeout
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"HttpTimeout"
( \Object
x ->
Maybe Duration -> Maybe Duration -> HttpTimeout
HttpTimeout'
(Maybe Duration -> Maybe Duration -> HttpTimeout)
-> Parser (Maybe Duration)
-> Parser (Maybe Duration -> HttpTimeout)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Duration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"idle")
Parser (Maybe Duration -> HttpTimeout)
-> Parser (Maybe Duration) -> Parser HttpTimeout
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Duration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"perRequest")
)
instance Prelude.Hashable HttpTimeout
instance Prelude.NFData HttpTimeout
instance Core.ToJSON HttpTimeout where
toJSON :: HttpTimeout -> Value
toJSON HttpTimeout' {Maybe Duration
perRequest :: Maybe Duration
idle :: Maybe Duration
$sel:perRequest:HttpTimeout' :: HttpTimeout -> Maybe Duration
$sel:idle:HttpTimeout' :: HttpTimeout -> Maybe Duration
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"idle" Text -> Duration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Duration -> Pair) -> Maybe Duration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Duration
idle,
(Text
"perRequest" Text -> Duration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Duration -> Pair) -> Maybe Duration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Duration
perRequest
]
)