{-# 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.CreateGlobalSecondaryIndexAction where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DynamoDB.Types.AttributeValue
import Amazonka.DynamoDB.Types.KeySchemaElement
import Amazonka.DynamoDB.Types.Projection
import Amazonka.DynamoDB.Types.ProvisionedThroughput
import Amazonka.DynamoDB.Types.WriteRequest
import qualified Amazonka.Prelude as Prelude
data CreateGlobalSecondaryIndexAction = CreateGlobalSecondaryIndexAction'
{
CreateGlobalSecondaryIndexAction -> Maybe ProvisionedThroughput
provisionedThroughput :: Prelude.Maybe ProvisionedThroughput,
CreateGlobalSecondaryIndexAction -> Text
indexName :: Prelude.Text,
CreateGlobalSecondaryIndexAction -> NonEmpty KeySchemaElement
keySchema :: Prelude.NonEmpty KeySchemaElement,
CreateGlobalSecondaryIndexAction -> Projection
projection :: Projection
}
deriving (CreateGlobalSecondaryIndexAction
-> CreateGlobalSecondaryIndexAction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateGlobalSecondaryIndexAction
-> CreateGlobalSecondaryIndexAction -> Bool
$c/= :: CreateGlobalSecondaryIndexAction
-> CreateGlobalSecondaryIndexAction -> Bool
== :: CreateGlobalSecondaryIndexAction
-> CreateGlobalSecondaryIndexAction -> Bool
$c== :: CreateGlobalSecondaryIndexAction
-> CreateGlobalSecondaryIndexAction -> Bool
Prelude.Eq, ReadPrec [CreateGlobalSecondaryIndexAction]
ReadPrec CreateGlobalSecondaryIndexAction
Int -> ReadS CreateGlobalSecondaryIndexAction
ReadS [CreateGlobalSecondaryIndexAction]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateGlobalSecondaryIndexAction]
$creadListPrec :: ReadPrec [CreateGlobalSecondaryIndexAction]
readPrec :: ReadPrec CreateGlobalSecondaryIndexAction
$creadPrec :: ReadPrec CreateGlobalSecondaryIndexAction
readList :: ReadS [CreateGlobalSecondaryIndexAction]
$creadList :: ReadS [CreateGlobalSecondaryIndexAction]
readsPrec :: Int -> ReadS CreateGlobalSecondaryIndexAction
$creadsPrec :: Int -> ReadS CreateGlobalSecondaryIndexAction
Prelude.Read, Int -> CreateGlobalSecondaryIndexAction -> ShowS
[CreateGlobalSecondaryIndexAction] -> ShowS
CreateGlobalSecondaryIndexAction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateGlobalSecondaryIndexAction] -> ShowS
$cshowList :: [CreateGlobalSecondaryIndexAction] -> ShowS
show :: CreateGlobalSecondaryIndexAction -> String
$cshow :: CreateGlobalSecondaryIndexAction -> String
showsPrec :: Int -> CreateGlobalSecondaryIndexAction -> ShowS
$cshowsPrec :: Int -> CreateGlobalSecondaryIndexAction -> ShowS
Prelude.Show, forall x.
Rep CreateGlobalSecondaryIndexAction x
-> CreateGlobalSecondaryIndexAction
forall x.
CreateGlobalSecondaryIndexAction
-> Rep CreateGlobalSecondaryIndexAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateGlobalSecondaryIndexAction x
-> CreateGlobalSecondaryIndexAction
$cfrom :: forall x.
CreateGlobalSecondaryIndexAction
-> Rep CreateGlobalSecondaryIndexAction x
Prelude.Generic)
newCreateGlobalSecondaryIndexAction ::
Prelude.Text ->
Prelude.NonEmpty KeySchemaElement ->
Projection ->
CreateGlobalSecondaryIndexAction
newCreateGlobalSecondaryIndexAction :: Text
-> NonEmpty KeySchemaElement
-> Projection
-> CreateGlobalSecondaryIndexAction
newCreateGlobalSecondaryIndexAction
Text
pIndexName_
NonEmpty KeySchemaElement
pKeySchema_
Projection
pProjection_ =
CreateGlobalSecondaryIndexAction'
{ $sel:provisionedThroughput:CreateGlobalSecondaryIndexAction' :: Maybe ProvisionedThroughput
provisionedThroughput =
forall a. Maybe a
Prelude.Nothing,
$sel:indexName:CreateGlobalSecondaryIndexAction' :: Text
indexName = Text
pIndexName_,
$sel:keySchema:CreateGlobalSecondaryIndexAction' :: NonEmpty KeySchemaElement
keySchema =
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty KeySchemaElement
pKeySchema_,
$sel:projection:CreateGlobalSecondaryIndexAction' :: Projection
projection = Projection
pProjection_
}
createGlobalSecondaryIndexAction_provisionedThroughput :: Lens.Lens' CreateGlobalSecondaryIndexAction (Prelude.Maybe ProvisionedThroughput)
createGlobalSecondaryIndexAction_provisionedThroughput :: Lens'
CreateGlobalSecondaryIndexAction (Maybe ProvisionedThroughput)
createGlobalSecondaryIndexAction_provisionedThroughput = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGlobalSecondaryIndexAction' {Maybe ProvisionedThroughput
provisionedThroughput :: Maybe ProvisionedThroughput
$sel:provisionedThroughput:CreateGlobalSecondaryIndexAction' :: CreateGlobalSecondaryIndexAction -> Maybe ProvisionedThroughput
provisionedThroughput} -> Maybe ProvisionedThroughput
provisionedThroughput) (\s :: CreateGlobalSecondaryIndexAction
s@CreateGlobalSecondaryIndexAction' {} Maybe ProvisionedThroughput
a -> CreateGlobalSecondaryIndexAction
s {$sel:provisionedThroughput:CreateGlobalSecondaryIndexAction' :: Maybe ProvisionedThroughput
provisionedThroughput = Maybe ProvisionedThroughput
a} :: CreateGlobalSecondaryIndexAction)
createGlobalSecondaryIndexAction_indexName :: Lens.Lens' CreateGlobalSecondaryIndexAction Prelude.Text
createGlobalSecondaryIndexAction_indexName :: Lens' CreateGlobalSecondaryIndexAction Text
createGlobalSecondaryIndexAction_indexName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGlobalSecondaryIndexAction' {Text
indexName :: Text
$sel:indexName:CreateGlobalSecondaryIndexAction' :: CreateGlobalSecondaryIndexAction -> Text
indexName} -> Text
indexName) (\s :: CreateGlobalSecondaryIndexAction
s@CreateGlobalSecondaryIndexAction' {} Text
a -> CreateGlobalSecondaryIndexAction
s {$sel:indexName:CreateGlobalSecondaryIndexAction' :: Text
indexName = Text
a} :: CreateGlobalSecondaryIndexAction)
createGlobalSecondaryIndexAction_keySchema :: Lens.Lens' CreateGlobalSecondaryIndexAction (Prelude.NonEmpty KeySchemaElement)
createGlobalSecondaryIndexAction_keySchema :: Lens' CreateGlobalSecondaryIndexAction (NonEmpty KeySchemaElement)
createGlobalSecondaryIndexAction_keySchema = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGlobalSecondaryIndexAction' {NonEmpty KeySchemaElement
keySchema :: NonEmpty KeySchemaElement
$sel:keySchema:CreateGlobalSecondaryIndexAction' :: CreateGlobalSecondaryIndexAction -> NonEmpty KeySchemaElement
keySchema} -> NonEmpty KeySchemaElement
keySchema) (\s :: CreateGlobalSecondaryIndexAction
s@CreateGlobalSecondaryIndexAction' {} NonEmpty KeySchemaElement
a -> CreateGlobalSecondaryIndexAction
s {$sel:keySchema:CreateGlobalSecondaryIndexAction' :: NonEmpty KeySchemaElement
keySchema = NonEmpty KeySchemaElement
a} :: CreateGlobalSecondaryIndexAction) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createGlobalSecondaryIndexAction_projection :: Lens.Lens' CreateGlobalSecondaryIndexAction Projection
createGlobalSecondaryIndexAction_projection :: Lens' CreateGlobalSecondaryIndexAction Projection
createGlobalSecondaryIndexAction_projection = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGlobalSecondaryIndexAction' {Projection
projection :: Projection
$sel:projection:CreateGlobalSecondaryIndexAction' :: CreateGlobalSecondaryIndexAction -> Projection
projection} -> Projection
projection) (\s :: CreateGlobalSecondaryIndexAction
s@CreateGlobalSecondaryIndexAction' {} Projection
a -> CreateGlobalSecondaryIndexAction
s {$sel:projection:CreateGlobalSecondaryIndexAction' :: Projection
projection = Projection
a} :: CreateGlobalSecondaryIndexAction)
instance
Prelude.Hashable
CreateGlobalSecondaryIndexAction
where
hashWithSalt :: Int -> CreateGlobalSecondaryIndexAction -> Int
hashWithSalt
Int
_salt
CreateGlobalSecondaryIndexAction' {Maybe ProvisionedThroughput
NonEmpty KeySchemaElement
Text
Projection
projection :: Projection
keySchema :: NonEmpty KeySchemaElement
indexName :: Text
provisionedThroughput :: Maybe ProvisionedThroughput
$sel:projection:CreateGlobalSecondaryIndexAction' :: CreateGlobalSecondaryIndexAction -> Projection
$sel:keySchema:CreateGlobalSecondaryIndexAction' :: CreateGlobalSecondaryIndexAction -> NonEmpty KeySchemaElement
$sel:indexName:CreateGlobalSecondaryIndexAction' :: CreateGlobalSecondaryIndexAction -> Text
$sel:provisionedThroughput:CreateGlobalSecondaryIndexAction' :: CreateGlobalSecondaryIndexAction -> Maybe ProvisionedThroughput
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProvisionedThroughput
provisionedThroughput
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
indexName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty KeySchemaElement
keySchema
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Projection
projection
instance
Prelude.NFData
CreateGlobalSecondaryIndexAction
where
rnf :: CreateGlobalSecondaryIndexAction -> ()
rnf CreateGlobalSecondaryIndexAction' {Maybe ProvisionedThroughput
NonEmpty KeySchemaElement
Text
Projection
projection :: Projection
keySchema :: NonEmpty KeySchemaElement
indexName :: Text
provisionedThroughput :: Maybe ProvisionedThroughput
$sel:projection:CreateGlobalSecondaryIndexAction' :: CreateGlobalSecondaryIndexAction -> Projection
$sel:keySchema:CreateGlobalSecondaryIndexAction' :: CreateGlobalSecondaryIndexAction -> NonEmpty KeySchemaElement
$sel:indexName:CreateGlobalSecondaryIndexAction' :: CreateGlobalSecondaryIndexAction -> Text
$sel:provisionedThroughput:CreateGlobalSecondaryIndexAction' :: CreateGlobalSecondaryIndexAction -> Maybe ProvisionedThroughput
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe ProvisionedThroughput
provisionedThroughput
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
indexName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty KeySchemaElement
keySchema
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Projection
projection
instance Data.ToJSON CreateGlobalSecondaryIndexAction where
toJSON :: CreateGlobalSecondaryIndexAction -> Value
toJSON CreateGlobalSecondaryIndexAction' {Maybe ProvisionedThroughput
NonEmpty KeySchemaElement
Text
Projection
projection :: Projection
keySchema :: NonEmpty KeySchemaElement
indexName :: Text
provisionedThroughput :: Maybe ProvisionedThroughput
$sel:projection:CreateGlobalSecondaryIndexAction' :: CreateGlobalSecondaryIndexAction -> Projection
$sel:keySchema:CreateGlobalSecondaryIndexAction' :: CreateGlobalSecondaryIndexAction -> NonEmpty KeySchemaElement
$sel:indexName:CreateGlobalSecondaryIndexAction' :: CreateGlobalSecondaryIndexAction -> Text
$sel:provisionedThroughput:CreateGlobalSecondaryIndexAction' :: CreateGlobalSecondaryIndexAction -> Maybe ProvisionedThroughput
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"ProvisionedThroughput" 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 ProvisionedThroughput
provisionedThroughput,
forall a. a -> Maybe a
Prelude.Just (Key
"IndexName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
indexName),
forall a. a -> Maybe a
Prelude.Just (Key
"KeySchema" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty KeySchemaElement
keySchema),
forall a. a -> Maybe a
Prelude.Just (Key
"Projection" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Projection
projection)
]
)