{-# 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.DynamoDBStreams.Types.KeySchemaElement where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DynamoDBStreams.Internal
import Amazonka.DynamoDBStreams.Types.KeyType
import qualified Amazonka.Prelude as Prelude
data KeySchemaElement = KeySchemaElement'
{
KeySchemaElement -> Text
attributeName :: Prelude.Text,
KeySchemaElement -> KeyType
keyType :: KeyType
}
deriving (KeySchemaElement -> KeySchemaElement -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KeySchemaElement -> KeySchemaElement -> Bool
$c/= :: KeySchemaElement -> KeySchemaElement -> Bool
== :: KeySchemaElement -> KeySchemaElement -> Bool
$c== :: KeySchemaElement -> KeySchemaElement -> Bool
Prelude.Eq, ReadPrec [KeySchemaElement]
ReadPrec KeySchemaElement
Int -> ReadS KeySchemaElement
ReadS [KeySchemaElement]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KeySchemaElement]
$creadListPrec :: ReadPrec [KeySchemaElement]
readPrec :: ReadPrec KeySchemaElement
$creadPrec :: ReadPrec KeySchemaElement
readList :: ReadS [KeySchemaElement]
$creadList :: ReadS [KeySchemaElement]
readsPrec :: Int -> ReadS KeySchemaElement
$creadsPrec :: Int -> ReadS KeySchemaElement
Prelude.Read, Int -> KeySchemaElement -> ShowS
[KeySchemaElement] -> ShowS
KeySchemaElement -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KeySchemaElement] -> ShowS
$cshowList :: [KeySchemaElement] -> ShowS
show :: KeySchemaElement -> String
$cshow :: KeySchemaElement -> String
showsPrec :: Int -> KeySchemaElement -> ShowS
$cshowsPrec :: Int -> KeySchemaElement -> ShowS
Prelude.Show, forall x. Rep KeySchemaElement x -> KeySchemaElement
forall x. KeySchemaElement -> Rep KeySchemaElement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep KeySchemaElement x -> KeySchemaElement
$cfrom :: forall x. KeySchemaElement -> Rep KeySchemaElement x
Prelude.Generic)
newKeySchemaElement ::
Prelude.Text ->
KeyType ->
KeySchemaElement
newKeySchemaElement :: Text -> KeyType -> KeySchemaElement
newKeySchemaElement Text
pAttributeName_ KeyType
pKeyType_ =
KeySchemaElement'
{ $sel:attributeName:KeySchemaElement' :: Text
attributeName = Text
pAttributeName_,
$sel:keyType:KeySchemaElement' :: KeyType
keyType = KeyType
pKeyType_
}
keySchemaElement_attributeName :: Lens.Lens' KeySchemaElement Prelude.Text
keySchemaElement_attributeName :: Lens' KeySchemaElement Text
keySchemaElement_attributeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeySchemaElement' {Text
attributeName :: Text
$sel:attributeName:KeySchemaElement' :: KeySchemaElement -> Text
attributeName} -> Text
attributeName) (\s :: KeySchemaElement
s@KeySchemaElement' {} Text
a -> KeySchemaElement
s {$sel:attributeName:KeySchemaElement' :: Text
attributeName = Text
a} :: KeySchemaElement)
keySchemaElement_keyType :: Lens.Lens' KeySchemaElement KeyType
keySchemaElement_keyType :: Lens' KeySchemaElement KeyType
keySchemaElement_keyType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeySchemaElement' {KeyType
keyType :: KeyType
$sel:keyType:KeySchemaElement' :: KeySchemaElement -> KeyType
keyType} -> KeyType
keyType) (\s :: KeySchemaElement
s@KeySchemaElement' {} KeyType
a -> KeySchemaElement
s {$sel:keyType:KeySchemaElement' :: KeyType
keyType = KeyType
a} :: KeySchemaElement)
instance Data.FromJSON KeySchemaElement where
parseJSON :: Value -> Parser KeySchemaElement
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"KeySchemaElement"
( \Object
x ->
Text -> KeyType -> KeySchemaElement
KeySchemaElement'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"AttributeName")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"KeyType")
)
instance Prelude.Hashable KeySchemaElement where
hashWithSalt :: Int -> KeySchemaElement -> Int
hashWithSalt Int
_salt KeySchemaElement' {Text
KeyType
keyType :: KeyType
attributeName :: Text
$sel:keyType:KeySchemaElement' :: KeySchemaElement -> KeyType
$sel:attributeName:KeySchemaElement' :: KeySchemaElement -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
attributeName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` KeyType
keyType
instance Prelude.NFData KeySchemaElement where
rnf :: KeySchemaElement -> ()
rnf KeySchemaElement' {Text
KeyType
keyType :: KeyType
attributeName :: Text
$sel:keyType:KeySchemaElement' :: KeySchemaElement -> KeyType
$sel:attributeName:KeySchemaElement' :: KeySchemaElement -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
attributeName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf KeyType
keyType