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