{-# 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.EMRServerless.Types.AutoStopConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data AutoStopConfig = AutoStopConfig'
{
AutoStopConfig -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
AutoStopConfig -> Maybe Natural
idleTimeoutMinutes :: Prelude.Maybe Prelude.Natural
}
deriving (AutoStopConfig -> AutoStopConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoStopConfig -> AutoStopConfig -> Bool
$c/= :: AutoStopConfig -> AutoStopConfig -> Bool
== :: AutoStopConfig -> AutoStopConfig -> Bool
$c== :: AutoStopConfig -> AutoStopConfig -> Bool
Prelude.Eq, ReadPrec [AutoStopConfig]
ReadPrec AutoStopConfig
Int -> ReadS AutoStopConfig
ReadS [AutoStopConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoStopConfig]
$creadListPrec :: ReadPrec [AutoStopConfig]
readPrec :: ReadPrec AutoStopConfig
$creadPrec :: ReadPrec AutoStopConfig
readList :: ReadS [AutoStopConfig]
$creadList :: ReadS [AutoStopConfig]
readsPrec :: Int -> ReadS AutoStopConfig
$creadsPrec :: Int -> ReadS AutoStopConfig
Prelude.Read, Int -> AutoStopConfig -> ShowS
[AutoStopConfig] -> ShowS
AutoStopConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoStopConfig] -> ShowS
$cshowList :: [AutoStopConfig] -> ShowS
show :: AutoStopConfig -> String
$cshow :: AutoStopConfig -> String
showsPrec :: Int -> AutoStopConfig -> ShowS
$cshowsPrec :: Int -> AutoStopConfig -> ShowS
Prelude.Show, forall x. Rep AutoStopConfig x -> AutoStopConfig
forall x. AutoStopConfig -> Rep AutoStopConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AutoStopConfig x -> AutoStopConfig
$cfrom :: forall x. AutoStopConfig -> Rep AutoStopConfig x
Prelude.Generic)
newAutoStopConfig ::
AutoStopConfig
newAutoStopConfig :: AutoStopConfig
newAutoStopConfig =
AutoStopConfig'
{ $sel:enabled:AutoStopConfig' :: Maybe Bool
enabled = forall a. Maybe a
Prelude.Nothing,
$sel:idleTimeoutMinutes:AutoStopConfig' :: Maybe Natural
idleTimeoutMinutes = forall a. Maybe a
Prelude.Nothing
}
autoStopConfig_enabled :: Lens.Lens' AutoStopConfig (Prelude.Maybe Prelude.Bool)
autoStopConfig_enabled :: Lens' AutoStopConfig (Maybe Bool)
autoStopConfig_enabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoStopConfig' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:AutoStopConfig' :: AutoStopConfig -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: AutoStopConfig
s@AutoStopConfig' {} Maybe Bool
a -> AutoStopConfig
s {$sel:enabled:AutoStopConfig' :: Maybe Bool
enabled = Maybe Bool
a} :: AutoStopConfig)
autoStopConfig_idleTimeoutMinutes :: Lens.Lens' AutoStopConfig (Prelude.Maybe Prelude.Natural)
autoStopConfig_idleTimeoutMinutes :: Lens' AutoStopConfig (Maybe Natural)
autoStopConfig_idleTimeoutMinutes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoStopConfig' {Maybe Natural
idleTimeoutMinutes :: Maybe Natural
$sel:idleTimeoutMinutes:AutoStopConfig' :: AutoStopConfig -> Maybe Natural
idleTimeoutMinutes} -> Maybe Natural
idleTimeoutMinutes) (\s :: AutoStopConfig
s@AutoStopConfig' {} Maybe Natural
a -> AutoStopConfig
s {$sel:idleTimeoutMinutes:AutoStopConfig' :: Maybe Natural
idleTimeoutMinutes = Maybe Natural
a} :: AutoStopConfig)
instance Data.FromJSON AutoStopConfig where
parseJSON :: Value -> Parser AutoStopConfig
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"AutoStopConfig"
( \Object
x ->
Maybe Bool -> Maybe Natural -> AutoStopConfig
AutoStopConfig'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"enabled")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"idleTimeoutMinutes")
)
instance Prelude.Hashable AutoStopConfig where
hashWithSalt :: Int -> AutoStopConfig -> Int
hashWithSalt Int
_salt AutoStopConfig' {Maybe Bool
Maybe Natural
idleTimeoutMinutes :: Maybe Natural
enabled :: Maybe Bool
$sel:idleTimeoutMinutes:AutoStopConfig' :: AutoStopConfig -> Maybe Natural
$sel:enabled:AutoStopConfig' :: AutoStopConfig -> Maybe Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enabled
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
idleTimeoutMinutes
instance Prelude.NFData AutoStopConfig where
rnf :: AutoStopConfig -> ()
rnf AutoStopConfig' {Maybe Bool
Maybe Natural
idleTimeoutMinutes :: Maybe Natural
enabled :: Maybe Bool
$sel:idleTimeoutMinutes:AutoStopConfig' :: AutoStopConfig -> Maybe Natural
$sel:enabled:AutoStopConfig' :: AutoStopConfig -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enabled
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
idleTimeoutMinutes
instance Data.ToJSON AutoStopConfig where
toJSON :: AutoStopConfig -> Value
toJSON AutoStopConfig' {Maybe Bool
Maybe Natural
idleTimeoutMinutes :: Maybe Natural
enabled :: Maybe Bool
$sel:idleTimeoutMinutes:AutoStopConfig' :: AutoStopConfig -> Maybe Natural
$sel:enabled:AutoStopConfig' :: AutoStopConfig -> Maybe Bool
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"enabled" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enabled,
(Key
"idleTimeoutMinutes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
idleTimeoutMinutes
]
)