{-# 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.Synthetics.Types.CanaryStatus where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Synthetics.Types.CanaryState
import Amazonka.Synthetics.Types.CanaryStateReasonCode
data CanaryStatus = CanaryStatus'
{
CanaryStatus -> Maybe CanaryState
state :: Prelude.Maybe CanaryState,
CanaryStatus -> Maybe Text
stateReason :: Prelude.Maybe Prelude.Text,
CanaryStatus -> Maybe CanaryStateReasonCode
stateReasonCode :: Prelude.Maybe CanaryStateReasonCode
}
deriving (CanaryStatus -> CanaryStatus -> Bool
(CanaryStatus -> CanaryStatus -> Bool)
-> (CanaryStatus -> CanaryStatus -> Bool) -> Eq CanaryStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CanaryStatus -> CanaryStatus -> Bool
$c/= :: CanaryStatus -> CanaryStatus -> Bool
== :: CanaryStatus -> CanaryStatus -> Bool
$c== :: CanaryStatus -> CanaryStatus -> Bool
Prelude.Eq, ReadPrec [CanaryStatus]
ReadPrec CanaryStatus
Int -> ReadS CanaryStatus
ReadS [CanaryStatus]
(Int -> ReadS CanaryStatus)
-> ReadS [CanaryStatus]
-> ReadPrec CanaryStatus
-> ReadPrec [CanaryStatus]
-> Read CanaryStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CanaryStatus]
$creadListPrec :: ReadPrec [CanaryStatus]
readPrec :: ReadPrec CanaryStatus
$creadPrec :: ReadPrec CanaryStatus
readList :: ReadS [CanaryStatus]
$creadList :: ReadS [CanaryStatus]
readsPrec :: Int -> ReadS CanaryStatus
$creadsPrec :: Int -> ReadS CanaryStatus
Prelude.Read, Int -> CanaryStatus -> ShowS
[CanaryStatus] -> ShowS
CanaryStatus -> String
(Int -> CanaryStatus -> ShowS)
-> (CanaryStatus -> String)
-> ([CanaryStatus] -> ShowS)
-> Show CanaryStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CanaryStatus] -> ShowS
$cshowList :: [CanaryStatus] -> ShowS
show :: CanaryStatus -> String
$cshow :: CanaryStatus -> String
showsPrec :: Int -> CanaryStatus -> ShowS
$cshowsPrec :: Int -> CanaryStatus -> ShowS
Prelude.Show, (forall x. CanaryStatus -> Rep CanaryStatus x)
-> (forall x. Rep CanaryStatus x -> CanaryStatus)
-> Generic CanaryStatus
forall x. Rep CanaryStatus x -> CanaryStatus
forall x. CanaryStatus -> Rep CanaryStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CanaryStatus x -> CanaryStatus
$cfrom :: forall x. CanaryStatus -> Rep CanaryStatus x
Prelude.Generic)
newCanaryStatus ::
CanaryStatus
newCanaryStatus :: CanaryStatus
newCanaryStatus =
CanaryStatus' :: Maybe CanaryState
-> Maybe Text -> Maybe CanaryStateReasonCode -> CanaryStatus
CanaryStatus'
{ $sel:state:CanaryStatus' :: Maybe CanaryState
state = Maybe CanaryState
forall a. Maybe a
Prelude.Nothing,
$sel:stateReason:CanaryStatus' :: Maybe Text
stateReason = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:stateReasonCode:CanaryStatus' :: Maybe CanaryStateReasonCode
stateReasonCode = Maybe CanaryStateReasonCode
forall a. Maybe a
Prelude.Nothing
}
canaryStatus_state :: Lens.Lens' CanaryStatus (Prelude.Maybe CanaryState)
canaryStatus_state :: (Maybe CanaryState -> f (Maybe CanaryState))
-> CanaryStatus -> f CanaryStatus
canaryStatus_state = (CanaryStatus -> Maybe CanaryState)
-> (CanaryStatus -> Maybe CanaryState -> CanaryStatus)
-> Lens
CanaryStatus CanaryStatus (Maybe CanaryState) (Maybe CanaryState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CanaryStatus' {Maybe CanaryState
state :: Maybe CanaryState
$sel:state:CanaryStatus' :: CanaryStatus -> Maybe CanaryState
state} -> Maybe CanaryState
state) (\s :: CanaryStatus
s@CanaryStatus' {} Maybe CanaryState
a -> CanaryStatus
s {$sel:state:CanaryStatus' :: Maybe CanaryState
state = Maybe CanaryState
a} :: CanaryStatus)
canaryStatus_stateReason :: Lens.Lens' CanaryStatus (Prelude.Maybe Prelude.Text)
canaryStatus_stateReason :: (Maybe Text -> f (Maybe Text)) -> CanaryStatus -> f CanaryStatus
canaryStatus_stateReason = (CanaryStatus -> Maybe Text)
-> (CanaryStatus -> Maybe Text -> CanaryStatus)
-> Lens CanaryStatus CanaryStatus (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CanaryStatus' {Maybe Text
stateReason :: Maybe Text
$sel:stateReason:CanaryStatus' :: CanaryStatus -> Maybe Text
stateReason} -> Maybe Text
stateReason) (\s :: CanaryStatus
s@CanaryStatus' {} Maybe Text
a -> CanaryStatus
s {$sel:stateReason:CanaryStatus' :: Maybe Text
stateReason = Maybe Text
a} :: CanaryStatus)
canaryStatus_stateReasonCode :: Lens.Lens' CanaryStatus (Prelude.Maybe CanaryStateReasonCode)
canaryStatus_stateReasonCode :: (Maybe CanaryStateReasonCode -> f (Maybe CanaryStateReasonCode))
-> CanaryStatus -> f CanaryStatus
canaryStatus_stateReasonCode = (CanaryStatus -> Maybe CanaryStateReasonCode)
-> (CanaryStatus -> Maybe CanaryStateReasonCode -> CanaryStatus)
-> Lens
CanaryStatus
CanaryStatus
(Maybe CanaryStateReasonCode)
(Maybe CanaryStateReasonCode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CanaryStatus' {Maybe CanaryStateReasonCode
stateReasonCode :: Maybe CanaryStateReasonCode
$sel:stateReasonCode:CanaryStatus' :: CanaryStatus -> Maybe CanaryStateReasonCode
stateReasonCode} -> Maybe CanaryStateReasonCode
stateReasonCode) (\s :: CanaryStatus
s@CanaryStatus' {} Maybe CanaryStateReasonCode
a -> CanaryStatus
s {$sel:stateReasonCode:CanaryStatus' :: Maybe CanaryStateReasonCode
stateReasonCode = Maybe CanaryStateReasonCode
a} :: CanaryStatus)
instance Core.FromJSON CanaryStatus where
parseJSON :: Value -> Parser CanaryStatus
parseJSON =
String
-> (Object -> Parser CanaryStatus) -> Value -> Parser CanaryStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CanaryStatus"
( \Object
x ->
Maybe CanaryState
-> Maybe Text -> Maybe CanaryStateReasonCode -> CanaryStatus
CanaryStatus'
(Maybe CanaryState
-> Maybe Text -> Maybe CanaryStateReasonCode -> CanaryStatus)
-> Parser (Maybe CanaryState)
-> Parser
(Maybe Text -> Maybe CanaryStateReasonCode -> CanaryStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CanaryState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
Parser (Maybe Text -> Maybe CanaryStateReasonCode -> CanaryStatus)
-> Parser (Maybe Text)
-> Parser (Maybe CanaryStateReasonCode -> CanaryStatus)
forall (f :: * -> *) a b. Applicative f => 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
"StateReason")
Parser (Maybe CanaryStateReasonCode -> CanaryStatus)
-> Parser (Maybe CanaryStateReasonCode) -> Parser CanaryStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CanaryStateReasonCode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StateReasonCode")
)
instance Prelude.Hashable CanaryStatus
instance Prelude.NFData CanaryStatus