{-# 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.SpotProvisioningSpecification where
import qualified Amazonka.Core as Core
import Amazonka.EMR.Types.SpotProvisioningAllocationStrategy
import Amazonka.EMR.Types.SpotProvisioningTimeoutAction
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SpotProvisioningSpecification = SpotProvisioningSpecification'
{
SpotProvisioningSpecification -> Maybe Natural
blockDurationMinutes :: Prelude.Maybe Prelude.Natural,
SpotProvisioningSpecification
-> Maybe SpotProvisioningAllocationStrategy
allocationStrategy :: Prelude.Maybe SpotProvisioningAllocationStrategy,
SpotProvisioningSpecification -> Natural
timeoutDurationMinutes :: Prelude.Natural,
SpotProvisioningSpecification -> SpotProvisioningTimeoutAction
timeoutAction :: SpotProvisioningTimeoutAction
}
deriving (SpotProvisioningSpecification
-> SpotProvisioningSpecification -> Bool
(SpotProvisioningSpecification
-> SpotProvisioningSpecification -> Bool)
-> (SpotProvisioningSpecification
-> SpotProvisioningSpecification -> Bool)
-> Eq SpotProvisioningSpecification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SpotProvisioningSpecification
-> SpotProvisioningSpecification -> Bool
$c/= :: SpotProvisioningSpecification
-> SpotProvisioningSpecification -> Bool
== :: SpotProvisioningSpecification
-> SpotProvisioningSpecification -> Bool
$c== :: SpotProvisioningSpecification
-> SpotProvisioningSpecification -> Bool
Prelude.Eq, ReadPrec [SpotProvisioningSpecification]
ReadPrec SpotProvisioningSpecification
Int -> ReadS SpotProvisioningSpecification
ReadS [SpotProvisioningSpecification]
(Int -> ReadS SpotProvisioningSpecification)
-> ReadS [SpotProvisioningSpecification]
-> ReadPrec SpotProvisioningSpecification
-> ReadPrec [SpotProvisioningSpecification]
-> Read SpotProvisioningSpecification
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SpotProvisioningSpecification]
$creadListPrec :: ReadPrec [SpotProvisioningSpecification]
readPrec :: ReadPrec SpotProvisioningSpecification
$creadPrec :: ReadPrec SpotProvisioningSpecification
readList :: ReadS [SpotProvisioningSpecification]
$creadList :: ReadS [SpotProvisioningSpecification]
readsPrec :: Int -> ReadS SpotProvisioningSpecification
$creadsPrec :: Int -> ReadS SpotProvisioningSpecification
Prelude.Read, Int -> SpotProvisioningSpecification -> ShowS
[SpotProvisioningSpecification] -> ShowS
SpotProvisioningSpecification -> String
(Int -> SpotProvisioningSpecification -> ShowS)
-> (SpotProvisioningSpecification -> String)
-> ([SpotProvisioningSpecification] -> ShowS)
-> Show SpotProvisioningSpecification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SpotProvisioningSpecification] -> ShowS
$cshowList :: [SpotProvisioningSpecification] -> ShowS
show :: SpotProvisioningSpecification -> String
$cshow :: SpotProvisioningSpecification -> String
showsPrec :: Int -> SpotProvisioningSpecification -> ShowS
$cshowsPrec :: Int -> SpotProvisioningSpecification -> ShowS
Prelude.Show, (forall x.
SpotProvisioningSpecification
-> Rep SpotProvisioningSpecification x)
-> (forall x.
Rep SpotProvisioningSpecification x
-> SpotProvisioningSpecification)
-> Generic SpotProvisioningSpecification
forall x.
Rep SpotProvisioningSpecification x
-> SpotProvisioningSpecification
forall x.
SpotProvisioningSpecification
-> Rep SpotProvisioningSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SpotProvisioningSpecification x
-> SpotProvisioningSpecification
$cfrom :: forall x.
SpotProvisioningSpecification
-> Rep SpotProvisioningSpecification x
Prelude.Generic)
newSpotProvisioningSpecification ::
Prelude.Natural ->
SpotProvisioningTimeoutAction ->
SpotProvisioningSpecification
newSpotProvisioningSpecification :: Natural
-> SpotProvisioningTimeoutAction -> SpotProvisioningSpecification
newSpotProvisioningSpecification
Natural
pTimeoutDurationMinutes_
SpotProvisioningTimeoutAction
pTimeoutAction_ =
SpotProvisioningSpecification' :: Maybe Natural
-> Maybe SpotProvisioningAllocationStrategy
-> Natural
-> SpotProvisioningTimeoutAction
-> SpotProvisioningSpecification
SpotProvisioningSpecification'
{ $sel:blockDurationMinutes:SpotProvisioningSpecification' :: Maybe Natural
blockDurationMinutes =
Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:allocationStrategy:SpotProvisioningSpecification' :: Maybe SpotProvisioningAllocationStrategy
allocationStrategy = Maybe SpotProvisioningAllocationStrategy
forall a. Maybe a
Prelude.Nothing,
$sel:timeoutDurationMinutes:SpotProvisioningSpecification' :: Natural
timeoutDurationMinutes =
Natural
pTimeoutDurationMinutes_,
$sel:timeoutAction:SpotProvisioningSpecification' :: SpotProvisioningTimeoutAction
timeoutAction = SpotProvisioningTimeoutAction
pTimeoutAction_
}
spotProvisioningSpecification_blockDurationMinutes :: Lens.Lens' SpotProvisioningSpecification (Prelude.Maybe Prelude.Natural)
spotProvisioningSpecification_blockDurationMinutes :: (Maybe Natural -> f (Maybe Natural))
-> SpotProvisioningSpecification -> f SpotProvisioningSpecification
spotProvisioningSpecification_blockDurationMinutes = (SpotProvisioningSpecification -> Maybe Natural)
-> (SpotProvisioningSpecification
-> Maybe Natural -> SpotProvisioningSpecification)
-> Lens
SpotProvisioningSpecification
SpotProvisioningSpecification
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SpotProvisioningSpecification' {Maybe Natural
blockDurationMinutes :: Maybe Natural
$sel:blockDurationMinutes:SpotProvisioningSpecification' :: SpotProvisioningSpecification -> Maybe Natural
blockDurationMinutes} -> Maybe Natural
blockDurationMinutes) (\s :: SpotProvisioningSpecification
s@SpotProvisioningSpecification' {} Maybe Natural
a -> SpotProvisioningSpecification
s {$sel:blockDurationMinutes:SpotProvisioningSpecification' :: Maybe Natural
blockDurationMinutes = Maybe Natural
a} :: SpotProvisioningSpecification)
spotProvisioningSpecification_allocationStrategy :: Lens.Lens' SpotProvisioningSpecification (Prelude.Maybe SpotProvisioningAllocationStrategy)
spotProvisioningSpecification_allocationStrategy :: (Maybe SpotProvisioningAllocationStrategy
-> f (Maybe SpotProvisioningAllocationStrategy))
-> SpotProvisioningSpecification -> f SpotProvisioningSpecification
spotProvisioningSpecification_allocationStrategy = (SpotProvisioningSpecification
-> Maybe SpotProvisioningAllocationStrategy)
-> (SpotProvisioningSpecification
-> Maybe SpotProvisioningAllocationStrategy
-> SpotProvisioningSpecification)
-> Lens
SpotProvisioningSpecification
SpotProvisioningSpecification
(Maybe SpotProvisioningAllocationStrategy)
(Maybe SpotProvisioningAllocationStrategy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SpotProvisioningSpecification' {Maybe SpotProvisioningAllocationStrategy
allocationStrategy :: Maybe SpotProvisioningAllocationStrategy
$sel:allocationStrategy:SpotProvisioningSpecification' :: SpotProvisioningSpecification
-> Maybe SpotProvisioningAllocationStrategy
allocationStrategy} -> Maybe SpotProvisioningAllocationStrategy
allocationStrategy) (\s :: SpotProvisioningSpecification
s@SpotProvisioningSpecification' {} Maybe SpotProvisioningAllocationStrategy
a -> SpotProvisioningSpecification
s {$sel:allocationStrategy:SpotProvisioningSpecification' :: Maybe SpotProvisioningAllocationStrategy
allocationStrategy = Maybe SpotProvisioningAllocationStrategy
a} :: SpotProvisioningSpecification)
spotProvisioningSpecification_timeoutDurationMinutes :: Lens.Lens' SpotProvisioningSpecification Prelude.Natural
spotProvisioningSpecification_timeoutDurationMinutes :: (Natural -> f Natural)
-> SpotProvisioningSpecification -> f SpotProvisioningSpecification
spotProvisioningSpecification_timeoutDurationMinutes = (SpotProvisioningSpecification -> Natural)
-> (SpotProvisioningSpecification
-> Natural -> SpotProvisioningSpecification)
-> Lens
SpotProvisioningSpecification
SpotProvisioningSpecification
Natural
Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SpotProvisioningSpecification' {Natural
timeoutDurationMinutes :: Natural
$sel:timeoutDurationMinutes:SpotProvisioningSpecification' :: SpotProvisioningSpecification -> Natural
timeoutDurationMinutes} -> Natural
timeoutDurationMinutes) (\s :: SpotProvisioningSpecification
s@SpotProvisioningSpecification' {} Natural
a -> SpotProvisioningSpecification
s {$sel:timeoutDurationMinutes:SpotProvisioningSpecification' :: Natural
timeoutDurationMinutes = Natural
a} :: SpotProvisioningSpecification)
spotProvisioningSpecification_timeoutAction :: Lens.Lens' SpotProvisioningSpecification SpotProvisioningTimeoutAction
spotProvisioningSpecification_timeoutAction :: (SpotProvisioningTimeoutAction -> f SpotProvisioningTimeoutAction)
-> SpotProvisioningSpecification -> f SpotProvisioningSpecification
spotProvisioningSpecification_timeoutAction = (SpotProvisioningSpecification -> SpotProvisioningTimeoutAction)
-> (SpotProvisioningSpecification
-> SpotProvisioningTimeoutAction -> SpotProvisioningSpecification)
-> Lens
SpotProvisioningSpecification
SpotProvisioningSpecification
SpotProvisioningTimeoutAction
SpotProvisioningTimeoutAction
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SpotProvisioningSpecification' {SpotProvisioningTimeoutAction
timeoutAction :: SpotProvisioningTimeoutAction
$sel:timeoutAction:SpotProvisioningSpecification' :: SpotProvisioningSpecification -> SpotProvisioningTimeoutAction
timeoutAction} -> SpotProvisioningTimeoutAction
timeoutAction) (\s :: SpotProvisioningSpecification
s@SpotProvisioningSpecification' {} SpotProvisioningTimeoutAction
a -> SpotProvisioningSpecification
s {$sel:timeoutAction:SpotProvisioningSpecification' :: SpotProvisioningTimeoutAction
timeoutAction = SpotProvisioningTimeoutAction
a} :: SpotProvisioningSpecification)
instance Core.FromJSON SpotProvisioningSpecification where
parseJSON :: Value -> Parser SpotProvisioningSpecification
parseJSON =
String
-> (Object -> Parser SpotProvisioningSpecification)
-> Value
-> Parser SpotProvisioningSpecification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SpotProvisioningSpecification"
( \Object
x ->
Maybe Natural
-> Maybe SpotProvisioningAllocationStrategy
-> Natural
-> SpotProvisioningTimeoutAction
-> SpotProvisioningSpecification
SpotProvisioningSpecification'
(Maybe Natural
-> Maybe SpotProvisioningAllocationStrategy
-> Natural
-> SpotProvisioningTimeoutAction
-> SpotProvisioningSpecification)
-> Parser (Maybe Natural)
-> Parser
(Maybe SpotProvisioningAllocationStrategy
-> Natural
-> SpotProvisioningTimeoutAction
-> SpotProvisioningSpecification)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BlockDurationMinutes")
Parser
(Maybe SpotProvisioningAllocationStrategy
-> Natural
-> SpotProvisioningTimeoutAction
-> SpotProvisioningSpecification)
-> Parser (Maybe SpotProvisioningAllocationStrategy)
-> Parser
(Natural
-> SpotProvisioningTimeoutAction -> SpotProvisioningSpecification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SpotProvisioningAllocationStrategy)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AllocationStrategy")
Parser
(Natural
-> SpotProvisioningTimeoutAction -> SpotProvisioningSpecification)
-> Parser Natural
-> Parser
(SpotProvisioningTimeoutAction -> SpotProvisioningSpecification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TimeoutDurationMinutes")
Parser
(SpotProvisioningTimeoutAction -> SpotProvisioningSpecification)
-> Parser SpotProvisioningTimeoutAction
-> Parser SpotProvisioningSpecification
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser SpotProvisioningTimeoutAction
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TimeoutAction")
)
instance
Prelude.Hashable
SpotProvisioningSpecification
instance Prelude.NFData SpotProvisioningSpecification
instance Core.ToJSON SpotProvisioningSpecification where
toJSON :: SpotProvisioningSpecification -> Value
toJSON SpotProvisioningSpecification' {Natural
Maybe Natural
Maybe SpotProvisioningAllocationStrategy
SpotProvisioningTimeoutAction
timeoutAction :: SpotProvisioningTimeoutAction
timeoutDurationMinutes :: Natural
allocationStrategy :: Maybe SpotProvisioningAllocationStrategy
blockDurationMinutes :: Maybe Natural
$sel:timeoutAction:SpotProvisioningSpecification' :: SpotProvisioningSpecification -> SpotProvisioningTimeoutAction
$sel:timeoutDurationMinutes:SpotProvisioningSpecification' :: SpotProvisioningSpecification -> Natural
$sel:allocationStrategy:SpotProvisioningSpecification' :: SpotProvisioningSpecification
-> Maybe SpotProvisioningAllocationStrategy
$sel:blockDurationMinutes:SpotProvisioningSpecification' :: SpotProvisioningSpecification -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"BlockDurationMinutes" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
blockDurationMinutes,
(Text
"AllocationStrategy" Text -> SpotProvisioningAllocationStrategy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(SpotProvisioningAllocationStrategy -> Pair)
-> Maybe SpotProvisioningAllocationStrategy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SpotProvisioningAllocationStrategy
allocationStrategy,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"TimeoutDurationMinutes"
Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
timeoutDurationMinutes
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"TimeoutAction" Text -> SpotProvisioningTimeoutAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SpotProvisioningTimeoutAction
timeoutAction)
]
)