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