{-# 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.InstanceTypeConfig where
import qualified Amazonka.Core as Core
import Amazonka.EMR.Types.Configuration
import Amazonka.EMR.Types.EbsConfiguration
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data InstanceTypeConfig = InstanceTypeConfig'
{
InstanceTypeConfig -> Maybe EbsConfiguration
ebsConfiguration :: Prelude.Maybe EbsConfiguration,
InstanceTypeConfig -> Maybe Text
bidPrice :: Prelude.Maybe Prelude.Text,
InstanceTypeConfig -> Maybe Natural
weightedCapacity :: Prelude.Maybe Prelude.Natural,
InstanceTypeConfig -> Maybe [Configuration]
configurations :: Prelude.Maybe [Configuration],
InstanceTypeConfig -> Maybe Text
customAmiId :: Prelude.Maybe Prelude.Text,
InstanceTypeConfig -> Maybe Double
bidPriceAsPercentageOfOnDemandPrice :: Prelude.Maybe Prelude.Double,
InstanceTypeConfig -> Text
instanceType :: Prelude.Text
}
deriving (InstanceTypeConfig -> InstanceTypeConfig -> Bool
(InstanceTypeConfig -> InstanceTypeConfig -> Bool)
-> (InstanceTypeConfig -> InstanceTypeConfig -> Bool)
-> Eq InstanceTypeConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceTypeConfig -> InstanceTypeConfig -> Bool
$c/= :: InstanceTypeConfig -> InstanceTypeConfig -> Bool
== :: InstanceTypeConfig -> InstanceTypeConfig -> Bool
$c== :: InstanceTypeConfig -> InstanceTypeConfig -> Bool
Prelude.Eq, ReadPrec [InstanceTypeConfig]
ReadPrec InstanceTypeConfig
Int -> ReadS InstanceTypeConfig
ReadS [InstanceTypeConfig]
(Int -> ReadS InstanceTypeConfig)
-> ReadS [InstanceTypeConfig]
-> ReadPrec InstanceTypeConfig
-> ReadPrec [InstanceTypeConfig]
-> Read InstanceTypeConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceTypeConfig]
$creadListPrec :: ReadPrec [InstanceTypeConfig]
readPrec :: ReadPrec InstanceTypeConfig
$creadPrec :: ReadPrec InstanceTypeConfig
readList :: ReadS [InstanceTypeConfig]
$creadList :: ReadS [InstanceTypeConfig]
readsPrec :: Int -> ReadS InstanceTypeConfig
$creadsPrec :: Int -> ReadS InstanceTypeConfig
Prelude.Read, Int -> InstanceTypeConfig -> ShowS
[InstanceTypeConfig] -> ShowS
InstanceTypeConfig -> String
(Int -> InstanceTypeConfig -> ShowS)
-> (InstanceTypeConfig -> String)
-> ([InstanceTypeConfig] -> ShowS)
-> Show InstanceTypeConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceTypeConfig] -> ShowS
$cshowList :: [InstanceTypeConfig] -> ShowS
show :: InstanceTypeConfig -> String
$cshow :: InstanceTypeConfig -> String
showsPrec :: Int -> InstanceTypeConfig -> ShowS
$cshowsPrec :: Int -> InstanceTypeConfig -> ShowS
Prelude.Show, (forall x. InstanceTypeConfig -> Rep InstanceTypeConfig x)
-> (forall x. Rep InstanceTypeConfig x -> InstanceTypeConfig)
-> Generic InstanceTypeConfig
forall x. Rep InstanceTypeConfig x -> InstanceTypeConfig
forall x. InstanceTypeConfig -> Rep InstanceTypeConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceTypeConfig x -> InstanceTypeConfig
$cfrom :: forall x. InstanceTypeConfig -> Rep InstanceTypeConfig x
Prelude.Generic)
newInstanceTypeConfig ::
Prelude.Text ->
InstanceTypeConfig
newInstanceTypeConfig :: Text -> InstanceTypeConfig
newInstanceTypeConfig Text
pInstanceType_ =
InstanceTypeConfig' :: Maybe EbsConfiguration
-> Maybe Text
-> Maybe Natural
-> Maybe [Configuration]
-> Maybe Text
-> Maybe Double
-> Text
-> InstanceTypeConfig
InstanceTypeConfig'
{ $sel:ebsConfiguration:InstanceTypeConfig' :: Maybe EbsConfiguration
ebsConfiguration =
Maybe EbsConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:bidPrice:InstanceTypeConfig' :: Maybe Text
bidPrice = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:weightedCapacity:InstanceTypeConfig' :: Maybe Natural
weightedCapacity = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:configurations:InstanceTypeConfig' :: Maybe [Configuration]
configurations = Maybe [Configuration]
forall a. Maybe a
Prelude.Nothing,
$sel:customAmiId:InstanceTypeConfig' :: Maybe Text
customAmiId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:bidPriceAsPercentageOfOnDemandPrice:InstanceTypeConfig' :: Maybe Double
bidPriceAsPercentageOfOnDemandPrice =
Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:instanceType:InstanceTypeConfig' :: Text
instanceType = Text
pInstanceType_
}
instanceTypeConfig_ebsConfiguration :: Lens.Lens' InstanceTypeConfig (Prelude.Maybe EbsConfiguration)
instanceTypeConfig_ebsConfiguration :: (Maybe EbsConfiguration -> f (Maybe EbsConfiguration))
-> InstanceTypeConfig -> f InstanceTypeConfig
instanceTypeConfig_ebsConfiguration = (InstanceTypeConfig -> Maybe EbsConfiguration)
-> (InstanceTypeConfig
-> Maybe EbsConfiguration -> InstanceTypeConfig)
-> Lens
InstanceTypeConfig
InstanceTypeConfig
(Maybe EbsConfiguration)
(Maybe EbsConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceTypeConfig' {Maybe EbsConfiguration
ebsConfiguration :: Maybe EbsConfiguration
$sel:ebsConfiguration:InstanceTypeConfig' :: InstanceTypeConfig -> Maybe EbsConfiguration
ebsConfiguration} -> Maybe EbsConfiguration
ebsConfiguration) (\s :: InstanceTypeConfig
s@InstanceTypeConfig' {} Maybe EbsConfiguration
a -> InstanceTypeConfig
s {$sel:ebsConfiguration:InstanceTypeConfig' :: Maybe EbsConfiguration
ebsConfiguration = Maybe EbsConfiguration
a} :: InstanceTypeConfig)
instanceTypeConfig_bidPrice :: Lens.Lens' InstanceTypeConfig (Prelude.Maybe Prelude.Text)
instanceTypeConfig_bidPrice :: (Maybe Text -> f (Maybe Text))
-> InstanceTypeConfig -> f InstanceTypeConfig
instanceTypeConfig_bidPrice = (InstanceTypeConfig -> Maybe Text)
-> (InstanceTypeConfig -> Maybe Text -> InstanceTypeConfig)
-> Lens
InstanceTypeConfig InstanceTypeConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceTypeConfig' {Maybe Text
bidPrice :: Maybe Text
$sel:bidPrice:InstanceTypeConfig' :: InstanceTypeConfig -> Maybe Text
bidPrice} -> Maybe Text
bidPrice) (\s :: InstanceTypeConfig
s@InstanceTypeConfig' {} Maybe Text
a -> InstanceTypeConfig
s {$sel:bidPrice:InstanceTypeConfig' :: Maybe Text
bidPrice = Maybe Text
a} :: InstanceTypeConfig)
instanceTypeConfig_weightedCapacity :: Lens.Lens' InstanceTypeConfig (Prelude.Maybe Prelude.Natural)
instanceTypeConfig_weightedCapacity :: (Maybe Natural -> f (Maybe Natural))
-> InstanceTypeConfig -> f InstanceTypeConfig
instanceTypeConfig_weightedCapacity = (InstanceTypeConfig -> Maybe Natural)
-> (InstanceTypeConfig -> Maybe Natural -> InstanceTypeConfig)
-> Lens
InstanceTypeConfig
InstanceTypeConfig
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceTypeConfig' {Maybe Natural
weightedCapacity :: Maybe Natural
$sel:weightedCapacity:InstanceTypeConfig' :: InstanceTypeConfig -> Maybe Natural
weightedCapacity} -> Maybe Natural
weightedCapacity) (\s :: InstanceTypeConfig
s@InstanceTypeConfig' {} Maybe Natural
a -> InstanceTypeConfig
s {$sel:weightedCapacity:InstanceTypeConfig' :: Maybe Natural
weightedCapacity = Maybe Natural
a} :: InstanceTypeConfig)
instanceTypeConfig_configurations :: Lens.Lens' InstanceTypeConfig (Prelude.Maybe [Configuration])
instanceTypeConfig_configurations :: (Maybe [Configuration] -> f (Maybe [Configuration]))
-> InstanceTypeConfig -> f InstanceTypeConfig
instanceTypeConfig_configurations = (InstanceTypeConfig -> Maybe [Configuration])
-> (InstanceTypeConfig
-> Maybe [Configuration] -> InstanceTypeConfig)
-> Lens
InstanceTypeConfig
InstanceTypeConfig
(Maybe [Configuration])
(Maybe [Configuration])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceTypeConfig' {Maybe [Configuration]
configurations :: Maybe [Configuration]
$sel:configurations:InstanceTypeConfig' :: InstanceTypeConfig -> Maybe [Configuration]
configurations} -> Maybe [Configuration]
configurations) (\s :: InstanceTypeConfig
s@InstanceTypeConfig' {} Maybe [Configuration]
a -> InstanceTypeConfig
s {$sel:configurations:InstanceTypeConfig' :: Maybe [Configuration]
configurations = Maybe [Configuration]
a} :: InstanceTypeConfig) ((Maybe [Configuration] -> f (Maybe [Configuration]))
-> InstanceTypeConfig -> f InstanceTypeConfig)
-> ((Maybe [Configuration] -> f (Maybe [Configuration]))
-> Maybe [Configuration] -> f (Maybe [Configuration]))
-> (Maybe [Configuration] -> f (Maybe [Configuration]))
-> InstanceTypeConfig
-> f InstanceTypeConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[Configuration] [Configuration] [Configuration] [Configuration]
-> Iso
(Maybe [Configuration])
(Maybe [Configuration])
(Maybe [Configuration])
(Maybe [Configuration])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[Configuration] [Configuration] [Configuration] [Configuration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instanceTypeConfig_customAmiId :: Lens.Lens' InstanceTypeConfig (Prelude.Maybe Prelude.Text)
instanceTypeConfig_customAmiId :: (Maybe Text -> f (Maybe Text))
-> InstanceTypeConfig -> f InstanceTypeConfig
instanceTypeConfig_customAmiId = (InstanceTypeConfig -> Maybe Text)
-> (InstanceTypeConfig -> Maybe Text -> InstanceTypeConfig)
-> Lens
InstanceTypeConfig InstanceTypeConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceTypeConfig' {Maybe Text
customAmiId :: Maybe Text
$sel:customAmiId:InstanceTypeConfig' :: InstanceTypeConfig -> Maybe Text
customAmiId} -> Maybe Text
customAmiId) (\s :: InstanceTypeConfig
s@InstanceTypeConfig' {} Maybe Text
a -> InstanceTypeConfig
s {$sel:customAmiId:InstanceTypeConfig' :: Maybe Text
customAmiId = Maybe Text
a} :: InstanceTypeConfig)
instanceTypeConfig_bidPriceAsPercentageOfOnDemandPrice :: Lens.Lens' InstanceTypeConfig (Prelude.Maybe Prelude.Double)
instanceTypeConfig_bidPriceAsPercentageOfOnDemandPrice :: (Maybe Double -> f (Maybe Double))
-> InstanceTypeConfig -> f InstanceTypeConfig
instanceTypeConfig_bidPriceAsPercentageOfOnDemandPrice = (InstanceTypeConfig -> Maybe Double)
-> (InstanceTypeConfig -> Maybe Double -> InstanceTypeConfig)
-> Lens
InstanceTypeConfig InstanceTypeConfig (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceTypeConfig' {Maybe Double
bidPriceAsPercentageOfOnDemandPrice :: Maybe Double
$sel:bidPriceAsPercentageOfOnDemandPrice:InstanceTypeConfig' :: InstanceTypeConfig -> Maybe Double
bidPriceAsPercentageOfOnDemandPrice} -> Maybe Double
bidPriceAsPercentageOfOnDemandPrice) (\s :: InstanceTypeConfig
s@InstanceTypeConfig' {} Maybe Double
a -> InstanceTypeConfig
s {$sel:bidPriceAsPercentageOfOnDemandPrice:InstanceTypeConfig' :: Maybe Double
bidPriceAsPercentageOfOnDemandPrice = Maybe Double
a} :: InstanceTypeConfig)
instanceTypeConfig_instanceType :: Lens.Lens' InstanceTypeConfig Prelude.Text
instanceTypeConfig_instanceType :: (Text -> f Text) -> InstanceTypeConfig -> f InstanceTypeConfig
instanceTypeConfig_instanceType = (InstanceTypeConfig -> Text)
-> (InstanceTypeConfig -> Text -> InstanceTypeConfig)
-> Lens InstanceTypeConfig InstanceTypeConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceTypeConfig' {Text
instanceType :: Text
$sel:instanceType:InstanceTypeConfig' :: InstanceTypeConfig -> Text
instanceType} -> Text
instanceType) (\s :: InstanceTypeConfig
s@InstanceTypeConfig' {} Text
a -> InstanceTypeConfig
s {$sel:instanceType:InstanceTypeConfig' :: Text
instanceType = Text
a} :: InstanceTypeConfig)
instance Prelude.Hashable InstanceTypeConfig
instance Prelude.NFData InstanceTypeConfig
instance Core.ToJSON InstanceTypeConfig where
toJSON :: InstanceTypeConfig -> Value
toJSON InstanceTypeConfig' {Maybe Double
Maybe Natural
Maybe [Configuration]
Maybe Text
Maybe EbsConfiguration
Text
instanceType :: Text
bidPriceAsPercentageOfOnDemandPrice :: Maybe Double
customAmiId :: Maybe Text
configurations :: Maybe [Configuration]
weightedCapacity :: Maybe Natural
bidPrice :: Maybe Text
ebsConfiguration :: Maybe EbsConfiguration
$sel:instanceType:InstanceTypeConfig' :: InstanceTypeConfig -> Text
$sel:bidPriceAsPercentageOfOnDemandPrice:InstanceTypeConfig' :: InstanceTypeConfig -> Maybe Double
$sel:customAmiId:InstanceTypeConfig' :: InstanceTypeConfig -> Maybe Text
$sel:configurations:InstanceTypeConfig' :: InstanceTypeConfig -> Maybe [Configuration]
$sel:weightedCapacity:InstanceTypeConfig' :: InstanceTypeConfig -> Maybe Natural
$sel:bidPrice:InstanceTypeConfig' :: InstanceTypeConfig -> Maybe Text
$sel:ebsConfiguration:InstanceTypeConfig' :: InstanceTypeConfig -> Maybe EbsConfiguration
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"EbsConfiguration" Text -> EbsConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(EbsConfiguration -> Pair) -> Maybe EbsConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EbsConfiguration
ebsConfiguration,
(Text
"BidPrice" 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
bidPrice,
(Text
"WeightedCapacity" 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
weightedCapacity,
(Text
"Configurations" Text -> [Configuration] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([Configuration] -> Pair) -> Maybe [Configuration] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Configuration]
configurations,
(Text
"CustomAmiId" 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
customAmiId,
(Text
"BidPriceAsPercentageOfOnDemandPrice" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
bidPriceAsPercentageOfOnDemandPrice,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"InstanceType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceType)
]
)