{-# 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.HealthCheckPolicy where
import Amazonka.AppMesh.Types.PortProtocol
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data HealthCheckPolicy = HealthCheckPolicy'
{
HealthCheckPolicy -> Maybe Text
path :: Prelude.Maybe Prelude.Text,
HealthCheckPolicy -> Maybe Natural
port :: Prelude.Maybe Prelude.Natural,
HealthCheckPolicy -> Natural
healthyThreshold :: Prelude.Natural,
HealthCheckPolicy -> Natural
intervalMillis :: Prelude.Natural,
HealthCheckPolicy -> PortProtocol
protocol :: PortProtocol,
HealthCheckPolicy -> Natural
timeoutMillis :: Prelude.Natural,
HealthCheckPolicy -> Natural
unhealthyThreshold :: Prelude.Natural
}
deriving (HealthCheckPolicy -> HealthCheckPolicy -> Bool
(HealthCheckPolicy -> HealthCheckPolicy -> Bool)
-> (HealthCheckPolicy -> HealthCheckPolicy -> Bool)
-> Eq HealthCheckPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HealthCheckPolicy -> HealthCheckPolicy -> Bool
$c/= :: HealthCheckPolicy -> HealthCheckPolicy -> Bool
== :: HealthCheckPolicy -> HealthCheckPolicy -> Bool
$c== :: HealthCheckPolicy -> HealthCheckPolicy -> Bool
Prelude.Eq, ReadPrec [HealthCheckPolicy]
ReadPrec HealthCheckPolicy
Int -> ReadS HealthCheckPolicy
ReadS [HealthCheckPolicy]
(Int -> ReadS HealthCheckPolicy)
-> ReadS [HealthCheckPolicy]
-> ReadPrec HealthCheckPolicy
-> ReadPrec [HealthCheckPolicy]
-> Read HealthCheckPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HealthCheckPolicy]
$creadListPrec :: ReadPrec [HealthCheckPolicy]
readPrec :: ReadPrec HealthCheckPolicy
$creadPrec :: ReadPrec HealthCheckPolicy
readList :: ReadS [HealthCheckPolicy]
$creadList :: ReadS [HealthCheckPolicy]
readsPrec :: Int -> ReadS HealthCheckPolicy
$creadsPrec :: Int -> ReadS HealthCheckPolicy
Prelude.Read, Int -> HealthCheckPolicy -> ShowS
[HealthCheckPolicy] -> ShowS
HealthCheckPolicy -> String
(Int -> HealthCheckPolicy -> ShowS)
-> (HealthCheckPolicy -> String)
-> ([HealthCheckPolicy] -> ShowS)
-> Show HealthCheckPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HealthCheckPolicy] -> ShowS
$cshowList :: [HealthCheckPolicy] -> ShowS
show :: HealthCheckPolicy -> String
$cshow :: HealthCheckPolicy -> String
showsPrec :: Int -> HealthCheckPolicy -> ShowS
$cshowsPrec :: Int -> HealthCheckPolicy -> ShowS
Prelude.Show, (forall x. HealthCheckPolicy -> Rep HealthCheckPolicy x)
-> (forall x. Rep HealthCheckPolicy x -> HealthCheckPolicy)
-> Generic HealthCheckPolicy
forall x. Rep HealthCheckPolicy x -> HealthCheckPolicy
forall x. HealthCheckPolicy -> Rep HealthCheckPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HealthCheckPolicy x -> HealthCheckPolicy
$cfrom :: forall x. HealthCheckPolicy -> Rep HealthCheckPolicy x
Prelude.Generic)
newHealthCheckPolicy ::
Prelude.Natural ->
Prelude.Natural ->
PortProtocol ->
Prelude.Natural ->
Prelude.Natural ->
HealthCheckPolicy
newHealthCheckPolicy :: Natural
-> Natural
-> PortProtocol
-> Natural
-> Natural
-> HealthCheckPolicy
newHealthCheckPolicy
Natural
pHealthyThreshold_
Natural
pIntervalMillis_
PortProtocol
pProtocol_
Natural
pTimeoutMillis_
Natural
pUnhealthyThreshold_ =
HealthCheckPolicy' :: Maybe Text
-> Maybe Natural
-> Natural
-> Natural
-> PortProtocol
-> Natural
-> Natural
-> HealthCheckPolicy
HealthCheckPolicy'
{ $sel:path:HealthCheckPolicy' :: Maybe Text
path = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:port:HealthCheckPolicy' :: Maybe Natural
port = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:healthyThreshold:HealthCheckPolicy' :: Natural
healthyThreshold = Natural
pHealthyThreshold_,
$sel:intervalMillis:HealthCheckPolicy' :: Natural
intervalMillis = Natural
pIntervalMillis_,
$sel:protocol:HealthCheckPolicy' :: PortProtocol
protocol = PortProtocol
pProtocol_,
$sel:timeoutMillis:HealthCheckPolicy' :: Natural
timeoutMillis = Natural
pTimeoutMillis_,
$sel:unhealthyThreshold:HealthCheckPolicy' :: Natural
unhealthyThreshold = Natural
pUnhealthyThreshold_
}
healthCheckPolicy_path :: Lens.Lens' HealthCheckPolicy (Prelude.Maybe Prelude.Text)
healthCheckPolicy_path :: (Maybe Text -> f (Maybe Text))
-> HealthCheckPolicy -> f HealthCheckPolicy
healthCheckPolicy_path = (HealthCheckPolicy -> Maybe Text)
-> (HealthCheckPolicy -> Maybe Text -> HealthCheckPolicy)
-> Lens
HealthCheckPolicy HealthCheckPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HealthCheckPolicy' {Maybe Text
path :: Maybe Text
$sel:path:HealthCheckPolicy' :: HealthCheckPolicy -> Maybe Text
path} -> Maybe Text
path) (\s :: HealthCheckPolicy
s@HealthCheckPolicy' {} Maybe Text
a -> HealthCheckPolicy
s {$sel:path:HealthCheckPolicy' :: Maybe Text
path = Maybe Text
a} :: HealthCheckPolicy)
healthCheckPolicy_port :: Lens.Lens' HealthCheckPolicy (Prelude.Maybe Prelude.Natural)
healthCheckPolicy_port :: (Maybe Natural -> f (Maybe Natural))
-> HealthCheckPolicy -> f HealthCheckPolicy
healthCheckPolicy_port = (HealthCheckPolicy -> Maybe Natural)
-> (HealthCheckPolicy -> Maybe Natural -> HealthCheckPolicy)
-> Lens
HealthCheckPolicy HealthCheckPolicy (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HealthCheckPolicy' {Maybe Natural
port :: Maybe Natural
$sel:port:HealthCheckPolicy' :: HealthCheckPolicy -> Maybe Natural
port} -> Maybe Natural
port) (\s :: HealthCheckPolicy
s@HealthCheckPolicy' {} Maybe Natural
a -> HealthCheckPolicy
s {$sel:port:HealthCheckPolicy' :: Maybe Natural
port = Maybe Natural
a} :: HealthCheckPolicy)
healthCheckPolicy_healthyThreshold :: Lens.Lens' HealthCheckPolicy Prelude.Natural
healthCheckPolicy_healthyThreshold :: (Natural -> f Natural) -> HealthCheckPolicy -> f HealthCheckPolicy
healthCheckPolicy_healthyThreshold = (HealthCheckPolicy -> Natural)
-> (HealthCheckPolicy -> Natural -> HealthCheckPolicy)
-> Lens HealthCheckPolicy HealthCheckPolicy Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HealthCheckPolicy' {Natural
healthyThreshold :: Natural
$sel:healthyThreshold:HealthCheckPolicy' :: HealthCheckPolicy -> Natural
healthyThreshold} -> Natural
healthyThreshold) (\s :: HealthCheckPolicy
s@HealthCheckPolicy' {} Natural
a -> HealthCheckPolicy
s {$sel:healthyThreshold:HealthCheckPolicy' :: Natural
healthyThreshold = Natural
a} :: HealthCheckPolicy)
healthCheckPolicy_intervalMillis :: Lens.Lens' HealthCheckPolicy Prelude.Natural
healthCheckPolicy_intervalMillis :: (Natural -> f Natural) -> HealthCheckPolicy -> f HealthCheckPolicy
healthCheckPolicy_intervalMillis = (HealthCheckPolicy -> Natural)
-> (HealthCheckPolicy -> Natural -> HealthCheckPolicy)
-> Lens HealthCheckPolicy HealthCheckPolicy Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HealthCheckPolicy' {Natural
intervalMillis :: Natural
$sel:intervalMillis:HealthCheckPolicy' :: HealthCheckPolicy -> Natural
intervalMillis} -> Natural
intervalMillis) (\s :: HealthCheckPolicy
s@HealthCheckPolicy' {} Natural
a -> HealthCheckPolicy
s {$sel:intervalMillis:HealthCheckPolicy' :: Natural
intervalMillis = Natural
a} :: HealthCheckPolicy)
healthCheckPolicy_protocol :: Lens.Lens' HealthCheckPolicy PortProtocol
healthCheckPolicy_protocol :: (PortProtocol -> f PortProtocol)
-> HealthCheckPolicy -> f HealthCheckPolicy
healthCheckPolicy_protocol = (HealthCheckPolicy -> PortProtocol)
-> (HealthCheckPolicy -> PortProtocol -> HealthCheckPolicy)
-> Lens
HealthCheckPolicy HealthCheckPolicy PortProtocol PortProtocol
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HealthCheckPolicy' {PortProtocol
protocol :: PortProtocol
$sel:protocol:HealthCheckPolicy' :: HealthCheckPolicy -> PortProtocol
protocol} -> PortProtocol
protocol) (\s :: HealthCheckPolicy
s@HealthCheckPolicy' {} PortProtocol
a -> HealthCheckPolicy
s {$sel:protocol:HealthCheckPolicy' :: PortProtocol
protocol = PortProtocol
a} :: HealthCheckPolicy)
healthCheckPolicy_timeoutMillis :: Lens.Lens' HealthCheckPolicy Prelude.Natural
healthCheckPolicy_timeoutMillis :: (Natural -> f Natural) -> HealthCheckPolicy -> f HealthCheckPolicy
healthCheckPolicy_timeoutMillis = (HealthCheckPolicy -> Natural)
-> (HealthCheckPolicy -> Natural -> HealthCheckPolicy)
-> Lens HealthCheckPolicy HealthCheckPolicy Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HealthCheckPolicy' {Natural
timeoutMillis :: Natural
$sel:timeoutMillis:HealthCheckPolicy' :: HealthCheckPolicy -> Natural
timeoutMillis} -> Natural
timeoutMillis) (\s :: HealthCheckPolicy
s@HealthCheckPolicy' {} Natural
a -> HealthCheckPolicy
s {$sel:timeoutMillis:HealthCheckPolicy' :: Natural
timeoutMillis = Natural
a} :: HealthCheckPolicy)
healthCheckPolicy_unhealthyThreshold :: Lens.Lens' HealthCheckPolicy Prelude.Natural
healthCheckPolicy_unhealthyThreshold :: (Natural -> f Natural) -> HealthCheckPolicy -> f HealthCheckPolicy
healthCheckPolicy_unhealthyThreshold = (HealthCheckPolicy -> Natural)
-> (HealthCheckPolicy -> Natural -> HealthCheckPolicy)
-> Lens HealthCheckPolicy HealthCheckPolicy Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HealthCheckPolicy' {Natural
unhealthyThreshold :: Natural
$sel:unhealthyThreshold:HealthCheckPolicy' :: HealthCheckPolicy -> Natural
unhealthyThreshold} -> Natural
unhealthyThreshold) (\s :: HealthCheckPolicy
s@HealthCheckPolicy' {} Natural
a -> HealthCheckPolicy
s {$sel:unhealthyThreshold:HealthCheckPolicy' :: Natural
unhealthyThreshold = Natural
a} :: HealthCheckPolicy)
instance Core.FromJSON HealthCheckPolicy where
parseJSON :: Value -> Parser HealthCheckPolicy
parseJSON =
String
-> (Object -> Parser HealthCheckPolicy)
-> Value
-> Parser HealthCheckPolicy
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"HealthCheckPolicy"
( \Object
x ->
Maybe Text
-> Maybe Natural
-> Natural
-> Natural
-> PortProtocol
-> Natural
-> Natural
-> HealthCheckPolicy
HealthCheckPolicy'
(Maybe Text
-> Maybe Natural
-> Natural
-> Natural
-> PortProtocol
-> Natural
-> Natural
-> HealthCheckPolicy)
-> Parser (Maybe Text)
-> Parser
(Maybe Natural
-> Natural
-> Natural
-> PortProtocol
-> Natural
-> Natural
-> HealthCheckPolicy)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"path")
Parser
(Maybe Natural
-> Natural
-> Natural
-> PortProtocol
-> Natural
-> Natural
-> HealthCheckPolicy)
-> Parser (Maybe Natural)
-> Parser
(Natural
-> Natural
-> PortProtocol
-> Natural
-> Natural
-> HealthCheckPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"port")
Parser
(Natural
-> Natural
-> PortProtocol
-> Natural
-> Natural
-> HealthCheckPolicy)
-> Parser Natural
-> Parser
(Natural
-> PortProtocol -> Natural -> Natural -> HealthCheckPolicy)
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
"healthyThreshold")
Parser
(Natural
-> PortProtocol -> Natural -> Natural -> HealthCheckPolicy)
-> Parser Natural
-> Parser (PortProtocol -> Natural -> Natural -> HealthCheckPolicy)
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
"intervalMillis")
Parser (PortProtocol -> Natural -> Natural -> HealthCheckPolicy)
-> Parser PortProtocol
-> Parser (Natural -> Natural -> HealthCheckPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser PortProtocol
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"protocol")
Parser (Natural -> Natural -> HealthCheckPolicy)
-> Parser Natural -> Parser (Natural -> HealthCheckPolicy)
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
"timeoutMillis")
Parser (Natural -> HealthCheckPolicy)
-> Parser Natural -> Parser HealthCheckPolicy
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
"unhealthyThreshold")
)
instance Prelude.Hashable HealthCheckPolicy
instance Prelude.NFData HealthCheckPolicy
instance Core.ToJSON HealthCheckPolicy where
toJSON :: HealthCheckPolicy -> Value
toJSON HealthCheckPolicy' {Natural
Maybe Natural
Maybe Text
PortProtocol
unhealthyThreshold :: Natural
timeoutMillis :: Natural
protocol :: PortProtocol
intervalMillis :: Natural
healthyThreshold :: Natural
port :: Maybe Natural
path :: Maybe Text
$sel:unhealthyThreshold:HealthCheckPolicy' :: HealthCheckPolicy -> Natural
$sel:timeoutMillis:HealthCheckPolicy' :: HealthCheckPolicy -> Natural
$sel:protocol:HealthCheckPolicy' :: HealthCheckPolicy -> PortProtocol
$sel:intervalMillis:HealthCheckPolicy' :: HealthCheckPolicy -> Natural
$sel:healthyThreshold:HealthCheckPolicy' :: HealthCheckPolicy -> Natural
$sel:port:HealthCheckPolicy' :: HealthCheckPolicy -> Maybe Natural
$sel:path:HealthCheckPolicy' :: HealthCheckPolicy -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"path" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
path,
(Text
"port" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
port,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"healthyThreshold" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
healthyThreshold),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"intervalMillis" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
intervalMillis),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"protocol" Text -> PortProtocol -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PortProtocol
protocol),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"timeoutMillis" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
timeoutMillis),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"unhealthyThreshold" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
unhealthyThreshold)
]
)