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