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