{-# 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.CodeDeploy.Types.AutoRollbackConfiguration where
import Amazonka.CodeDeploy.Types.AutoRollbackEvent
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AutoRollbackConfiguration = AutoRollbackConfiguration'
{
AutoRollbackConfiguration -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
AutoRollbackConfiguration -> Maybe [AutoRollbackEvent]
events :: Prelude.Maybe [AutoRollbackEvent]
}
deriving (AutoRollbackConfiguration -> AutoRollbackConfiguration -> Bool
(AutoRollbackConfiguration -> AutoRollbackConfiguration -> Bool)
-> (AutoRollbackConfiguration -> AutoRollbackConfiguration -> Bool)
-> Eq AutoRollbackConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoRollbackConfiguration -> AutoRollbackConfiguration -> Bool
$c/= :: AutoRollbackConfiguration -> AutoRollbackConfiguration -> Bool
== :: AutoRollbackConfiguration -> AutoRollbackConfiguration -> Bool
$c== :: AutoRollbackConfiguration -> AutoRollbackConfiguration -> Bool
Prelude.Eq, ReadPrec [AutoRollbackConfiguration]
ReadPrec AutoRollbackConfiguration
Int -> ReadS AutoRollbackConfiguration
ReadS [AutoRollbackConfiguration]
(Int -> ReadS AutoRollbackConfiguration)
-> ReadS [AutoRollbackConfiguration]
-> ReadPrec AutoRollbackConfiguration
-> ReadPrec [AutoRollbackConfiguration]
-> Read AutoRollbackConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoRollbackConfiguration]
$creadListPrec :: ReadPrec [AutoRollbackConfiguration]
readPrec :: ReadPrec AutoRollbackConfiguration
$creadPrec :: ReadPrec AutoRollbackConfiguration
readList :: ReadS [AutoRollbackConfiguration]
$creadList :: ReadS [AutoRollbackConfiguration]
readsPrec :: Int -> ReadS AutoRollbackConfiguration
$creadsPrec :: Int -> ReadS AutoRollbackConfiguration
Prelude.Read, Int -> AutoRollbackConfiguration -> ShowS
[AutoRollbackConfiguration] -> ShowS
AutoRollbackConfiguration -> String
(Int -> AutoRollbackConfiguration -> ShowS)
-> (AutoRollbackConfiguration -> String)
-> ([AutoRollbackConfiguration] -> ShowS)
-> Show AutoRollbackConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoRollbackConfiguration] -> ShowS
$cshowList :: [AutoRollbackConfiguration] -> ShowS
show :: AutoRollbackConfiguration -> String
$cshow :: AutoRollbackConfiguration -> String
showsPrec :: Int -> AutoRollbackConfiguration -> ShowS
$cshowsPrec :: Int -> AutoRollbackConfiguration -> ShowS
Prelude.Show, (forall x.
AutoRollbackConfiguration -> Rep AutoRollbackConfiguration x)
-> (forall x.
Rep AutoRollbackConfiguration x -> AutoRollbackConfiguration)
-> Generic AutoRollbackConfiguration
forall x.
Rep AutoRollbackConfiguration x -> AutoRollbackConfiguration
forall x.
AutoRollbackConfiguration -> Rep AutoRollbackConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AutoRollbackConfiguration x -> AutoRollbackConfiguration
$cfrom :: forall x.
AutoRollbackConfiguration -> Rep AutoRollbackConfiguration x
Prelude.Generic)
newAutoRollbackConfiguration ::
AutoRollbackConfiguration
newAutoRollbackConfiguration :: AutoRollbackConfiguration
newAutoRollbackConfiguration =
AutoRollbackConfiguration' :: Maybe Bool
-> Maybe [AutoRollbackEvent] -> AutoRollbackConfiguration
AutoRollbackConfiguration'
{ $sel:enabled:AutoRollbackConfiguration' :: Maybe Bool
enabled =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:events:AutoRollbackConfiguration' :: Maybe [AutoRollbackEvent]
events = Maybe [AutoRollbackEvent]
forall a. Maybe a
Prelude.Nothing
}
autoRollbackConfiguration_enabled :: Lens.Lens' AutoRollbackConfiguration (Prelude.Maybe Prelude.Bool)
autoRollbackConfiguration_enabled :: (Maybe Bool -> f (Maybe Bool))
-> AutoRollbackConfiguration -> f AutoRollbackConfiguration
autoRollbackConfiguration_enabled = (AutoRollbackConfiguration -> Maybe Bool)
-> (AutoRollbackConfiguration
-> Maybe Bool -> AutoRollbackConfiguration)
-> Lens
AutoRollbackConfiguration
AutoRollbackConfiguration
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoRollbackConfiguration' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:AutoRollbackConfiguration' :: AutoRollbackConfiguration -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: AutoRollbackConfiguration
s@AutoRollbackConfiguration' {} Maybe Bool
a -> AutoRollbackConfiguration
s {$sel:enabled:AutoRollbackConfiguration' :: Maybe Bool
enabled = Maybe Bool
a} :: AutoRollbackConfiguration)
autoRollbackConfiguration_events :: Lens.Lens' AutoRollbackConfiguration (Prelude.Maybe [AutoRollbackEvent])
autoRollbackConfiguration_events :: (Maybe [AutoRollbackEvent] -> f (Maybe [AutoRollbackEvent]))
-> AutoRollbackConfiguration -> f AutoRollbackConfiguration
autoRollbackConfiguration_events = (AutoRollbackConfiguration -> Maybe [AutoRollbackEvent])
-> (AutoRollbackConfiguration
-> Maybe [AutoRollbackEvent] -> AutoRollbackConfiguration)
-> Lens
AutoRollbackConfiguration
AutoRollbackConfiguration
(Maybe [AutoRollbackEvent])
(Maybe [AutoRollbackEvent])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoRollbackConfiguration' {Maybe [AutoRollbackEvent]
events :: Maybe [AutoRollbackEvent]
$sel:events:AutoRollbackConfiguration' :: AutoRollbackConfiguration -> Maybe [AutoRollbackEvent]
events} -> Maybe [AutoRollbackEvent]
events) (\s :: AutoRollbackConfiguration
s@AutoRollbackConfiguration' {} Maybe [AutoRollbackEvent]
a -> AutoRollbackConfiguration
s {$sel:events:AutoRollbackConfiguration' :: Maybe [AutoRollbackEvent]
events = Maybe [AutoRollbackEvent]
a} :: AutoRollbackConfiguration) ((Maybe [AutoRollbackEvent] -> f (Maybe [AutoRollbackEvent]))
-> AutoRollbackConfiguration -> f AutoRollbackConfiguration)
-> ((Maybe [AutoRollbackEvent] -> f (Maybe [AutoRollbackEvent]))
-> Maybe [AutoRollbackEvent] -> f (Maybe [AutoRollbackEvent]))
-> (Maybe [AutoRollbackEvent] -> f (Maybe [AutoRollbackEvent]))
-> AutoRollbackConfiguration
-> f AutoRollbackConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[AutoRollbackEvent]
[AutoRollbackEvent]
[AutoRollbackEvent]
[AutoRollbackEvent]
-> Iso
(Maybe [AutoRollbackEvent])
(Maybe [AutoRollbackEvent])
(Maybe [AutoRollbackEvent])
(Maybe [AutoRollbackEvent])
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 AnIso
[AutoRollbackEvent]
[AutoRollbackEvent]
[AutoRollbackEvent]
[AutoRollbackEvent]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON AutoRollbackConfiguration where
parseJSON :: Value -> Parser AutoRollbackConfiguration
parseJSON =
String
-> (Object -> Parser AutoRollbackConfiguration)
-> Value
-> Parser AutoRollbackConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AutoRollbackConfiguration"
( \Object
x ->
Maybe Bool
-> Maybe [AutoRollbackEvent] -> AutoRollbackConfiguration
AutoRollbackConfiguration'
(Maybe Bool
-> Maybe [AutoRollbackEvent] -> AutoRollbackConfiguration)
-> Parser (Maybe Bool)
-> Parser (Maybe [AutoRollbackEvent] -> AutoRollbackConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"enabled")
Parser (Maybe [AutoRollbackEvent] -> AutoRollbackConfiguration)
-> Parser (Maybe [AutoRollbackEvent])
-> Parser AutoRollbackConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [AutoRollbackEvent]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"events" Parser (Maybe (Maybe [AutoRollbackEvent]))
-> Maybe [AutoRollbackEvent] -> Parser (Maybe [AutoRollbackEvent])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AutoRollbackEvent]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable AutoRollbackConfiguration
instance Prelude.NFData AutoRollbackConfiguration
instance Core.ToJSON AutoRollbackConfiguration where
toJSON :: AutoRollbackConfiguration -> Value
toJSON AutoRollbackConfiguration' {Maybe Bool
Maybe [AutoRollbackEvent]
events :: Maybe [AutoRollbackEvent]
enabled :: Maybe Bool
$sel:events:AutoRollbackConfiguration' :: AutoRollbackConfiguration -> Maybe [AutoRollbackEvent]
$sel:enabled:AutoRollbackConfiguration' :: AutoRollbackConfiguration -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"enabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enabled,
(Text
"events" Text -> [AutoRollbackEvent] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([AutoRollbackEvent] -> Pair)
-> Maybe [AutoRollbackEvent] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AutoRollbackEvent]
events
]
)