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