{-# 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.OpsWorks.Types.EbsBlockDevice where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpsWorks.Types.VolumeType
import qualified Amazonka.Prelude as Prelude
data EbsBlockDevice = EbsBlockDevice'
{
EbsBlockDevice -> Maybe Bool
deleteOnTermination :: Prelude.Maybe Prelude.Bool,
EbsBlockDevice -> Maybe Int
volumeSize :: Prelude.Maybe Prelude.Int,
EbsBlockDevice -> Maybe Int
iops :: Prelude.Maybe Prelude.Int,
EbsBlockDevice -> Maybe VolumeType
volumeType :: Prelude.Maybe VolumeType,
EbsBlockDevice -> Maybe Text
snapshotId :: Prelude.Maybe Prelude.Text
}
deriving (EbsBlockDevice -> EbsBlockDevice -> Bool
(EbsBlockDevice -> EbsBlockDevice -> Bool)
-> (EbsBlockDevice -> EbsBlockDevice -> Bool) -> Eq EbsBlockDevice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EbsBlockDevice -> EbsBlockDevice -> Bool
$c/= :: EbsBlockDevice -> EbsBlockDevice -> Bool
== :: EbsBlockDevice -> EbsBlockDevice -> Bool
$c== :: EbsBlockDevice -> EbsBlockDevice -> Bool
Prelude.Eq, ReadPrec [EbsBlockDevice]
ReadPrec EbsBlockDevice
Int -> ReadS EbsBlockDevice
ReadS [EbsBlockDevice]
(Int -> ReadS EbsBlockDevice)
-> ReadS [EbsBlockDevice]
-> ReadPrec EbsBlockDevice
-> ReadPrec [EbsBlockDevice]
-> Read EbsBlockDevice
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EbsBlockDevice]
$creadListPrec :: ReadPrec [EbsBlockDevice]
readPrec :: ReadPrec EbsBlockDevice
$creadPrec :: ReadPrec EbsBlockDevice
readList :: ReadS [EbsBlockDevice]
$creadList :: ReadS [EbsBlockDevice]
readsPrec :: Int -> ReadS EbsBlockDevice
$creadsPrec :: Int -> ReadS EbsBlockDevice
Prelude.Read, Int -> EbsBlockDevice -> ShowS
[EbsBlockDevice] -> ShowS
EbsBlockDevice -> String
(Int -> EbsBlockDevice -> ShowS)
-> (EbsBlockDevice -> String)
-> ([EbsBlockDevice] -> ShowS)
-> Show EbsBlockDevice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EbsBlockDevice] -> ShowS
$cshowList :: [EbsBlockDevice] -> ShowS
show :: EbsBlockDevice -> String
$cshow :: EbsBlockDevice -> String
showsPrec :: Int -> EbsBlockDevice -> ShowS
$cshowsPrec :: Int -> EbsBlockDevice -> ShowS
Prelude.Show, (forall x. EbsBlockDevice -> Rep EbsBlockDevice x)
-> (forall x. Rep EbsBlockDevice x -> EbsBlockDevice)
-> Generic EbsBlockDevice
forall x. Rep EbsBlockDevice x -> EbsBlockDevice
forall x. EbsBlockDevice -> Rep EbsBlockDevice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EbsBlockDevice x -> EbsBlockDevice
$cfrom :: forall x. EbsBlockDevice -> Rep EbsBlockDevice x
Prelude.Generic)
newEbsBlockDevice ::
EbsBlockDevice
newEbsBlockDevice :: EbsBlockDevice
newEbsBlockDevice =
EbsBlockDevice' :: Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe VolumeType
-> Maybe Text
-> EbsBlockDevice
EbsBlockDevice'
{ $sel:deleteOnTermination:EbsBlockDevice' :: Maybe Bool
deleteOnTermination =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:volumeSize:EbsBlockDevice' :: Maybe Int
volumeSize = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:iops:EbsBlockDevice' :: Maybe Int
iops = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:volumeType:EbsBlockDevice' :: Maybe VolumeType
volumeType = Maybe VolumeType
forall a. Maybe a
Prelude.Nothing,
$sel:snapshotId:EbsBlockDevice' :: Maybe Text
snapshotId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
ebsBlockDevice_deleteOnTermination :: Lens.Lens' EbsBlockDevice (Prelude.Maybe Prelude.Bool)
ebsBlockDevice_deleteOnTermination :: (Maybe Bool -> f (Maybe Bool))
-> EbsBlockDevice -> f EbsBlockDevice
ebsBlockDevice_deleteOnTermination = (EbsBlockDevice -> Maybe Bool)
-> (EbsBlockDevice -> Maybe Bool -> EbsBlockDevice)
-> Lens EbsBlockDevice EbsBlockDevice (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EbsBlockDevice' {Maybe Bool
deleteOnTermination :: Maybe Bool
$sel:deleteOnTermination:EbsBlockDevice' :: EbsBlockDevice -> Maybe Bool
deleteOnTermination} -> Maybe Bool
deleteOnTermination) (\s :: EbsBlockDevice
s@EbsBlockDevice' {} Maybe Bool
a -> EbsBlockDevice
s {$sel:deleteOnTermination:EbsBlockDevice' :: Maybe Bool
deleteOnTermination = Maybe Bool
a} :: EbsBlockDevice)
ebsBlockDevice_volumeSize :: Lens.Lens' EbsBlockDevice (Prelude.Maybe Prelude.Int)
ebsBlockDevice_volumeSize :: (Maybe Int -> f (Maybe Int)) -> EbsBlockDevice -> f EbsBlockDevice
ebsBlockDevice_volumeSize = (EbsBlockDevice -> Maybe Int)
-> (EbsBlockDevice -> Maybe Int -> EbsBlockDevice)
-> Lens EbsBlockDevice EbsBlockDevice (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EbsBlockDevice' {Maybe Int
volumeSize :: Maybe Int
$sel:volumeSize:EbsBlockDevice' :: EbsBlockDevice -> Maybe Int
volumeSize} -> Maybe Int
volumeSize) (\s :: EbsBlockDevice
s@EbsBlockDevice' {} Maybe Int
a -> EbsBlockDevice
s {$sel:volumeSize:EbsBlockDevice' :: Maybe Int
volumeSize = Maybe Int
a} :: EbsBlockDevice)
ebsBlockDevice_iops :: Lens.Lens' EbsBlockDevice (Prelude.Maybe Prelude.Int)
ebsBlockDevice_iops :: (Maybe Int -> f (Maybe Int)) -> EbsBlockDevice -> f EbsBlockDevice
ebsBlockDevice_iops = (EbsBlockDevice -> Maybe Int)
-> (EbsBlockDevice -> Maybe Int -> EbsBlockDevice)
-> Lens EbsBlockDevice EbsBlockDevice (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EbsBlockDevice' {Maybe Int
iops :: Maybe Int
$sel:iops:EbsBlockDevice' :: EbsBlockDevice -> Maybe Int
iops} -> Maybe Int
iops) (\s :: EbsBlockDevice
s@EbsBlockDevice' {} Maybe Int
a -> EbsBlockDevice
s {$sel:iops:EbsBlockDevice' :: Maybe Int
iops = Maybe Int
a} :: EbsBlockDevice)
ebsBlockDevice_volumeType :: Lens.Lens' EbsBlockDevice (Prelude.Maybe VolumeType)
ebsBlockDevice_volumeType :: (Maybe VolumeType -> f (Maybe VolumeType))
-> EbsBlockDevice -> f EbsBlockDevice
ebsBlockDevice_volumeType = (EbsBlockDevice -> Maybe VolumeType)
-> (EbsBlockDevice -> Maybe VolumeType -> EbsBlockDevice)
-> Lens
EbsBlockDevice EbsBlockDevice (Maybe VolumeType) (Maybe VolumeType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EbsBlockDevice' {Maybe VolumeType
volumeType :: Maybe VolumeType
$sel:volumeType:EbsBlockDevice' :: EbsBlockDevice -> Maybe VolumeType
volumeType} -> Maybe VolumeType
volumeType) (\s :: EbsBlockDevice
s@EbsBlockDevice' {} Maybe VolumeType
a -> EbsBlockDevice
s {$sel:volumeType:EbsBlockDevice' :: Maybe VolumeType
volumeType = Maybe VolumeType
a} :: EbsBlockDevice)
ebsBlockDevice_snapshotId :: Lens.Lens' EbsBlockDevice (Prelude.Maybe Prelude.Text)
ebsBlockDevice_snapshotId :: (Maybe Text -> f (Maybe Text))
-> EbsBlockDevice -> f EbsBlockDevice
ebsBlockDevice_snapshotId = (EbsBlockDevice -> Maybe Text)
-> (EbsBlockDevice -> Maybe Text -> EbsBlockDevice)
-> Lens EbsBlockDevice EbsBlockDevice (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EbsBlockDevice' {Maybe Text
snapshotId :: Maybe Text
$sel:snapshotId:EbsBlockDevice' :: EbsBlockDevice -> Maybe Text
snapshotId} -> Maybe Text
snapshotId) (\s :: EbsBlockDevice
s@EbsBlockDevice' {} Maybe Text
a -> EbsBlockDevice
s {$sel:snapshotId:EbsBlockDevice' :: Maybe Text
snapshotId = Maybe Text
a} :: EbsBlockDevice)
instance Core.FromJSON EbsBlockDevice where
parseJSON :: Value -> Parser EbsBlockDevice
parseJSON =
String
-> (Object -> Parser EbsBlockDevice)
-> Value
-> Parser EbsBlockDevice
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"EbsBlockDevice"
( \Object
x ->
Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe VolumeType
-> Maybe Text
-> EbsBlockDevice
EbsBlockDevice'
(Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe VolumeType
-> Maybe Text
-> EbsBlockDevice)
-> Parser (Maybe Bool)
-> Parser
(Maybe Int
-> Maybe Int -> Maybe VolumeType -> Maybe Text -> EbsBlockDevice)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DeleteOnTermination")
Parser
(Maybe Int
-> Maybe Int -> Maybe VolumeType -> Maybe Text -> EbsBlockDevice)
-> Parser (Maybe Int)
-> Parser
(Maybe Int -> Maybe VolumeType -> Maybe Text -> EbsBlockDevice)
forall (f :: * -> *) a b. Applicative f => 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
"VolumeSize")
Parser
(Maybe Int -> Maybe VolumeType -> Maybe Text -> EbsBlockDevice)
-> Parser (Maybe Int)
-> Parser (Maybe VolumeType -> Maybe Text -> EbsBlockDevice)
forall (f :: * -> *) a b. Applicative f => 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 (Maybe VolumeType -> Maybe Text -> EbsBlockDevice)
-> Parser (Maybe VolumeType)
-> Parser (Maybe Text -> EbsBlockDevice)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe VolumeType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"VolumeType")
Parser (Maybe Text -> EbsBlockDevice)
-> Parser (Maybe Text) -> Parser EbsBlockDevice
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
"SnapshotId")
)
instance Prelude.Hashable EbsBlockDevice
instance Prelude.NFData EbsBlockDevice
instance Core.ToJSON EbsBlockDevice where
toJSON :: EbsBlockDevice -> Value
toJSON EbsBlockDevice' {Maybe Bool
Maybe Int
Maybe Text
Maybe VolumeType
snapshotId :: Maybe Text
volumeType :: Maybe VolumeType
iops :: Maybe Int
volumeSize :: Maybe Int
deleteOnTermination :: Maybe Bool
$sel:snapshotId:EbsBlockDevice' :: EbsBlockDevice -> Maybe Text
$sel:volumeType:EbsBlockDevice' :: EbsBlockDevice -> Maybe VolumeType
$sel:iops:EbsBlockDevice' :: EbsBlockDevice -> Maybe Int
$sel:volumeSize:EbsBlockDevice' :: EbsBlockDevice -> Maybe Int
$sel:deleteOnTermination:EbsBlockDevice' :: EbsBlockDevice -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DeleteOnTermination" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
deleteOnTermination,
(Text
"VolumeSize" 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
volumeSize,
(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,
(Text
"VolumeType" Text -> VolumeType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (VolumeType -> Pair) -> Maybe VolumeType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VolumeType
volumeType,
(Text
"SnapshotId" 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
snapshotId
]
)