{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $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 :: Lens' OutlierDetection Duration
outlierDetection_baseEjectionDuration = 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 :: Lens' OutlierDetection Duration
outlierDetection_interval = 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 :: Lens' OutlierDetection Natural
outlierDetection_maxEjectionPercent = 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 :: Lens' OutlierDetection Natural
outlierDetection_maxServerErrors = 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 Data.FromJSON OutlierDetection where
parseJSON :: Value -> Parser OutlierDetection
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"OutlierDetection"
( \Object
x ->
Duration -> Duration -> Natural -> Natural -> OutlierDetection
OutlierDetection'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"baseEjectionDuration")
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
"interval")
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
"maxEjectionPercent")
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
"maxServerErrors")
)
instance Prelude.Hashable OutlierDetection where
hashWithSalt :: Int -> OutlierDetection -> Int
hashWithSalt Int
_salt 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
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Duration
baseEjectionDuration
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Duration
interval
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
maxEjectionPercent
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
maxServerErrors
instance Prelude.NFData OutlierDetection where
rnf :: OutlierDetection -> ()
rnf 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
..} =
forall a. NFData a => a -> ()
Prelude.rnf Duration
baseEjectionDuration
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Duration
interval
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
maxEjectionPercent
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
maxServerErrors
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
( Key
"baseEjectionDuration"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Duration
baseEjectionDuration
),
forall a. a -> Maybe a
Prelude.Just (Key
"interval" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Duration
interval),
forall a. a -> Maybe a
Prelude.Just
(Key
"maxEjectionPercent" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
maxEjectionPercent),
forall a. a -> Maybe a
Prelude.Just
(Key
"maxServerErrors" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
maxServerErrors)
]
)