{-# 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.DynamoDB.Types.LocalSecondaryIndex where
import qualified Amazonka.Core as Core
import Amazonka.DynamoDB.Types.KeySchemaElement
import Amazonka.DynamoDB.Types.Projection
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data LocalSecondaryIndex = LocalSecondaryIndex'
{
LocalSecondaryIndex -> Text
indexName :: Prelude.Text,
LocalSecondaryIndex -> NonEmpty KeySchemaElement
keySchema :: Prelude.NonEmpty KeySchemaElement,
LocalSecondaryIndex -> Projection
projection :: Projection
}
deriving (LocalSecondaryIndex -> LocalSecondaryIndex -> Bool
(LocalSecondaryIndex -> LocalSecondaryIndex -> Bool)
-> (LocalSecondaryIndex -> LocalSecondaryIndex -> Bool)
-> Eq LocalSecondaryIndex
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LocalSecondaryIndex -> LocalSecondaryIndex -> Bool
$c/= :: LocalSecondaryIndex -> LocalSecondaryIndex -> Bool
== :: LocalSecondaryIndex -> LocalSecondaryIndex -> Bool
$c== :: LocalSecondaryIndex -> LocalSecondaryIndex -> Bool
Prelude.Eq, ReadPrec [LocalSecondaryIndex]
ReadPrec LocalSecondaryIndex
Int -> ReadS LocalSecondaryIndex
ReadS [LocalSecondaryIndex]
(Int -> ReadS LocalSecondaryIndex)
-> ReadS [LocalSecondaryIndex]
-> ReadPrec LocalSecondaryIndex
-> ReadPrec [LocalSecondaryIndex]
-> Read LocalSecondaryIndex
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LocalSecondaryIndex]
$creadListPrec :: ReadPrec [LocalSecondaryIndex]
readPrec :: ReadPrec LocalSecondaryIndex
$creadPrec :: ReadPrec LocalSecondaryIndex
readList :: ReadS [LocalSecondaryIndex]
$creadList :: ReadS [LocalSecondaryIndex]
readsPrec :: Int -> ReadS LocalSecondaryIndex
$creadsPrec :: Int -> ReadS LocalSecondaryIndex
Prelude.Read, Int -> LocalSecondaryIndex -> ShowS
[LocalSecondaryIndex] -> ShowS
LocalSecondaryIndex -> String
(Int -> LocalSecondaryIndex -> ShowS)
-> (LocalSecondaryIndex -> String)
-> ([LocalSecondaryIndex] -> ShowS)
-> Show LocalSecondaryIndex
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LocalSecondaryIndex] -> ShowS
$cshowList :: [LocalSecondaryIndex] -> ShowS
show :: LocalSecondaryIndex -> String
$cshow :: LocalSecondaryIndex -> String
showsPrec :: Int -> LocalSecondaryIndex -> ShowS
$cshowsPrec :: Int -> LocalSecondaryIndex -> ShowS
Prelude.Show, (forall x. LocalSecondaryIndex -> Rep LocalSecondaryIndex x)
-> (forall x. Rep LocalSecondaryIndex x -> LocalSecondaryIndex)
-> Generic LocalSecondaryIndex
forall x. Rep LocalSecondaryIndex x -> LocalSecondaryIndex
forall x. LocalSecondaryIndex -> Rep LocalSecondaryIndex x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LocalSecondaryIndex x -> LocalSecondaryIndex
$cfrom :: forall x. LocalSecondaryIndex -> Rep LocalSecondaryIndex x
Prelude.Generic)
newLocalSecondaryIndex ::
Prelude.Text ->
Prelude.NonEmpty KeySchemaElement ->
Projection ->
LocalSecondaryIndex
newLocalSecondaryIndex :: Text
-> NonEmpty KeySchemaElement -> Projection -> LocalSecondaryIndex
newLocalSecondaryIndex
Text
pIndexName_
NonEmpty KeySchemaElement
pKeySchema_
Projection
pProjection_ =
LocalSecondaryIndex' :: Text
-> NonEmpty KeySchemaElement -> Projection -> LocalSecondaryIndex
LocalSecondaryIndex'
{ $sel:indexName:LocalSecondaryIndex' :: Text
indexName = Text
pIndexName_,
$sel:keySchema:LocalSecondaryIndex' :: NonEmpty KeySchemaElement
keySchema = Tagged
(NonEmpty KeySchemaElement) (Identity (NonEmpty KeySchemaElement))
-> Tagged
(NonEmpty KeySchemaElement) (Identity (NonEmpty KeySchemaElement))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
(NonEmpty KeySchemaElement) (Identity (NonEmpty KeySchemaElement))
-> Tagged
(NonEmpty KeySchemaElement) (Identity (NonEmpty KeySchemaElement)))
-> NonEmpty KeySchemaElement -> NonEmpty KeySchemaElement
forall t b. AReview t b -> b -> t
Lens.# NonEmpty KeySchemaElement
pKeySchema_,
$sel:projection:LocalSecondaryIndex' :: Projection
projection = Projection
pProjection_
}
localSecondaryIndex_indexName :: Lens.Lens' LocalSecondaryIndex Prelude.Text
localSecondaryIndex_indexName :: (Text -> f Text) -> LocalSecondaryIndex -> f LocalSecondaryIndex
localSecondaryIndex_indexName = (LocalSecondaryIndex -> Text)
-> (LocalSecondaryIndex -> Text -> LocalSecondaryIndex)
-> Lens LocalSecondaryIndex LocalSecondaryIndex Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LocalSecondaryIndex' {Text
indexName :: Text
$sel:indexName:LocalSecondaryIndex' :: LocalSecondaryIndex -> Text
indexName} -> Text
indexName) (\s :: LocalSecondaryIndex
s@LocalSecondaryIndex' {} Text
a -> LocalSecondaryIndex
s {$sel:indexName:LocalSecondaryIndex' :: Text
indexName = Text
a} :: LocalSecondaryIndex)
localSecondaryIndex_keySchema :: Lens.Lens' LocalSecondaryIndex (Prelude.NonEmpty KeySchemaElement)
localSecondaryIndex_keySchema :: (NonEmpty KeySchemaElement -> f (NonEmpty KeySchemaElement))
-> LocalSecondaryIndex -> f LocalSecondaryIndex
localSecondaryIndex_keySchema = (LocalSecondaryIndex -> NonEmpty KeySchemaElement)
-> (LocalSecondaryIndex
-> NonEmpty KeySchemaElement -> LocalSecondaryIndex)
-> Lens
LocalSecondaryIndex
LocalSecondaryIndex
(NonEmpty KeySchemaElement)
(NonEmpty KeySchemaElement)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LocalSecondaryIndex' {NonEmpty KeySchemaElement
keySchema :: NonEmpty KeySchemaElement
$sel:keySchema:LocalSecondaryIndex' :: LocalSecondaryIndex -> NonEmpty KeySchemaElement
keySchema} -> NonEmpty KeySchemaElement
keySchema) (\s :: LocalSecondaryIndex
s@LocalSecondaryIndex' {} NonEmpty KeySchemaElement
a -> LocalSecondaryIndex
s {$sel:keySchema:LocalSecondaryIndex' :: NonEmpty KeySchemaElement
keySchema = NonEmpty KeySchemaElement
a} :: LocalSecondaryIndex) ((NonEmpty KeySchemaElement -> f (NonEmpty KeySchemaElement))
-> LocalSecondaryIndex -> f LocalSecondaryIndex)
-> ((NonEmpty KeySchemaElement -> f (NonEmpty KeySchemaElement))
-> NonEmpty KeySchemaElement -> f (NonEmpty KeySchemaElement))
-> (NonEmpty KeySchemaElement -> f (NonEmpty KeySchemaElement))
-> LocalSecondaryIndex
-> f LocalSecondaryIndex
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty KeySchemaElement -> f (NonEmpty KeySchemaElement))
-> NonEmpty KeySchemaElement -> f (NonEmpty KeySchemaElement)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
localSecondaryIndex_projection :: Lens.Lens' LocalSecondaryIndex Projection
localSecondaryIndex_projection :: (Projection -> f Projection)
-> LocalSecondaryIndex -> f LocalSecondaryIndex
localSecondaryIndex_projection = (LocalSecondaryIndex -> Projection)
-> (LocalSecondaryIndex -> Projection -> LocalSecondaryIndex)
-> Lens
LocalSecondaryIndex LocalSecondaryIndex Projection Projection
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LocalSecondaryIndex' {Projection
projection :: Projection
$sel:projection:LocalSecondaryIndex' :: LocalSecondaryIndex -> Projection
projection} -> Projection
projection) (\s :: LocalSecondaryIndex
s@LocalSecondaryIndex' {} Projection
a -> LocalSecondaryIndex
s {$sel:projection:LocalSecondaryIndex' :: Projection
projection = Projection
a} :: LocalSecondaryIndex)
instance Prelude.Hashable LocalSecondaryIndex
instance Prelude.NFData LocalSecondaryIndex
instance Core.ToJSON LocalSecondaryIndex where
toJSON :: LocalSecondaryIndex -> Value
toJSON LocalSecondaryIndex' {NonEmpty KeySchemaElement
Text
Projection
projection :: Projection
keySchema :: NonEmpty KeySchemaElement
indexName :: Text
$sel:projection:LocalSecondaryIndex' :: LocalSecondaryIndex -> Projection
$sel:keySchema:LocalSecondaryIndex' :: LocalSecondaryIndex -> NonEmpty KeySchemaElement
$sel:indexName:LocalSecondaryIndex' :: LocalSecondaryIndex -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"IndexName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
indexName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"KeySchema" Text -> NonEmpty KeySchemaElement -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty KeySchemaElement
keySchema),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Projection" Text -> Projection -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Projection
projection)
]
)