{-# 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.VolumeSpecification where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data VolumeSpecification = VolumeSpecification'
{
VolumeSpecification -> Maybe Int
iops :: Prelude.Maybe Prelude.Int,
VolumeSpecification -> Text
volumeType :: Prelude.Text,
VolumeSpecification -> Int
sizeInGB :: Prelude.Int
}
deriving (VolumeSpecification -> VolumeSpecification -> Bool
(VolumeSpecification -> VolumeSpecification -> Bool)
-> (VolumeSpecification -> VolumeSpecification -> Bool)
-> Eq VolumeSpecification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VolumeSpecification -> VolumeSpecification -> Bool
$c/= :: VolumeSpecification -> VolumeSpecification -> Bool
== :: VolumeSpecification -> VolumeSpecification -> Bool
$c== :: VolumeSpecification -> VolumeSpecification -> Bool
Prelude.Eq, ReadPrec [VolumeSpecification]
ReadPrec VolumeSpecification
Int -> ReadS VolumeSpecification
ReadS [VolumeSpecification]
(Int -> ReadS VolumeSpecification)
-> ReadS [VolumeSpecification]
-> ReadPrec VolumeSpecification
-> ReadPrec [VolumeSpecification]
-> Read VolumeSpecification
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VolumeSpecification]
$creadListPrec :: ReadPrec [VolumeSpecification]
readPrec :: ReadPrec VolumeSpecification
$creadPrec :: ReadPrec VolumeSpecification
readList :: ReadS [VolumeSpecification]
$creadList :: ReadS [VolumeSpecification]
readsPrec :: Int -> ReadS VolumeSpecification
$creadsPrec :: Int -> ReadS VolumeSpecification
Prelude.Read, Int -> VolumeSpecification -> ShowS
[VolumeSpecification] -> ShowS
VolumeSpecification -> String
(Int -> VolumeSpecification -> ShowS)
-> (VolumeSpecification -> String)
-> ([VolumeSpecification] -> ShowS)
-> Show VolumeSpecification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VolumeSpecification] -> ShowS
$cshowList :: [VolumeSpecification] -> ShowS
show :: VolumeSpecification -> String
$cshow :: VolumeSpecification -> String
showsPrec :: Int -> VolumeSpecification -> ShowS
$cshowsPrec :: Int -> VolumeSpecification -> ShowS
Prelude.Show, (forall x. VolumeSpecification -> Rep VolumeSpecification x)
-> (forall x. Rep VolumeSpecification x -> VolumeSpecification)
-> Generic VolumeSpecification
forall x. Rep VolumeSpecification x -> VolumeSpecification
forall x. VolumeSpecification -> Rep VolumeSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VolumeSpecification x -> VolumeSpecification
$cfrom :: forall x. VolumeSpecification -> Rep VolumeSpecification x
Prelude.Generic)
newVolumeSpecification ::
Prelude.Text ->
Prelude.Int ->
VolumeSpecification
newVolumeSpecification :: Text -> Int -> VolumeSpecification
newVolumeSpecification Text
pVolumeType_ Int
pSizeInGB_ =
VolumeSpecification' :: Maybe Int -> Text -> Int -> VolumeSpecification
VolumeSpecification'
{ $sel:iops:VolumeSpecification' :: Maybe Int
iops = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:volumeType:VolumeSpecification' :: Text
volumeType = Text
pVolumeType_,
$sel:sizeInGB:VolumeSpecification' :: Int
sizeInGB = Int
pSizeInGB_
}
volumeSpecification_iops :: Lens.Lens' VolumeSpecification (Prelude.Maybe Prelude.Int)
volumeSpecification_iops :: (Maybe Int -> f (Maybe Int))
-> VolumeSpecification -> f VolumeSpecification
volumeSpecification_iops = (VolumeSpecification -> Maybe Int)
-> (VolumeSpecification -> Maybe Int -> VolumeSpecification)
-> Lens
VolumeSpecification VolumeSpecification (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VolumeSpecification' {Maybe Int
iops :: Maybe Int
$sel:iops:VolumeSpecification' :: VolumeSpecification -> Maybe Int
iops} -> Maybe Int
iops) (\s :: VolumeSpecification
s@VolumeSpecification' {} Maybe Int
a -> VolumeSpecification
s {$sel:iops:VolumeSpecification' :: Maybe Int
iops = Maybe Int
a} :: VolumeSpecification)
volumeSpecification_volumeType :: Lens.Lens' VolumeSpecification Prelude.Text
volumeSpecification_volumeType :: (Text -> f Text) -> VolumeSpecification -> f VolumeSpecification
volumeSpecification_volumeType = (VolumeSpecification -> Text)
-> (VolumeSpecification -> Text -> VolumeSpecification)
-> Lens VolumeSpecification VolumeSpecification Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VolumeSpecification' {Text
volumeType :: Text
$sel:volumeType:VolumeSpecification' :: VolumeSpecification -> Text
volumeType} -> Text
volumeType) (\s :: VolumeSpecification
s@VolumeSpecification' {} Text
a -> VolumeSpecification
s {$sel:volumeType:VolumeSpecification' :: Text
volumeType = Text
a} :: VolumeSpecification)
volumeSpecification_sizeInGB :: Lens.Lens' VolumeSpecification Prelude.Int
volumeSpecification_sizeInGB :: (Int -> f Int) -> VolumeSpecification -> f VolumeSpecification
volumeSpecification_sizeInGB = (VolumeSpecification -> Int)
-> (VolumeSpecification -> Int -> VolumeSpecification)
-> Lens VolumeSpecification VolumeSpecification Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VolumeSpecification' {Int
sizeInGB :: Int
$sel:sizeInGB:VolumeSpecification' :: VolumeSpecification -> Int
sizeInGB} -> Int
sizeInGB) (\s :: VolumeSpecification
s@VolumeSpecification' {} Int
a -> VolumeSpecification
s {$sel:sizeInGB:VolumeSpecification' :: Int
sizeInGB = Int
a} :: VolumeSpecification)
instance Core.FromJSON VolumeSpecification where
parseJSON :: Value -> Parser VolumeSpecification
parseJSON =
String
-> (Object -> Parser VolumeSpecification)
-> Value
-> Parser VolumeSpecification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"VolumeSpecification"
( \Object
x ->
Maybe Int -> Text -> Int -> VolumeSpecification
VolumeSpecification'
(Maybe Int -> Text -> Int -> VolumeSpecification)
-> Parser (Maybe Int)
-> Parser (Text -> Int -> VolumeSpecification)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Iops")
Parser (Text -> Int -> VolumeSpecification)
-> Parser Text -> Parser (Int -> VolumeSpecification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"VolumeType")
Parser (Int -> VolumeSpecification)
-> Parser Int -> Parser VolumeSpecification
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SizeInGB")
)
instance Prelude.Hashable VolumeSpecification
instance Prelude.NFData VolumeSpecification
instance Core.ToJSON VolumeSpecification where
toJSON :: VolumeSpecification -> Value
toJSON VolumeSpecification' {Int
Maybe Int
Text
sizeInGB :: Int
volumeType :: Text
iops :: Maybe Int
$sel:sizeInGB:VolumeSpecification' :: VolumeSpecification -> Int
$sel:volumeType:VolumeSpecification' :: VolumeSpecification -> Text
$sel:iops:VolumeSpecification' :: VolumeSpecification -> Maybe Int
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Iops" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
iops,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"VolumeType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
volumeType),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SizeInGB" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
sizeInGB)
]
)