{-# 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.BlockDeviceMapping where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpsWorks.Types.EbsBlockDevice
import qualified Amazonka.Prelude as Prelude
data BlockDeviceMapping = BlockDeviceMapping'
{
BlockDeviceMapping -> Maybe Text
virtualName :: Prelude.Maybe Prelude.Text,
BlockDeviceMapping -> Maybe Text
noDevice :: Prelude.Maybe Prelude.Text,
BlockDeviceMapping -> Maybe EbsBlockDevice
ebs :: Prelude.Maybe EbsBlockDevice,
BlockDeviceMapping -> Maybe Text
deviceName :: Prelude.Maybe Prelude.Text
}
deriving (BlockDeviceMapping -> BlockDeviceMapping -> Bool
(BlockDeviceMapping -> BlockDeviceMapping -> Bool)
-> (BlockDeviceMapping -> BlockDeviceMapping -> Bool)
-> Eq BlockDeviceMapping
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BlockDeviceMapping -> BlockDeviceMapping -> Bool
$c/= :: BlockDeviceMapping -> BlockDeviceMapping -> Bool
== :: BlockDeviceMapping -> BlockDeviceMapping -> Bool
$c== :: BlockDeviceMapping -> BlockDeviceMapping -> Bool
Prelude.Eq, ReadPrec [BlockDeviceMapping]
ReadPrec BlockDeviceMapping
Int -> ReadS BlockDeviceMapping
ReadS [BlockDeviceMapping]
(Int -> ReadS BlockDeviceMapping)
-> ReadS [BlockDeviceMapping]
-> ReadPrec BlockDeviceMapping
-> ReadPrec [BlockDeviceMapping]
-> Read BlockDeviceMapping
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BlockDeviceMapping]
$creadListPrec :: ReadPrec [BlockDeviceMapping]
readPrec :: ReadPrec BlockDeviceMapping
$creadPrec :: ReadPrec BlockDeviceMapping
readList :: ReadS [BlockDeviceMapping]
$creadList :: ReadS [BlockDeviceMapping]
readsPrec :: Int -> ReadS BlockDeviceMapping
$creadsPrec :: Int -> ReadS BlockDeviceMapping
Prelude.Read, Int -> BlockDeviceMapping -> ShowS
[BlockDeviceMapping] -> ShowS
BlockDeviceMapping -> String
(Int -> BlockDeviceMapping -> ShowS)
-> (BlockDeviceMapping -> String)
-> ([BlockDeviceMapping] -> ShowS)
-> Show BlockDeviceMapping
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BlockDeviceMapping] -> ShowS
$cshowList :: [BlockDeviceMapping] -> ShowS
show :: BlockDeviceMapping -> String
$cshow :: BlockDeviceMapping -> String
showsPrec :: Int -> BlockDeviceMapping -> ShowS
$cshowsPrec :: Int -> BlockDeviceMapping -> ShowS
Prelude.Show, (forall x. BlockDeviceMapping -> Rep BlockDeviceMapping x)
-> (forall x. Rep BlockDeviceMapping x -> BlockDeviceMapping)
-> Generic BlockDeviceMapping
forall x. Rep BlockDeviceMapping x -> BlockDeviceMapping
forall x. BlockDeviceMapping -> Rep BlockDeviceMapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BlockDeviceMapping x -> BlockDeviceMapping
$cfrom :: forall x. BlockDeviceMapping -> Rep BlockDeviceMapping x
Prelude.Generic)
newBlockDeviceMapping ::
BlockDeviceMapping
newBlockDeviceMapping :: BlockDeviceMapping
newBlockDeviceMapping =
BlockDeviceMapping' :: Maybe Text
-> Maybe Text
-> Maybe EbsBlockDevice
-> Maybe Text
-> BlockDeviceMapping
BlockDeviceMapping'
{ $sel:virtualName:BlockDeviceMapping' :: Maybe Text
virtualName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:noDevice:BlockDeviceMapping' :: Maybe Text
noDevice = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:ebs:BlockDeviceMapping' :: Maybe EbsBlockDevice
ebs = Maybe EbsBlockDevice
forall a. Maybe a
Prelude.Nothing,
$sel:deviceName:BlockDeviceMapping' :: Maybe Text
deviceName = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
blockDeviceMapping_virtualName :: Lens.Lens' BlockDeviceMapping (Prelude.Maybe Prelude.Text)
blockDeviceMapping_virtualName :: (Maybe Text -> f (Maybe Text))
-> BlockDeviceMapping -> f BlockDeviceMapping
blockDeviceMapping_virtualName = (BlockDeviceMapping -> Maybe Text)
-> (BlockDeviceMapping -> Maybe Text -> BlockDeviceMapping)
-> Lens
BlockDeviceMapping BlockDeviceMapping (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BlockDeviceMapping' {Maybe Text
virtualName :: Maybe Text
$sel:virtualName:BlockDeviceMapping' :: BlockDeviceMapping -> Maybe Text
virtualName} -> Maybe Text
virtualName) (\s :: BlockDeviceMapping
s@BlockDeviceMapping' {} Maybe Text
a -> BlockDeviceMapping
s {$sel:virtualName:BlockDeviceMapping' :: Maybe Text
virtualName = Maybe Text
a} :: BlockDeviceMapping)
blockDeviceMapping_noDevice :: Lens.Lens' BlockDeviceMapping (Prelude.Maybe Prelude.Text)
blockDeviceMapping_noDevice :: (Maybe Text -> f (Maybe Text))
-> BlockDeviceMapping -> f BlockDeviceMapping
blockDeviceMapping_noDevice = (BlockDeviceMapping -> Maybe Text)
-> (BlockDeviceMapping -> Maybe Text -> BlockDeviceMapping)
-> Lens
BlockDeviceMapping BlockDeviceMapping (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BlockDeviceMapping' {Maybe Text
noDevice :: Maybe Text
$sel:noDevice:BlockDeviceMapping' :: BlockDeviceMapping -> Maybe Text
noDevice} -> Maybe Text
noDevice) (\s :: BlockDeviceMapping
s@BlockDeviceMapping' {} Maybe Text
a -> BlockDeviceMapping
s {$sel:noDevice:BlockDeviceMapping' :: Maybe Text
noDevice = Maybe Text
a} :: BlockDeviceMapping)
blockDeviceMapping_ebs :: Lens.Lens' BlockDeviceMapping (Prelude.Maybe EbsBlockDevice)
blockDeviceMapping_ebs :: (Maybe EbsBlockDevice -> f (Maybe EbsBlockDevice))
-> BlockDeviceMapping -> f BlockDeviceMapping
blockDeviceMapping_ebs = (BlockDeviceMapping -> Maybe EbsBlockDevice)
-> (BlockDeviceMapping
-> Maybe EbsBlockDevice -> BlockDeviceMapping)
-> Lens
BlockDeviceMapping
BlockDeviceMapping
(Maybe EbsBlockDevice)
(Maybe EbsBlockDevice)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BlockDeviceMapping' {Maybe EbsBlockDevice
ebs :: Maybe EbsBlockDevice
$sel:ebs:BlockDeviceMapping' :: BlockDeviceMapping -> Maybe EbsBlockDevice
ebs} -> Maybe EbsBlockDevice
ebs) (\s :: BlockDeviceMapping
s@BlockDeviceMapping' {} Maybe EbsBlockDevice
a -> BlockDeviceMapping
s {$sel:ebs:BlockDeviceMapping' :: Maybe EbsBlockDevice
ebs = Maybe EbsBlockDevice
a} :: BlockDeviceMapping)
blockDeviceMapping_deviceName :: Lens.Lens' BlockDeviceMapping (Prelude.Maybe Prelude.Text)
blockDeviceMapping_deviceName :: (Maybe Text -> f (Maybe Text))
-> BlockDeviceMapping -> f BlockDeviceMapping
blockDeviceMapping_deviceName = (BlockDeviceMapping -> Maybe Text)
-> (BlockDeviceMapping -> Maybe Text -> BlockDeviceMapping)
-> Lens
BlockDeviceMapping BlockDeviceMapping (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BlockDeviceMapping' {Maybe Text
deviceName :: Maybe Text
$sel:deviceName:BlockDeviceMapping' :: BlockDeviceMapping -> Maybe Text
deviceName} -> Maybe Text
deviceName) (\s :: BlockDeviceMapping
s@BlockDeviceMapping' {} Maybe Text
a -> BlockDeviceMapping
s {$sel:deviceName:BlockDeviceMapping' :: Maybe Text
deviceName = Maybe Text
a} :: BlockDeviceMapping)
instance Core.FromJSON BlockDeviceMapping where
parseJSON :: Value -> Parser BlockDeviceMapping
parseJSON =
String
-> (Object -> Parser BlockDeviceMapping)
-> Value
-> Parser BlockDeviceMapping
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"BlockDeviceMapping"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe EbsBlockDevice
-> Maybe Text
-> BlockDeviceMapping
BlockDeviceMapping'
(Maybe Text
-> Maybe Text
-> Maybe EbsBlockDevice
-> Maybe Text
-> BlockDeviceMapping)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe EbsBlockDevice -> Maybe Text -> BlockDeviceMapping)
forall (f :: * -> *) a b. Functor 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
"VirtualName")
Parser
(Maybe Text
-> Maybe EbsBlockDevice -> Maybe Text -> BlockDeviceMapping)
-> Parser (Maybe Text)
-> Parser
(Maybe EbsBlockDevice -> Maybe Text -> BlockDeviceMapping)
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
"NoDevice")
Parser (Maybe EbsBlockDevice -> Maybe Text -> BlockDeviceMapping)
-> Parser (Maybe EbsBlockDevice)
-> Parser (Maybe Text -> BlockDeviceMapping)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EbsBlockDevice)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Ebs")
Parser (Maybe Text -> BlockDeviceMapping)
-> Parser (Maybe Text) -> Parser BlockDeviceMapping
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
"DeviceName")
)
instance Prelude.Hashable BlockDeviceMapping
instance Prelude.NFData BlockDeviceMapping
instance Core.ToJSON BlockDeviceMapping where
toJSON :: BlockDeviceMapping -> Value
toJSON BlockDeviceMapping' {Maybe Text
Maybe EbsBlockDevice
deviceName :: Maybe Text
ebs :: Maybe EbsBlockDevice
noDevice :: Maybe Text
virtualName :: Maybe Text
$sel:deviceName:BlockDeviceMapping' :: BlockDeviceMapping -> Maybe Text
$sel:ebs:BlockDeviceMapping' :: BlockDeviceMapping -> Maybe EbsBlockDevice
$sel:noDevice:BlockDeviceMapping' :: BlockDeviceMapping -> Maybe Text
$sel:virtualName:BlockDeviceMapping' :: BlockDeviceMapping -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"VirtualName" 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
virtualName,
(Text
"NoDevice" 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
noDevice,
(Text
"Ebs" Text -> EbsBlockDevice -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (EbsBlockDevice -> Pair) -> Maybe EbsBlockDevice -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EbsBlockDevice
ebs,
(Text
"DeviceName" 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
deviceName
]
)