{-# 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.HttpRetryPolicy where
import Amazonka.AppMesh.Types.Duration
import Amazonka.AppMesh.Types.TcpRetryPolicyEvent
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 HttpRetryPolicy = HttpRetryPolicy'
{
HttpRetryPolicy -> Maybe (NonEmpty Text)
httpRetryEvents :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
HttpRetryPolicy -> Maybe (NonEmpty TcpRetryPolicyEvent)
tcpRetryEvents :: Prelude.Maybe (Prelude.NonEmpty TcpRetryPolicyEvent),
HttpRetryPolicy -> Natural
maxRetries :: Prelude.Natural,
HttpRetryPolicy -> Duration
perRetryTimeout :: Duration
}
deriving (HttpRetryPolicy -> HttpRetryPolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HttpRetryPolicy -> HttpRetryPolicy -> Bool
$c/= :: HttpRetryPolicy -> HttpRetryPolicy -> Bool
== :: HttpRetryPolicy -> HttpRetryPolicy -> Bool
$c== :: HttpRetryPolicy -> HttpRetryPolicy -> Bool
Prelude.Eq, ReadPrec [HttpRetryPolicy]
ReadPrec HttpRetryPolicy
Int -> ReadS HttpRetryPolicy
ReadS [HttpRetryPolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HttpRetryPolicy]
$creadListPrec :: ReadPrec [HttpRetryPolicy]
readPrec :: ReadPrec HttpRetryPolicy
$creadPrec :: ReadPrec HttpRetryPolicy
readList :: ReadS [HttpRetryPolicy]
$creadList :: ReadS [HttpRetryPolicy]
readsPrec :: Int -> ReadS HttpRetryPolicy
$creadsPrec :: Int -> ReadS HttpRetryPolicy
Prelude.Read, Int -> HttpRetryPolicy -> ShowS
[HttpRetryPolicy] -> ShowS
HttpRetryPolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HttpRetryPolicy] -> ShowS
$cshowList :: [HttpRetryPolicy] -> ShowS
show :: HttpRetryPolicy -> String
$cshow :: HttpRetryPolicy -> String
showsPrec :: Int -> HttpRetryPolicy -> ShowS
$cshowsPrec :: Int -> HttpRetryPolicy -> ShowS
Prelude.Show, forall x. Rep HttpRetryPolicy x -> HttpRetryPolicy
forall x. HttpRetryPolicy -> Rep HttpRetryPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HttpRetryPolicy x -> HttpRetryPolicy
$cfrom :: forall x. HttpRetryPolicy -> Rep HttpRetryPolicy x
Prelude.Generic)
newHttpRetryPolicy ::
Prelude.Natural ->
Duration ->
HttpRetryPolicy
newHttpRetryPolicy :: Natural -> Duration -> HttpRetryPolicy
newHttpRetryPolicy Natural
pMaxRetries_ Duration
pPerRetryTimeout_ =
HttpRetryPolicy'
{ $sel:httpRetryEvents:HttpRetryPolicy' :: Maybe (NonEmpty Text)
httpRetryEvents = forall a. Maybe a
Prelude.Nothing,
$sel:tcpRetryEvents:HttpRetryPolicy' :: Maybe (NonEmpty TcpRetryPolicyEvent)
tcpRetryEvents = forall a. Maybe a
Prelude.Nothing,
$sel:maxRetries:HttpRetryPolicy' :: Natural
maxRetries = Natural
pMaxRetries_,
$sel:perRetryTimeout:HttpRetryPolicy' :: Duration
perRetryTimeout = Duration
pPerRetryTimeout_
}
httpRetryPolicy_httpRetryEvents :: Lens.Lens' HttpRetryPolicy (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
httpRetryPolicy_httpRetryEvents :: Lens' HttpRetryPolicy (Maybe (NonEmpty Text))
httpRetryPolicy_httpRetryEvents = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpRetryPolicy' {Maybe (NonEmpty Text)
httpRetryEvents :: Maybe (NonEmpty Text)
$sel:httpRetryEvents:HttpRetryPolicy' :: HttpRetryPolicy -> Maybe (NonEmpty Text)
httpRetryEvents} -> Maybe (NonEmpty Text)
httpRetryEvents) (\s :: HttpRetryPolicy
s@HttpRetryPolicy' {} Maybe (NonEmpty Text)
a -> HttpRetryPolicy
s {$sel:httpRetryEvents:HttpRetryPolicy' :: Maybe (NonEmpty Text)
httpRetryEvents = Maybe (NonEmpty Text)
a} :: HttpRetryPolicy) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
httpRetryPolicy_tcpRetryEvents :: Lens.Lens' HttpRetryPolicy (Prelude.Maybe (Prelude.NonEmpty TcpRetryPolicyEvent))
httpRetryPolicy_tcpRetryEvents :: Lens' HttpRetryPolicy (Maybe (NonEmpty TcpRetryPolicyEvent))
httpRetryPolicy_tcpRetryEvents = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpRetryPolicy' {Maybe (NonEmpty TcpRetryPolicyEvent)
tcpRetryEvents :: Maybe (NonEmpty TcpRetryPolicyEvent)
$sel:tcpRetryEvents:HttpRetryPolicy' :: HttpRetryPolicy -> Maybe (NonEmpty TcpRetryPolicyEvent)
tcpRetryEvents} -> Maybe (NonEmpty TcpRetryPolicyEvent)
tcpRetryEvents) (\s :: HttpRetryPolicy
s@HttpRetryPolicy' {} Maybe (NonEmpty TcpRetryPolicyEvent)
a -> HttpRetryPolicy
s {$sel:tcpRetryEvents:HttpRetryPolicy' :: Maybe (NonEmpty TcpRetryPolicyEvent)
tcpRetryEvents = Maybe (NonEmpty TcpRetryPolicyEvent)
a} :: HttpRetryPolicy) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
httpRetryPolicy_maxRetries :: Lens.Lens' HttpRetryPolicy Prelude.Natural
httpRetryPolicy_maxRetries :: Lens' HttpRetryPolicy Natural
httpRetryPolicy_maxRetries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpRetryPolicy' {Natural
maxRetries :: Natural
$sel:maxRetries:HttpRetryPolicy' :: HttpRetryPolicy -> Natural
maxRetries} -> Natural
maxRetries) (\s :: HttpRetryPolicy
s@HttpRetryPolicy' {} Natural
a -> HttpRetryPolicy
s {$sel:maxRetries:HttpRetryPolicy' :: Natural
maxRetries = Natural
a} :: HttpRetryPolicy)
httpRetryPolicy_perRetryTimeout :: Lens.Lens' HttpRetryPolicy Duration
httpRetryPolicy_perRetryTimeout :: Lens' HttpRetryPolicy Duration
httpRetryPolicy_perRetryTimeout = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpRetryPolicy' {Duration
perRetryTimeout :: Duration
$sel:perRetryTimeout:HttpRetryPolicy' :: HttpRetryPolicy -> Duration
perRetryTimeout} -> Duration
perRetryTimeout) (\s :: HttpRetryPolicy
s@HttpRetryPolicy' {} Duration
a -> HttpRetryPolicy
s {$sel:perRetryTimeout:HttpRetryPolicy' :: Duration
perRetryTimeout = Duration
a} :: HttpRetryPolicy)
instance Data.FromJSON HttpRetryPolicy where
parseJSON :: Value -> Parser HttpRetryPolicy
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"HttpRetryPolicy"
( \Object
x ->
Maybe (NonEmpty Text)
-> Maybe (NonEmpty TcpRetryPolicyEvent)
-> Natural
-> Duration
-> HttpRetryPolicy
HttpRetryPolicy'
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
"httpRetryEvents")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"tcpRetryEvents")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"maxRetries")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"perRetryTimeout")
)
instance Prelude.Hashable HttpRetryPolicy where
hashWithSalt :: Int -> HttpRetryPolicy -> Int
hashWithSalt Int
_salt HttpRetryPolicy' {Natural
Maybe (NonEmpty Text)
Maybe (NonEmpty TcpRetryPolicyEvent)
Duration
perRetryTimeout :: Duration
maxRetries :: Natural
tcpRetryEvents :: Maybe (NonEmpty TcpRetryPolicyEvent)
httpRetryEvents :: Maybe (NonEmpty Text)
$sel:perRetryTimeout:HttpRetryPolicy' :: HttpRetryPolicy -> Duration
$sel:maxRetries:HttpRetryPolicy' :: HttpRetryPolicy -> Natural
$sel:tcpRetryEvents:HttpRetryPolicy' :: HttpRetryPolicy -> Maybe (NonEmpty TcpRetryPolicyEvent)
$sel:httpRetryEvents:HttpRetryPolicy' :: HttpRetryPolicy -> Maybe (NonEmpty Text)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
httpRetryEvents
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty TcpRetryPolicyEvent)
tcpRetryEvents
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
maxRetries
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Duration
perRetryTimeout
instance Prelude.NFData HttpRetryPolicy where
rnf :: HttpRetryPolicy -> ()
rnf HttpRetryPolicy' {Natural
Maybe (NonEmpty Text)
Maybe (NonEmpty TcpRetryPolicyEvent)
Duration
perRetryTimeout :: Duration
maxRetries :: Natural
tcpRetryEvents :: Maybe (NonEmpty TcpRetryPolicyEvent)
httpRetryEvents :: Maybe (NonEmpty Text)
$sel:perRetryTimeout:HttpRetryPolicy' :: HttpRetryPolicy -> Duration
$sel:maxRetries:HttpRetryPolicy' :: HttpRetryPolicy -> Natural
$sel:tcpRetryEvents:HttpRetryPolicy' :: HttpRetryPolicy -> Maybe (NonEmpty TcpRetryPolicyEvent)
$sel:httpRetryEvents:HttpRetryPolicy' :: HttpRetryPolicy -> Maybe (NonEmpty Text)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
httpRetryEvents
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty TcpRetryPolicyEvent)
tcpRetryEvents
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
maxRetries
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Duration
perRetryTimeout
instance Data.ToJSON HttpRetryPolicy where
toJSON :: HttpRetryPolicy -> Value
toJSON HttpRetryPolicy' {Natural
Maybe (NonEmpty Text)
Maybe (NonEmpty TcpRetryPolicyEvent)
Duration
perRetryTimeout :: Duration
maxRetries :: Natural
tcpRetryEvents :: Maybe (NonEmpty TcpRetryPolicyEvent)
httpRetryEvents :: Maybe (NonEmpty Text)
$sel:perRetryTimeout:HttpRetryPolicy' :: HttpRetryPolicy -> Duration
$sel:maxRetries:HttpRetryPolicy' :: HttpRetryPolicy -> Natural
$sel:tcpRetryEvents:HttpRetryPolicy' :: HttpRetryPolicy -> Maybe (NonEmpty TcpRetryPolicyEvent)
$sel:httpRetryEvents:HttpRetryPolicy' :: HttpRetryPolicy -> Maybe (NonEmpty Text)
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"httpRetryEvents" 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 (NonEmpty Text)
httpRetryEvents,
(Key
"tcpRetryEvents" 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 (NonEmpty TcpRetryPolicyEvent)
tcpRetryEvents,
forall a. a -> Maybe a
Prelude.Just (Key
"maxRetries" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
maxRetries),
forall a. a -> Maybe a
Prelude.Just
(Key
"perRetryTimeout" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Duration
perRetryTimeout)
]
)