{-# 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.AutoScaling.Types.BlockDeviceMapping where
import Amazonka.AutoScaling.Types.Ebs
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data BlockDeviceMapping = BlockDeviceMapping'
{
BlockDeviceMapping -> Maybe Text
virtualName :: Prelude.Maybe Prelude.Text,
BlockDeviceMapping -> Maybe Bool
noDevice :: Prelude.Maybe Prelude.Bool,
BlockDeviceMapping -> Maybe Ebs
ebs :: Prelude.Maybe Ebs,
BlockDeviceMapping -> Text
deviceName :: 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 ::
Prelude.Text ->
BlockDeviceMapping
newBlockDeviceMapping :: Text -> BlockDeviceMapping
newBlockDeviceMapping Text
pDeviceName_ =
BlockDeviceMapping' :: Maybe Text -> Maybe Bool -> Maybe Ebs -> Text -> BlockDeviceMapping
BlockDeviceMapping'
{ $sel:virtualName:BlockDeviceMapping' :: Maybe Text
virtualName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:noDevice:BlockDeviceMapping' :: Maybe Bool
noDevice = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:ebs:BlockDeviceMapping' :: Maybe Ebs
ebs = Maybe Ebs
forall a. Maybe a
Prelude.Nothing,
$sel:deviceName:BlockDeviceMapping' :: Text
deviceName = Text
pDeviceName_
}
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.Bool)
blockDeviceMapping_noDevice :: (Maybe Bool -> f (Maybe Bool))
-> BlockDeviceMapping -> f BlockDeviceMapping
blockDeviceMapping_noDevice = (BlockDeviceMapping -> Maybe Bool)
-> (BlockDeviceMapping -> Maybe Bool -> BlockDeviceMapping)
-> Lens
BlockDeviceMapping BlockDeviceMapping (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BlockDeviceMapping' {Maybe Bool
noDevice :: Maybe Bool
$sel:noDevice:BlockDeviceMapping' :: BlockDeviceMapping -> Maybe Bool
noDevice} -> Maybe Bool
noDevice) (\s :: BlockDeviceMapping
s@BlockDeviceMapping' {} Maybe Bool
a -> BlockDeviceMapping
s {$sel:noDevice:BlockDeviceMapping' :: Maybe Bool
noDevice = Maybe Bool
a} :: BlockDeviceMapping)
blockDeviceMapping_ebs :: Lens.Lens' BlockDeviceMapping (Prelude.Maybe Ebs)
blockDeviceMapping_ebs :: (Maybe Ebs -> f (Maybe Ebs))
-> BlockDeviceMapping -> f BlockDeviceMapping
blockDeviceMapping_ebs = (BlockDeviceMapping -> Maybe Ebs)
-> (BlockDeviceMapping -> Maybe Ebs -> BlockDeviceMapping)
-> Lens
BlockDeviceMapping BlockDeviceMapping (Maybe Ebs) (Maybe Ebs)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BlockDeviceMapping' {Maybe Ebs
ebs :: Maybe Ebs
$sel:ebs:BlockDeviceMapping' :: BlockDeviceMapping -> Maybe Ebs
ebs} -> Maybe Ebs
ebs) (\s :: BlockDeviceMapping
s@BlockDeviceMapping' {} Maybe Ebs
a -> BlockDeviceMapping
s {$sel:ebs:BlockDeviceMapping' :: Maybe Ebs
ebs = Maybe Ebs
a} :: BlockDeviceMapping)
blockDeviceMapping_deviceName :: Lens.Lens' BlockDeviceMapping Prelude.Text
blockDeviceMapping_deviceName :: (Text -> f Text) -> BlockDeviceMapping -> f BlockDeviceMapping
blockDeviceMapping_deviceName = (BlockDeviceMapping -> Text)
-> (BlockDeviceMapping -> Text -> BlockDeviceMapping)
-> Lens BlockDeviceMapping BlockDeviceMapping Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BlockDeviceMapping' {Text
deviceName :: Text
$sel:deviceName:BlockDeviceMapping' :: BlockDeviceMapping -> Text
deviceName} -> Text
deviceName) (\s :: BlockDeviceMapping
s@BlockDeviceMapping' {} Text
a -> BlockDeviceMapping
s {$sel:deviceName:BlockDeviceMapping' :: Text
deviceName = Text
a} :: BlockDeviceMapping)
instance Core.FromXML BlockDeviceMapping where
parseXML :: [Node] -> Either String BlockDeviceMapping
parseXML [Node]
x =
Maybe Text -> Maybe Bool -> Maybe Ebs -> Text -> BlockDeviceMapping
BlockDeviceMapping'
(Maybe Text
-> Maybe Bool -> Maybe Ebs -> Text -> BlockDeviceMapping)
-> Either String (Maybe Text)
-> Either
String (Maybe Bool -> Maybe Ebs -> Text -> BlockDeviceMapping)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"VirtualName")
Either
String (Maybe Bool -> Maybe Ebs -> Text -> BlockDeviceMapping)
-> Either String (Maybe Bool)
-> Either String (Maybe Ebs -> Text -> BlockDeviceMapping)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"NoDevice")
Either String (Maybe Ebs -> Text -> BlockDeviceMapping)
-> Either String (Maybe Ebs)
-> Either String (Text -> BlockDeviceMapping)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Ebs)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Ebs")
Either String (Text -> BlockDeviceMapping)
-> Either String Text -> Either String BlockDeviceMapping
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"DeviceName")
instance Prelude.Hashable BlockDeviceMapping
instance Prelude.NFData BlockDeviceMapping
instance Core.ToQuery BlockDeviceMapping where
toQuery :: BlockDeviceMapping -> QueryString
toQuery BlockDeviceMapping' {Maybe Bool
Maybe Text
Maybe Ebs
Text
deviceName :: Text
ebs :: Maybe Ebs
noDevice :: Maybe Bool
virtualName :: Maybe Text
$sel:deviceName:BlockDeviceMapping' :: BlockDeviceMapping -> Text
$sel:ebs:BlockDeviceMapping' :: BlockDeviceMapping -> Maybe Ebs
$sel:noDevice:BlockDeviceMapping' :: BlockDeviceMapping -> Maybe Bool
$sel:virtualName:BlockDeviceMapping' :: BlockDeviceMapping -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"VirtualName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
virtualName,
ByteString
"NoDevice" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
noDevice,
ByteString
"Ebs" ByteString -> Maybe Ebs -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Ebs
ebs,
ByteString
"DeviceName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
deviceName
]