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