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