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