{-# 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.GrpcTimeout 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 GrpcTimeout = GrpcTimeout'
{
GrpcTimeout -> Maybe Duration
idle :: Prelude.Maybe Duration,
GrpcTimeout -> Maybe Duration
perRequest :: Prelude.Maybe Duration
}
deriving (GrpcTimeout -> GrpcTimeout -> Bool
(GrpcTimeout -> GrpcTimeout -> Bool)
-> (GrpcTimeout -> GrpcTimeout -> Bool) -> Eq GrpcTimeout
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GrpcTimeout -> GrpcTimeout -> Bool
$c/= :: GrpcTimeout -> GrpcTimeout -> Bool
== :: GrpcTimeout -> GrpcTimeout -> Bool
$c== :: GrpcTimeout -> GrpcTimeout -> Bool
Prelude.Eq, ReadPrec [GrpcTimeout]
ReadPrec GrpcTimeout
Int -> ReadS GrpcTimeout
ReadS [GrpcTimeout]
(Int -> ReadS GrpcTimeout)
-> ReadS [GrpcTimeout]
-> ReadPrec GrpcTimeout
-> ReadPrec [GrpcTimeout]
-> Read GrpcTimeout
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GrpcTimeout]
$creadListPrec :: ReadPrec [GrpcTimeout]
readPrec :: ReadPrec GrpcTimeout
$creadPrec :: ReadPrec GrpcTimeout
readList :: ReadS [GrpcTimeout]
$creadList :: ReadS [GrpcTimeout]
readsPrec :: Int -> ReadS GrpcTimeout
$creadsPrec :: Int -> ReadS GrpcTimeout
Prelude.Read, Int -> GrpcTimeout -> ShowS
[GrpcTimeout] -> ShowS
GrpcTimeout -> String
(Int -> GrpcTimeout -> ShowS)
-> (GrpcTimeout -> String)
-> ([GrpcTimeout] -> ShowS)
-> Show GrpcTimeout
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GrpcTimeout] -> ShowS
$cshowList :: [GrpcTimeout] -> ShowS
show :: GrpcTimeout -> String
$cshow :: GrpcTimeout -> String
showsPrec :: Int -> GrpcTimeout -> ShowS
$cshowsPrec :: Int -> GrpcTimeout -> ShowS
Prelude.Show, (forall x. GrpcTimeout -> Rep GrpcTimeout x)
-> (forall x. Rep GrpcTimeout x -> GrpcTimeout)
-> Generic GrpcTimeout
forall x. Rep GrpcTimeout x -> GrpcTimeout
forall x. GrpcTimeout -> Rep GrpcTimeout x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GrpcTimeout x -> GrpcTimeout
$cfrom :: forall x. GrpcTimeout -> Rep GrpcTimeout x
Prelude.Generic)
newGrpcTimeout ::
GrpcTimeout
newGrpcTimeout :: GrpcTimeout
newGrpcTimeout =
GrpcTimeout' :: Maybe Duration -> Maybe Duration -> GrpcTimeout
GrpcTimeout'
{ $sel:idle:GrpcTimeout' :: Maybe Duration
idle = Maybe Duration
forall a. Maybe a
Prelude.Nothing,
$sel:perRequest:GrpcTimeout' :: Maybe Duration
perRequest = Maybe Duration
forall a. Maybe a
Prelude.Nothing
}
grpcTimeout_idle :: Lens.Lens' GrpcTimeout (Prelude.Maybe Duration)
grpcTimeout_idle :: (Maybe Duration -> f (Maybe Duration))
-> GrpcTimeout -> f GrpcTimeout
grpcTimeout_idle = (GrpcTimeout -> Maybe Duration)
-> (GrpcTimeout -> Maybe Duration -> GrpcTimeout)
-> Lens GrpcTimeout GrpcTimeout (Maybe Duration) (Maybe Duration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrpcTimeout' {Maybe Duration
idle :: Maybe Duration
$sel:idle:GrpcTimeout' :: GrpcTimeout -> Maybe Duration
idle} -> Maybe Duration
idle) (\s :: GrpcTimeout
s@GrpcTimeout' {} Maybe Duration
a -> GrpcTimeout
s {$sel:idle:GrpcTimeout' :: Maybe Duration
idle = Maybe Duration
a} :: GrpcTimeout)
grpcTimeout_perRequest :: Lens.Lens' GrpcTimeout (Prelude.Maybe Duration)
grpcTimeout_perRequest :: (Maybe Duration -> f (Maybe Duration))
-> GrpcTimeout -> f GrpcTimeout
grpcTimeout_perRequest = (GrpcTimeout -> Maybe Duration)
-> (GrpcTimeout -> Maybe Duration -> GrpcTimeout)
-> Lens GrpcTimeout GrpcTimeout (Maybe Duration) (Maybe Duration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrpcTimeout' {Maybe Duration
perRequest :: Maybe Duration
$sel:perRequest:GrpcTimeout' :: GrpcTimeout -> Maybe Duration
perRequest} -> Maybe Duration
perRequest) (\s :: GrpcTimeout
s@GrpcTimeout' {} Maybe Duration
a -> GrpcTimeout
s {$sel:perRequest:GrpcTimeout' :: Maybe Duration
perRequest = Maybe Duration
a} :: GrpcTimeout)
instance Core.FromJSON GrpcTimeout where
parseJSON :: Value -> Parser GrpcTimeout
parseJSON =
String
-> (Object -> Parser GrpcTimeout) -> Value -> Parser GrpcTimeout
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"GrpcTimeout"
( \Object
x ->
Maybe Duration -> Maybe Duration -> GrpcTimeout
GrpcTimeout'
(Maybe Duration -> Maybe Duration -> GrpcTimeout)
-> Parser (Maybe Duration)
-> Parser (Maybe Duration -> GrpcTimeout)
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 -> GrpcTimeout)
-> Parser (Maybe Duration) -> Parser GrpcTimeout
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 GrpcTimeout
instance Prelude.NFData GrpcTimeout
instance Core.ToJSON GrpcTimeout where
toJSON :: GrpcTimeout -> Value
toJSON GrpcTimeout' {Maybe Duration
perRequest :: Maybe Duration
idle :: Maybe Duration
$sel:perRequest:GrpcTimeout' :: GrpcTimeout -> Maybe Duration
$sel:idle:GrpcTimeout' :: GrpcTimeout -> 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
]
)