{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data SyncConfig = SyncConfig'
{
SyncConfig -> Maybe ConflictDetectionType
conflictDetection :: Prelude.Maybe ConflictDetectionType,
SyncConfig -> Maybe ConflictHandlerType
conflictHandler :: Prelude.Maybe ConflictHandlerType,
SyncConfig -> Maybe LambdaConflictHandlerConfig
lambdaConflictHandlerConfig :: Prelude.Maybe LambdaConflictHandlerConfig
}
deriving (SyncConfig -> SyncConfig -> Bool
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]
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
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. 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'
{ $sel:conflictDetection:SyncConfig' :: Maybe ConflictDetectionType
conflictDetection = forall a. Maybe a
Prelude.Nothing,
$sel:conflictHandler:SyncConfig' :: Maybe ConflictHandlerType
conflictHandler = forall a. Maybe a
Prelude.Nothing,
$sel:lambdaConflictHandlerConfig:SyncConfig' :: Maybe LambdaConflictHandlerConfig
lambdaConflictHandlerConfig = forall a. Maybe a
Prelude.Nothing
}
syncConfig_conflictDetection :: Lens.Lens' SyncConfig (Prelude.Maybe ConflictDetectionType)
syncConfig_conflictDetection :: Lens' SyncConfig (Maybe ConflictDetectionType)
syncConfig_conflictDetection = 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_conflictHandler :: Lens.Lens' SyncConfig (Prelude.Maybe ConflictHandlerType)
syncConfig_conflictHandler :: Lens' SyncConfig (Maybe ConflictHandlerType)
syncConfig_conflictHandler = 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_lambdaConflictHandlerConfig :: Lens.Lens' SyncConfig (Prelude.Maybe LambdaConflictHandlerConfig)
syncConfig_lambdaConflictHandlerConfig :: Lens' SyncConfig (Maybe LambdaConflictHandlerConfig)
syncConfig_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 Data.FromJSON SyncConfig where
parseJSON :: Value -> Parser SyncConfig
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"SyncConfig"
( \Object
x ->
Maybe ConflictDetectionType
-> Maybe ConflictHandlerType
-> Maybe LambdaConflictHandlerConfig
-> SyncConfig
SyncConfig'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"conflictDetection")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"conflictHandler")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"lambdaConflictHandlerConfig")
)
instance Prelude.Hashable SyncConfig where
hashWithSalt :: Int -> SyncConfig -> Int
hashWithSalt Int
_salt SyncConfig' {Maybe ConflictDetectionType
Maybe ConflictHandlerType
Maybe LambdaConflictHandlerConfig
lambdaConflictHandlerConfig :: Maybe LambdaConflictHandlerConfig
conflictHandler :: Maybe ConflictHandlerType
conflictDetection :: Maybe ConflictDetectionType
$sel:lambdaConflictHandlerConfig:SyncConfig' :: SyncConfig -> Maybe LambdaConflictHandlerConfig
$sel:conflictHandler:SyncConfig' :: SyncConfig -> Maybe ConflictHandlerType
$sel:conflictDetection:SyncConfig' :: SyncConfig -> Maybe ConflictDetectionType
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConflictDetectionType
conflictDetection
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConflictHandlerType
conflictHandler
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LambdaConflictHandlerConfig
lambdaConflictHandlerConfig
instance Prelude.NFData SyncConfig where
rnf :: SyncConfig -> ()
rnf SyncConfig' {Maybe ConflictDetectionType
Maybe ConflictHandlerType
Maybe LambdaConflictHandlerConfig
lambdaConflictHandlerConfig :: Maybe LambdaConflictHandlerConfig
conflictHandler :: Maybe ConflictHandlerType
conflictDetection :: Maybe ConflictDetectionType
$sel:lambdaConflictHandlerConfig:SyncConfig' :: SyncConfig -> Maybe LambdaConflictHandlerConfig
$sel:conflictHandler:SyncConfig' :: SyncConfig -> Maybe ConflictHandlerType
$sel:conflictDetection:SyncConfig' :: SyncConfig -> Maybe ConflictDetectionType
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe ConflictDetectionType
conflictDetection
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConflictHandlerType
conflictHandler
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LambdaConflictHandlerConfig
lambdaConflictHandlerConfig
instance Data.ToJSON SyncConfig where
toJSON :: SyncConfig -> Value
toJSON SyncConfig' {Maybe ConflictDetectionType
Maybe ConflictHandlerType
Maybe LambdaConflictHandlerConfig
lambdaConflictHandlerConfig :: Maybe LambdaConflictHandlerConfig
conflictHandler :: Maybe ConflictHandlerType
conflictDetection :: Maybe ConflictDetectionType
$sel:lambdaConflictHandlerConfig:SyncConfig' :: SyncConfig -> Maybe LambdaConflictHandlerConfig
$sel:conflictHandler:SyncConfig' :: SyncConfig -> Maybe ConflictHandlerType
$sel:conflictDetection:SyncConfig' :: SyncConfig -> Maybe ConflictDetectionType
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"conflictDetection" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConflictDetectionType
conflictDetection,
(Key
"conflictHandler" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConflictHandlerType
conflictHandler,
(Key
"lambdaConflictHandlerConfig" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LambdaConflictHandlerConfig
lambdaConflictHandlerConfig
]
)