{-# 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.DynamodbDataSourceConfig where
import Amazonka.AppSync.Types.DeltaSyncConfig
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DynamodbDataSourceConfig = DynamodbDataSourceConfig'
{
DynamodbDataSourceConfig -> Maybe Bool
versioned :: Prelude.Maybe Prelude.Bool,
DynamodbDataSourceConfig -> Maybe Bool
useCallerCredentials :: Prelude.Maybe Prelude.Bool,
DynamodbDataSourceConfig -> Maybe DeltaSyncConfig
deltaSyncConfig :: Prelude.Maybe DeltaSyncConfig,
DynamodbDataSourceConfig -> Text
tableName :: Prelude.Text,
DynamodbDataSourceConfig -> Text
awsRegion :: Prelude.Text
}
deriving (DynamodbDataSourceConfig -> DynamodbDataSourceConfig -> Bool
(DynamodbDataSourceConfig -> DynamodbDataSourceConfig -> Bool)
-> (DynamodbDataSourceConfig -> DynamodbDataSourceConfig -> Bool)
-> Eq DynamodbDataSourceConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DynamodbDataSourceConfig -> DynamodbDataSourceConfig -> Bool
$c/= :: DynamodbDataSourceConfig -> DynamodbDataSourceConfig -> Bool
== :: DynamodbDataSourceConfig -> DynamodbDataSourceConfig -> Bool
$c== :: DynamodbDataSourceConfig -> DynamodbDataSourceConfig -> Bool
Prelude.Eq, ReadPrec [DynamodbDataSourceConfig]
ReadPrec DynamodbDataSourceConfig
Int -> ReadS DynamodbDataSourceConfig
ReadS [DynamodbDataSourceConfig]
(Int -> ReadS DynamodbDataSourceConfig)
-> ReadS [DynamodbDataSourceConfig]
-> ReadPrec DynamodbDataSourceConfig
-> ReadPrec [DynamodbDataSourceConfig]
-> Read DynamodbDataSourceConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DynamodbDataSourceConfig]
$creadListPrec :: ReadPrec [DynamodbDataSourceConfig]
readPrec :: ReadPrec DynamodbDataSourceConfig
$creadPrec :: ReadPrec DynamodbDataSourceConfig
readList :: ReadS [DynamodbDataSourceConfig]
$creadList :: ReadS [DynamodbDataSourceConfig]
readsPrec :: Int -> ReadS DynamodbDataSourceConfig
$creadsPrec :: Int -> ReadS DynamodbDataSourceConfig
Prelude.Read, Int -> DynamodbDataSourceConfig -> ShowS
[DynamodbDataSourceConfig] -> ShowS
DynamodbDataSourceConfig -> String
(Int -> DynamodbDataSourceConfig -> ShowS)
-> (DynamodbDataSourceConfig -> String)
-> ([DynamodbDataSourceConfig] -> ShowS)
-> Show DynamodbDataSourceConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DynamodbDataSourceConfig] -> ShowS
$cshowList :: [DynamodbDataSourceConfig] -> ShowS
show :: DynamodbDataSourceConfig -> String
$cshow :: DynamodbDataSourceConfig -> String
showsPrec :: Int -> DynamodbDataSourceConfig -> ShowS
$cshowsPrec :: Int -> DynamodbDataSourceConfig -> ShowS
Prelude.Show, (forall x.
DynamodbDataSourceConfig -> Rep DynamodbDataSourceConfig x)
-> (forall x.
Rep DynamodbDataSourceConfig x -> DynamodbDataSourceConfig)
-> Generic DynamodbDataSourceConfig
forall x.
Rep DynamodbDataSourceConfig x -> DynamodbDataSourceConfig
forall x.
DynamodbDataSourceConfig -> Rep DynamodbDataSourceConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DynamodbDataSourceConfig x -> DynamodbDataSourceConfig
$cfrom :: forall x.
DynamodbDataSourceConfig -> Rep DynamodbDataSourceConfig x
Prelude.Generic)
newDynamodbDataSourceConfig ::
Prelude.Text ->
Prelude.Text ->
DynamodbDataSourceConfig
newDynamodbDataSourceConfig :: Text -> Text -> DynamodbDataSourceConfig
newDynamodbDataSourceConfig Text
pTableName_ Text
pAwsRegion_ =
DynamodbDataSourceConfig' :: Maybe Bool
-> Maybe Bool
-> Maybe DeltaSyncConfig
-> Text
-> Text
-> DynamodbDataSourceConfig
DynamodbDataSourceConfig'
{ $sel:versioned:DynamodbDataSourceConfig' :: Maybe Bool
versioned =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:useCallerCredentials:DynamodbDataSourceConfig' :: Maybe Bool
useCallerCredentials = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:deltaSyncConfig:DynamodbDataSourceConfig' :: Maybe DeltaSyncConfig
deltaSyncConfig = Maybe DeltaSyncConfig
forall a. Maybe a
Prelude.Nothing,
$sel:tableName:DynamodbDataSourceConfig' :: Text
tableName = Text
pTableName_,
$sel:awsRegion:DynamodbDataSourceConfig' :: Text
awsRegion = Text
pAwsRegion_
}
dynamodbDataSourceConfig_versioned :: Lens.Lens' DynamodbDataSourceConfig (Prelude.Maybe Prelude.Bool)
dynamodbDataSourceConfig_versioned :: (Maybe Bool -> f (Maybe Bool))
-> DynamodbDataSourceConfig -> f DynamodbDataSourceConfig
dynamodbDataSourceConfig_versioned = (DynamodbDataSourceConfig -> Maybe Bool)
-> (DynamodbDataSourceConfig
-> Maybe Bool -> DynamodbDataSourceConfig)
-> Lens
DynamodbDataSourceConfig
DynamodbDataSourceConfig
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DynamodbDataSourceConfig' {Maybe Bool
versioned :: Maybe Bool
$sel:versioned:DynamodbDataSourceConfig' :: DynamodbDataSourceConfig -> Maybe Bool
versioned} -> Maybe Bool
versioned) (\s :: DynamodbDataSourceConfig
s@DynamodbDataSourceConfig' {} Maybe Bool
a -> DynamodbDataSourceConfig
s {$sel:versioned:DynamodbDataSourceConfig' :: Maybe Bool
versioned = Maybe Bool
a} :: DynamodbDataSourceConfig)
dynamodbDataSourceConfig_useCallerCredentials :: Lens.Lens' DynamodbDataSourceConfig (Prelude.Maybe Prelude.Bool)
dynamodbDataSourceConfig_useCallerCredentials :: (Maybe Bool -> f (Maybe Bool))
-> DynamodbDataSourceConfig -> f DynamodbDataSourceConfig
dynamodbDataSourceConfig_useCallerCredentials = (DynamodbDataSourceConfig -> Maybe Bool)
-> (DynamodbDataSourceConfig
-> Maybe Bool -> DynamodbDataSourceConfig)
-> Lens
DynamodbDataSourceConfig
DynamodbDataSourceConfig
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DynamodbDataSourceConfig' {Maybe Bool
useCallerCredentials :: Maybe Bool
$sel:useCallerCredentials:DynamodbDataSourceConfig' :: DynamodbDataSourceConfig -> Maybe Bool
useCallerCredentials} -> Maybe Bool
useCallerCredentials) (\s :: DynamodbDataSourceConfig
s@DynamodbDataSourceConfig' {} Maybe Bool
a -> DynamodbDataSourceConfig
s {$sel:useCallerCredentials:DynamodbDataSourceConfig' :: Maybe Bool
useCallerCredentials = Maybe Bool
a} :: DynamodbDataSourceConfig)
dynamodbDataSourceConfig_deltaSyncConfig :: Lens.Lens' DynamodbDataSourceConfig (Prelude.Maybe DeltaSyncConfig)
dynamodbDataSourceConfig_deltaSyncConfig :: (Maybe DeltaSyncConfig -> f (Maybe DeltaSyncConfig))
-> DynamodbDataSourceConfig -> f DynamodbDataSourceConfig
dynamodbDataSourceConfig_deltaSyncConfig = (DynamodbDataSourceConfig -> Maybe DeltaSyncConfig)
-> (DynamodbDataSourceConfig
-> Maybe DeltaSyncConfig -> DynamodbDataSourceConfig)
-> Lens
DynamodbDataSourceConfig
DynamodbDataSourceConfig
(Maybe DeltaSyncConfig)
(Maybe DeltaSyncConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DynamodbDataSourceConfig' {Maybe DeltaSyncConfig
deltaSyncConfig :: Maybe DeltaSyncConfig
$sel:deltaSyncConfig:DynamodbDataSourceConfig' :: DynamodbDataSourceConfig -> Maybe DeltaSyncConfig
deltaSyncConfig} -> Maybe DeltaSyncConfig
deltaSyncConfig) (\s :: DynamodbDataSourceConfig
s@DynamodbDataSourceConfig' {} Maybe DeltaSyncConfig
a -> DynamodbDataSourceConfig
s {$sel:deltaSyncConfig:DynamodbDataSourceConfig' :: Maybe DeltaSyncConfig
deltaSyncConfig = Maybe DeltaSyncConfig
a} :: DynamodbDataSourceConfig)
dynamodbDataSourceConfig_tableName :: Lens.Lens' DynamodbDataSourceConfig Prelude.Text
dynamodbDataSourceConfig_tableName :: (Text -> f Text)
-> DynamodbDataSourceConfig -> f DynamodbDataSourceConfig
dynamodbDataSourceConfig_tableName = (DynamodbDataSourceConfig -> Text)
-> (DynamodbDataSourceConfig -> Text -> DynamodbDataSourceConfig)
-> Lens DynamodbDataSourceConfig DynamodbDataSourceConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DynamodbDataSourceConfig' {Text
tableName :: Text
$sel:tableName:DynamodbDataSourceConfig' :: DynamodbDataSourceConfig -> Text
tableName} -> Text
tableName) (\s :: DynamodbDataSourceConfig
s@DynamodbDataSourceConfig' {} Text
a -> DynamodbDataSourceConfig
s {$sel:tableName:DynamodbDataSourceConfig' :: Text
tableName = Text
a} :: DynamodbDataSourceConfig)
dynamodbDataSourceConfig_awsRegion :: Lens.Lens' DynamodbDataSourceConfig Prelude.Text
dynamodbDataSourceConfig_awsRegion :: (Text -> f Text)
-> DynamodbDataSourceConfig -> f DynamodbDataSourceConfig
dynamodbDataSourceConfig_awsRegion = (DynamodbDataSourceConfig -> Text)
-> (DynamodbDataSourceConfig -> Text -> DynamodbDataSourceConfig)
-> Lens DynamodbDataSourceConfig DynamodbDataSourceConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DynamodbDataSourceConfig' {Text
awsRegion :: Text
$sel:awsRegion:DynamodbDataSourceConfig' :: DynamodbDataSourceConfig -> Text
awsRegion} -> Text
awsRegion) (\s :: DynamodbDataSourceConfig
s@DynamodbDataSourceConfig' {} Text
a -> DynamodbDataSourceConfig
s {$sel:awsRegion:DynamodbDataSourceConfig' :: Text
awsRegion = Text
a} :: DynamodbDataSourceConfig)
instance Core.FromJSON DynamodbDataSourceConfig where
parseJSON :: Value -> Parser DynamodbDataSourceConfig
parseJSON =
String
-> (Object -> Parser DynamodbDataSourceConfig)
-> Value
-> Parser DynamodbDataSourceConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DynamodbDataSourceConfig"
( \Object
x ->
Maybe Bool
-> Maybe Bool
-> Maybe DeltaSyncConfig
-> Text
-> Text
-> DynamodbDataSourceConfig
DynamodbDataSourceConfig'
(Maybe Bool
-> Maybe Bool
-> Maybe DeltaSyncConfig
-> Text
-> Text
-> DynamodbDataSourceConfig)
-> Parser (Maybe Bool)
-> Parser
(Maybe Bool
-> Maybe DeltaSyncConfig
-> Text
-> Text
-> DynamodbDataSourceConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"versioned")
Parser
(Maybe Bool
-> Maybe DeltaSyncConfig
-> Text
-> Text
-> DynamodbDataSourceConfig)
-> Parser (Maybe Bool)
-> Parser
(Maybe DeltaSyncConfig -> Text -> Text -> DynamodbDataSourceConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"useCallerCredentials")
Parser
(Maybe DeltaSyncConfig -> Text -> Text -> DynamodbDataSourceConfig)
-> Parser (Maybe DeltaSyncConfig)
-> Parser (Text -> Text -> DynamodbDataSourceConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DeltaSyncConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"deltaSyncConfig")
Parser (Text -> Text -> DynamodbDataSourceConfig)
-> Parser Text -> Parser (Text -> DynamodbDataSourceConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"tableName")
Parser (Text -> DynamodbDataSourceConfig)
-> Parser Text -> Parser DynamodbDataSourceConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"awsRegion")
)
instance Prelude.Hashable DynamodbDataSourceConfig
instance Prelude.NFData DynamodbDataSourceConfig
instance Core.ToJSON DynamodbDataSourceConfig where
toJSON :: DynamodbDataSourceConfig -> Value
toJSON DynamodbDataSourceConfig' {Maybe Bool
Maybe DeltaSyncConfig
Text
awsRegion :: Text
tableName :: Text
deltaSyncConfig :: Maybe DeltaSyncConfig
useCallerCredentials :: Maybe Bool
versioned :: Maybe Bool
$sel:awsRegion:DynamodbDataSourceConfig' :: DynamodbDataSourceConfig -> Text
$sel:tableName:DynamodbDataSourceConfig' :: DynamodbDataSourceConfig -> Text
$sel:deltaSyncConfig:DynamodbDataSourceConfig' :: DynamodbDataSourceConfig -> Maybe DeltaSyncConfig
$sel:useCallerCredentials:DynamodbDataSourceConfig' :: DynamodbDataSourceConfig -> Maybe Bool
$sel:versioned:DynamodbDataSourceConfig' :: DynamodbDataSourceConfig -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"versioned" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
versioned,
(Text
"useCallerCredentials" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
useCallerCredentials,
(Text
"deltaSyncConfig" Text -> DeltaSyncConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(DeltaSyncConfig -> Pair) -> Maybe DeltaSyncConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DeltaSyncConfig
deltaSyncConfig,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"tableName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tableName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"awsRegion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
awsRegion)
]
)