{-# 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.SMS.Types.VmServerAddress where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data VmServerAddress = VmServerAddress'
{
VmServerAddress -> Maybe Text
vmManagerId :: Prelude.Maybe Prelude.Text,
VmServerAddress -> Maybe Text
vmId :: Prelude.Maybe Prelude.Text
}
deriving (VmServerAddress -> VmServerAddress -> Bool
(VmServerAddress -> VmServerAddress -> Bool)
-> (VmServerAddress -> VmServerAddress -> Bool)
-> Eq VmServerAddress
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VmServerAddress -> VmServerAddress -> Bool
$c/= :: VmServerAddress -> VmServerAddress -> Bool
== :: VmServerAddress -> VmServerAddress -> Bool
$c== :: VmServerAddress -> VmServerAddress -> Bool
Prelude.Eq, ReadPrec [VmServerAddress]
ReadPrec VmServerAddress
Int -> ReadS VmServerAddress
ReadS [VmServerAddress]
(Int -> ReadS VmServerAddress)
-> ReadS [VmServerAddress]
-> ReadPrec VmServerAddress
-> ReadPrec [VmServerAddress]
-> Read VmServerAddress
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VmServerAddress]
$creadListPrec :: ReadPrec [VmServerAddress]
readPrec :: ReadPrec VmServerAddress
$creadPrec :: ReadPrec VmServerAddress
readList :: ReadS [VmServerAddress]
$creadList :: ReadS [VmServerAddress]
readsPrec :: Int -> ReadS VmServerAddress
$creadsPrec :: Int -> ReadS VmServerAddress
Prelude.Read, Int -> VmServerAddress -> ShowS
[VmServerAddress] -> ShowS
VmServerAddress -> String
(Int -> VmServerAddress -> ShowS)
-> (VmServerAddress -> String)
-> ([VmServerAddress] -> ShowS)
-> Show VmServerAddress
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VmServerAddress] -> ShowS
$cshowList :: [VmServerAddress] -> ShowS
show :: VmServerAddress -> String
$cshow :: VmServerAddress -> String
showsPrec :: Int -> VmServerAddress -> ShowS
$cshowsPrec :: Int -> VmServerAddress -> ShowS
Prelude.Show, (forall x. VmServerAddress -> Rep VmServerAddress x)
-> (forall x. Rep VmServerAddress x -> VmServerAddress)
-> Generic VmServerAddress
forall x. Rep VmServerAddress x -> VmServerAddress
forall x. VmServerAddress -> Rep VmServerAddress x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VmServerAddress x -> VmServerAddress
$cfrom :: forall x. VmServerAddress -> Rep VmServerAddress x
Prelude.Generic)
newVmServerAddress ::
VmServerAddress
newVmServerAddress :: VmServerAddress
newVmServerAddress =
VmServerAddress' :: Maybe Text -> Maybe Text -> VmServerAddress
VmServerAddress'
{ $sel:vmManagerId:VmServerAddress' :: Maybe Text
vmManagerId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:vmId:VmServerAddress' :: Maybe Text
vmId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
vmServerAddress_vmManagerId :: Lens.Lens' VmServerAddress (Prelude.Maybe Prelude.Text)
vmServerAddress_vmManagerId :: (Maybe Text -> f (Maybe Text))
-> VmServerAddress -> f VmServerAddress
vmServerAddress_vmManagerId = (VmServerAddress -> Maybe Text)
-> (VmServerAddress -> Maybe Text -> VmServerAddress)
-> Lens VmServerAddress VmServerAddress (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VmServerAddress' {Maybe Text
vmManagerId :: Maybe Text
$sel:vmManagerId:VmServerAddress' :: VmServerAddress -> Maybe Text
vmManagerId} -> Maybe Text
vmManagerId) (\s :: VmServerAddress
s@VmServerAddress' {} Maybe Text
a -> VmServerAddress
s {$sel:vmManagerId:VmServerAddress' :: Maybe Text
vmManagerId = Maybe Text
a} :: VmServerAddress)
vmServerAddress_vmId :: Lens.Lens' VmServerAddress (Prelude.Maybe Prelude.Text)
vmServerAddress_vmId :: (Maybe Text -> f (Maybe Text))
-> VmServerAddress -> f VmServerAddress
vmServerAddress_vmId = (VmServerAddress -> Maybe Text)
-> (VmServerAddress -> Maybe Text -> VmServerAddress)
-> Lens VmServerAddress VmServerAddress (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VmServerAddress' {Maybe Text
vmId :: Maybe Text
$sel:vmId:VmServerAddress' :: VmServerAddress -> Maybe Text
vmId} -> Maybe Text
vmId) (\s :: VmServerAddress
s@VmServerAddress' {} Maybe Text
a -> VmServerAddress
s {$sel:vmId:VmServerAddress' :: Maybe Text
vmId = Maybe Text
a} :: VmServerAddress)
instance Core.FromJSON VmServerAddress where
parseJSON :: Value -> Parser VmServerAddress
parseJSON =
String
-> (Object -> Parser VmServerAddress)
-> Value
-> Parser VmServerAddress
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"VmServerAddress"
( \Object
x ->
Maybe Text -> Maybe Text -> VmServerAddress
VmServerAddress'
(Maybe Text -> Maybe Text -> VmServerAddress)
-> Parser (Maybe Text) -> Parser (Maybe Text -> VmServerAddress)
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
"vmManagerId")
Parser (Maybe Text -> VmServerAddress)
-> Parser (Maybe Text) -> Parser VmServerAddress
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
"vmId")
)
instance Prelude.Hashable VmServerAddress
instance Prelude.NFData VmServerAddress
instance Core.ToJSON VmServerAddress where
toJSON :: VmServerAddress -> Value
toJSON VmServerAddress' {Maybe Text
vmId :: Maybe Text
vmManagerId :: Maybe Text
$sel:vmId:VmServerAddress' :: VmServerAddress -> Maybe Text
$sel:vmManagerId:VmServerAddress' :: VmServerAddress -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"vmManagerId" 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
vmManagerId,
(Text
"vmId" 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
vmId
]
)