{-# 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.OutlierDetection 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 OutlierDetection = OutlierDetection'
{
OutlierDetection -> Duration
baseEjectionDuration :: Duration,
OutlierDetection -> Duration
interval :: Duration,
OutlierDetection -> Natural
maxEjectionPercent :: Prelude.Natural,
OutlierDetection -> Natural
maxServerErrors :: Prelude.Natural
}
deriving (OutlierDetection -> OutlierDetection -> Bool
(OutlierDetection -> OutlierDetection -> Bool)
-> (OutlierDetection -> OutlierDetection -> Bool)
-> Eq OutlierDetection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutlierDetection -> OutlierDetection -> Bool
$c/= :: OutlierDetection -> OutlierDetection -> Bool
== :: OutlierDetection -> OutlierDetection -> Bool
$c== :: OutlierDetection -> OutlierDetection -> Bool
Prelude.Eq, ReadPrec [OutlierDetection]
ReadPrec OutlierDetection
Int -> ReadS OutlierDetection
ReadS [OutlierDetection]
(Int -> ReadS OutlierDetection)
-> ReadS [OutlierDetection]
-> ReadPrec OutlierDetection
-> ReadPrec [OutlierDetection]
-> Read OutlierDetection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutlierDetection]
$creadListPrec :: ReadPrec [OutlierDetection]
readPrec :: ReadPrec OutlierDetection
$creadPrec :: ReadPrec OutlierDetection
readList :: ReadS [OutlierDetection]
$creadList :: ReadS [OutlierDetection]
readsPrec :: Int -> ReadS OutlierDetection
$creadsPrec :: Int -> ReadS OutlierDetection
Prelude.Read, Int -> OutlierDetection -> ShowS
[OutlierDetection] -> ShowS
OutlierDetection -> String
(Int -> OutlierDetection -> ShowS)
-> (OutlierDetection -> String)
-> ([OutlierDetection] -> ShowS)
-> Show OutlierDetection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutlierDetection] -> ShowS
$cshowList :: [OutlierDetection] -> ShowS
show :: OutlierDetection -> String
$cshow :: OutlierDetection -> String
showsPrec :: Int -> OutlierDetection -> ShowS
$cshowsPrec :: Int -> OutlierDetection -> ShowS
Prelude.Show, (forall x. OutlierDetection -> Rep OutlierDetection x)
-> (forall x. Rep OutlierDetection x -> OutlierDetection)
-> Generic OutlierDetection
forall x. Rep OutlierDetection x -> OutlierDetection
forall x. OutlierDetection -> Rep OutlierDetection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutlierDetection x -> OutlierDetection
$cfrom :: forall x. OutlierDetection -> Rep OutlierDetection x
Prelude.Generic)
newOutlierDetection ::
Duration ->
Duration ->
Prelude.Natural ->
Prelude.Natural ->
OutlierDetection
newOutlierDetection :: Duration -> Duration -> Natural -> Natural -> OutlierDetection
newOutlierDetection
Duration
pBaseEjectionDuration_
Duration
pInterval_
Natural
pMaxEjectionPercent_
Natural
pMaxServerErrors_ =
OutlierDetection' :: Duration -> Duration -> Natural -> Natural -> OutlierDetection
OutlierDetection'
{ $sel:baseEjectionDuration:OutlierDetection' :: Duration
baseEjectionDuration =
Duration
pBaseEjectionDuration_,
$sel:interval:OutlierDetection' :: Duration
interval = Duration
pInterval_,
$sel:maxEjectionPercent:OutlierDetection' :: Natural
maxEjectionPercent = Natural
pMaxEjectionPercent_,
$sel:maxServerErrors:OutlierDetection' :: Natural
maxServerErrors = Natural
pMaxServerErrors_
}
outlierDetection_baseEjectionDuration :: Lens.Lens' OutlierDetection Duration
outlierDetection_baseEjectionDuration :: (Duration -> f Duration) -> OutlierDetection -> f OutlierDetection
outlierDetection_baseEjectionDuration = (OutlierDetection -> Duration)
-> (OutlierDetection -> Duration -> OutlierDetection)
-> Lens OutlierDetection OutlierDetection Duration Duration
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutlierDetection' {Duration
baseEjectionDuration :: Duration
$sel:baseEjectionDuration:OutlierDetection' :: OutlierDetection -> Duration
baseEjectionDuration} -> Duration
baseEjectionDuration) (\s :: OutlierDetection
s@OutlierDetection' {} Duration
a -> OutlierDetection
s {$sel:baseEjectionDuration:OutlierDetection' :: Duration
baseEjectionDuration = Duration
a} :: OutlierDetection)
outlierDetection_interval :: Lens.Lens' OutlierDetection Duration
outlierDetection_interval :: (Duration -> f Duration) -> OutlierDetection -> f OutlierDetection
outlierDetection_interval = (OutlierDetection -> Duration)
-> (OutlierDetection -> Duration -> OutlierDetection)
-> Lens OutlierDetection OutlierDetection Duration Duration
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutlierDetection' {Duration
interval :: Duration
$sel:interval:OutlierDetection' :: OutlierDetection -> Duration
interval} -> Duration
interval) (\s :: OutlierDetection
s@OutlierDetection' {} Duration
a -> OutlierDetection
s {$sel:interval:OutlierDetection' :: Duration
interval = Duration
a} :: OutlierDetection)
outlierDetection_maxEjectionPercent :: Lens.Lens' OutlierDetection Prelude.Natural
outlierDetection_maxEjectionPercent :: (Natural -> f Natural) -> OutlierDetection -> f OutlierDetection
outlierDetection_maxEjectionPercent = (OutlierDetection -> Natural)
-> (OutlierDetection -> Natural -> OutlierDetection)
-> Lens OutlierDetection OutlierDetection Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutlierDetection' {Natural
maxEjectionPercent :: Natural
$sel:maxEjectionPercent:OutlierDetection' :: OutlierDetection -> Natural
maxEjectionPercent} -> Natural
maxEjectionPercent) (\s :: OutlierDetection
s@OutlierDetection' {} Natural
a -> OutlierDetection
s {$sel:maxEjectionPercent:OutlierDetection' :: Natural
maxEjectionPercent = Natural
a} :: OutlierDetection)
outlierDetection_maxServerErrors :: Lens.Lens' OutlierDetection Prelude.Natural
outlierDetection_maxServerErrors :: (Natural -> f Natural) -> OutlierDetection -> f OutlierDetection
outlierDetection_maxServerErrors = (OutlierDetection -> Natural)
-> (OutlierDetection -> Natural -> OutlierDetection)
-> Lens OutlierDetection OutlierDetection Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutlierDetection' {Natural
maxServerErrors :: Natural
$sel:maxServerErrors:OutlierDetection' :: OutlierDetection -> Natural
maxServerErrors} -> Natural
maxServerErrors) (\s :: OutlierDetection
s@OutlierDetection' {} Natural
a -> OutlierDetection
s {$sel:maxServerErrors:OutlierDetection' :: Natural
maxServerErrors = Natural
a} :: OutlierDetection)
instance Core.FromJSON OutlierDetection where
parseJSON :: Value -> Parser OutlierDetection
parseJSON =
String
-> (Object -> Parser OutlierDetection)
-> Value
-> Parser OutlierDetection
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"OutlierDetection"
( \Object
x ->
Duration -> Duration -> Natural -> Natural -> OutlierDetection
OutlierDetection'
(Duration -> Duration -> Natural -> Natural -> OutlierDetection)
-> Parser Duration
-> Parser (Duration -> Natural -> Natural -> OutlierDetection)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Duration
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"baseEjectionDuration")
Parser (Duration -> Natural -> Natural -> OutlierDetection)
-> Parser Duration
-> Parser (Natural -> Natural -> OutlierDetection)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Duration
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"interval")
Parser (Natural -> Natural -> OutlierDetection)
-> Parser Natural -> Parser (Natural -> OutlierDetection)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"maxEjectionPercent")
Parser (Natural -> OutlierDetection)
-> Parser Natural -> Parser OutlierDetection
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"maxServerErrors")
)
instance Prelude.Hashable OutlierDetection
instance Prelude.NFData OutlierDetection
instance Core.ToJSON OutlierDetection where
toJSON :: OutlierDetection -> Value
toJSON OutlierDetection' {Natural
Duration
maxServerErrors :: Natural
maxEjectionPercent :: Natural
interval :: Duration
baseEjectionDuration :: Duration
$sel:maxServerErrors:OutlierDetection' :: OutlierDetection -> Natural
$sel:maxEjectionPercent:OutlierDetection' :: OutlierDetection -> Natural
$sel:interval:OutlierDetection' :: OutlierDetection -> Duration
$sel:baseEjectionDuration:OutlierDetection' :: OutlierDetection -> Duration
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"baseEjectionDuration"
Text -> Duration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Duration
baseEjectionDuration
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"interval" Text -> Duration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Duration
interval),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"maxEjectionPercent" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
maxEjectionPercent),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"maxServerErrors" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
maxServerErrors)
]
)