{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.DynamoDB.CreateTable
(
CreateTable (..),
newCreateTable,
createTable_provisionedThroughput,
createTable_sSESpecification,
createTable_globalSecondaryIndexes,
createTable_localSecondaryIndexes,
createTable_billingMode,
createTable_tags,
createTable_streamSpecification,
createTable_attributeDefinitions,
createTable_tableName,
createTable_keySchema,
CreateTableResponse (..),
newCreateTableResponse,
createTableResponse_tableDescription,
createTableResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DynamoDB.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateTable = CreateTable'
{
CreateTable -> Maybe ProvisionedThroughput
provisionedThroughput :: Prelude.Maybe ProvisionedThroughput,
CreateTable -> Maybe SSESpecification
sSESpecification :: Prelude.Maybe SSESpecification,
CreateTable -> Maybe [GlobalSecondaryIndex]
globalSecondaryIndexes :: Prelude.Maybe [GlobalSecondaryIndex],
CreateTable -> Maybe [LocalSecondaryIndex]
localSecondaryIndexes :: Prelude.Maybe [LocalSecondaryIndex],
CreateTable -> Maybe BillingMode
billingMode :: Prelude.Maybe BillingMode,
CreateTable -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateTable -> Maybe StreamSpecification
streamSpecification :: Prelude.Maybe StreamSpecification,
CreateTable -> [AttributeDefinition]
attributeDefinitions :: [AttributeDefinition],
CreateTable -> Text
tableName :: Prelude.Text,
CreateTable -> NonEmpty KeySchemaElement
keySchema :: Prelude.NonEmpty KeySchemaElement
}
deriving (CreateTable -> CreateTable -> Bool
(CreateTable -> CreateTable -> Bool)
-> (CreateTable -> CreateTable -> Bool) -> Eq CreateTable
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTable -> CreateTable -> Bool
$c/= :: CreateTable -> CreateTable -> Bool
== :: CreateTable -> CreateTable -> Bool
$c== :: CreateTable -> CreateTable -> Bool
Prelude.Eq, ReadPrec [CreateTable]
ReadPrec CreateTable
Int -> ReadS CreateTable
ReadS [CreateTable]
(Int -> ReadS CreateTable)
-> ReadS [CreateTable]
-> ReadPrec CreateTable
-> ReadPrec [CreateTable]
-> Read CreateTable
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTable]
$creadListPrec :: ReadPrec [CreateTable]
readPrec :: ReadPrec CreateTable
$creadPrec :: ReadPrec CreateTable
readList :: ReadS [CreateTable]
$creadList :: ReadS [CreateTable]
readsPrec :: Int -> ReadS CreateTable
$creadsPrec :: Int -> ReadS CreateTable
Prelude.Read, Int -> CreateTable -> ShowS
[CreateTable] -> ShowS
CreateTable -> String
(Int -> CreateTable -> ShowS)
-> (CreateTable -> String)
-> ([CreateTable] -> ShowS)
-> Show CreateTable
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTable] -> ShowS
$cshowList :: [CreateTable] -> ShowS
show :: CreateTable -> String
$cshow :: CreateTable -> String
showsPrec :: Int -> CreateTable -> ShowS
$cshowsPrec :: Int -> CreateTable -> ShowS
Prelude.Show, (forall x. CreateTable -> Rep CreateTable x)
-> (forall x. Rep CreateTable x -> CreateTable)
-> Generic CreateTable
forall x. Rep CreateTable x -> CreateTable
forall x. CreateTable -> Rep CreateTable x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTable x -> CreateTable
$cfrom :: forall x. CreateTable -> Rep CreateTable x
Prelude.Generic)
newCreateTable ::
Prelude.Text ->
Prelude.NonEmpty KeySchemaElement ->
CreateTable
newCreateTable :: Text -> NonEmpty KeySchemaElement -> CreateTable
newCreateTable Text
pTableName_ NonEmpty KeySchemaElement
pKeySchema_ =
CreateTable' :: Maybe ProvisionedThroughput
-> Maybe SSESpecification
-> Maybe [GlobalSecondaryIndex]
-> Maybe [LocalSecondaryIndex]
-> Maybe BillingMode
-> Maybe [Tag]
-> Maybe StreamSpecification
-> [AttributeDefinition]
-> Text
-> NonEmpty KeySchemaElement
-> CreateTable
CreateTable'
{ $sel:provisionedThroughput:CreateTable' :: Maybe ProvisionedThroughput
provisionedThroughput =
Maybe ProvisionedThroughput
forall a. Maybe a
Prelude.Nothing,
$sel:sSESpecification:CreateTable' :: Maybe SSESpecification
sSESpecification = Maybe SSESpecification
forall a. Maybe a
Prelude.Nothing,
$sel:globalSecondaryIndexes:CreateTable' :: Maybe [GlobalSecondaryIndex]
globalSecondaryIndexes = Maybe [GlobalSecondaryIndex]
forall a. Maybe a
Prelude.Nothing,
$sel:localSecondaryIndexes:CreateTable' :: Maybe [LocalSecondaryIndex]
localSecondaryIndexes = Maybe [LocalSecondaryIndex]
forall a. Maybe a
Prelude.Nothing,
$sel:billingMode:CreateTable' :: Maybe BillingMode
billingMode = Maybe BillingMode
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateTable' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:streamSpecification:CreateTable' :: Maybe StreamSpecification
streamSpecification = Maybe StreamSpecification
forall a. Maybe a
Prelude.Nothing,
$sel:attributeDefinitions:CreateTable' :: [AttributeDefinition]
attributeDefinitions = [AttributeDefinition]
forall a. Monoid a => a
Prelude.mempty,
$sel:tableName:CreateTable' :: Text
tableName = Text
pTableName_,
$sel:keySchema:CreateTable' :: 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_
}
createTable_provisionedThroughput :: Lens.Lens' CreateTable (Prelude.Maybe ProvisionedThroughput)
createTable_provisionedThroughput :: (Maybe ProvisionedThroughput -> f (Maybe ProvisionedThroughput))
-> CreateTable -> f CreateTable
createTable_provisionedThroughput = (CreateTable -> Maybe ProvisionedThroughput)
-> (CreateTable -> Maybe ProvisionedThroughput -> CreateTable)
-> Lens
CreateTable
CreateTable
(Maybe ProvisionedThroughput)
(Maybe ProvisionedThroughput)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTable' {Maybe ProvisionedThroughput
provisionedThroughput :: Maybe ProvisionedThroughput
$sel:provisionedThroughput:CreateTable' :: CreateTable -> Maybe ProvisionedThroughput
provisionedThroughput} -> Maybe ProvisionedThroughput
provisionedThroughput) (\s :: CreateTable
s@CreateTable' {} Maybe ProvisionedThroughput
a -> CreateTable
s {$sel:provisionedThroughput:CreateTable' :: Maybe ProvisionedThroughput
provisionedThroughput = Maybe ProvisionedThroughput
a} :: CreateTable)
createTable_sSESpecification :: Lens.Lens' CreateTable (Prelude.Maybe SSESpecification)
createTable_sSESpecification :: (Maybe SSESpecification -> f (Maybe SSESpecification))
-> CreateTable -> f CreateTable
createTable_sSESpecification = (CreateTable -> Maybe SSESpecification)
-> (CreateTable -> Maybe SSESpecification -> CreateTable)
-> Lens
CreateTable
CreateTable
(Maybe SSESpecification)
(Maybe SSESpecification)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTable' {Maybe SSESpecification
sSESpecification :: Maybe SSESpecification
$sel:sSESpecification:CreateTable' :: CreateTable -> Maybe SSESpecification
sSESpecification} -> Maybe SSESpecification
sSESpecification) (\s :: CreateTable
s@CreateTable' {} Maybe SSESpecification
a -> CreateTable
s {$sel:sSESpecification:CreateTable' :: Maybe SSESpecification
sSESpecification = Maybe SSESpecification
a} :: CreateTable)
createTable_globalSecondaryIndexes :: Lens.Lens' CreateTable (Prelude.Maybe [GlobalSecondaryIndex])
createTable_globalSecondaryIndexes :: (Maybe [GlobalSecondaryIndex] -> f (Maybe [GlobalSecondaryIndex]))
-> CreateTable -> f CreateTable
createTable_globalSecondaryIndexes = (CreateTable -> Maybe [GlobalSecondaryIndex])
-> (CreateTable -> Maybe [GlobalSecondaryIndex] -> CreateTable)
-> Lens
CreateTable
CreateTable
(Maybe [GlobalSecondaryIndex])
(Maybe [GlobalSecondaryIndex])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTable' {Maybe [GlobalSecondaryIndex]
globalSecondaryIndexes :: Maybe [GlobalSecondaryIndex]
$sel:globalSecondaryIndexes:CreateTable' :: CreateTable -> Maybe [GlobalSecondaryIndex]
globalSecondaryIndexes} -> Maybe [GlobalSecondaryIndex]
globalSecondaryIndexes) (\s :: CreateTable
s@CreateTable' {} Maybe [GlobalSecondaryIndex]
a -> CreateTable
s {$sel:globalSecondaryIndexes:CreateTable' :: Maybe [GlobalSecondaryIndex]
globalSecondaryIndexes = Maybe [GlobalSecondaryIndex]
a} :: CreateTable) ((Maybe [GlobalSecondaryIndex] -> f (Maybe [GlobalSecondaryIndex]))
-> CreateTable -> f CreateTable)
-> ((Maybe [GlobalSecondaryIndex]
-> f (Maybe [GlobalSecondaryIndex]))
-> Maybe [GlobalSecondaryIndex]
-> f (Maybe [GlobalSecondaryIndex]))
-> (Maybe [GlobalSecondaryIndex]
-> f (Maybe [GlobalSecondaryIndex]))
-> CreateTable
-> f CreateTable
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[GlobalSecondaryIndex]
[GlobalSecondaryIndex]
[GlobalSecondaryIndex]
[GlobalSecondaryIndex]
-> Iso
(Maybe [GlobalSecondaryIndex])
(Maybe [GlobalSecondaryIndex])
(Maybe [GlobalSecondaryIndex])
(Maybe [GlobalSecondaryIndex])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[GlobalSecondaryIndex]
[GlobalSecondaryIndex]
[GlobalSecondaryIndex]
[GlobalSecondaryIndex]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createTable_localSecondaryIndexes :: Lens.Lens' CreateTable (Prelude.Maybe [LocalSecondaryIndex])
createTable_localSecondaryIndexes :: (Maybe [LocalSecondaryIndex] -> f (Maybe [LocalSecondaryIndex]))
-> CreateTable -> f CreateTable
createTable_localSecondaryIndexes = (CreateTable -> Maybe [LocalSecondaryIndex])
-> (CreateTable -> Maybe [LocalSecondaryIndex] -> CreateTable)
-> Lens
CreateTable
CreateTable
(Maybe [LocalSecondaryIndex])
(Maybe [LocalSecondaryIndex])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTable' {Maybe [LocalSecondaryIndex]
localSecondaryIndexes :: Maybe [LocalSecondaryIndex]
$sel:localSecondaryIndexes:CreateTable' :: CreateTable -> Maybe [LocalSecondaryIndex]
localSecondaryIndexes} -> Maybe [LocalSecondaryIndex]
localSecondaryIndexes) (\s :: CreateTable
s@CreateTable' {} Maybe [LocalSecondaryIndex]
a -> CreateTable
s {$sel:localSecondaryIndexes:CreateTable' :: Maybe [LocalSecondaryIndex]
localSecondaryIndexes = Maybe [LocalSecondaryIndex]
a} :: CreateTable) ((Maybe [LocalSecondaryIndex] -> f (Maybe [LocalSecondaryIndex]))
-> CreateTable -> f CreateTable)
-> ((Maybe [LocalSecondaryIndex]
-> f (Maybe [LocalSecondaryIndex]))
-> Maybe [LocalSecondaryIndex] -> f (Maybe [LocalSecondaryIndex]))
-> (Maybe [LocalSecondaryIndex] -> f (Maybe [LocalSecondaryIndex]))
-> CreateTable
-> f CreateTable
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[LocalSecondaryIndex]
[LocalSecondaryIndex]
[LocalSecondaryIndex]
[LocalSecondaryIndex]
-> Iso
(Maybe [LocalSecondaryIndex])
(Maybe [LocalSecondaryIndex])
(Maybe [LocalSecondaryIndex])
(Maybe [LocalSecondaryIndex])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[LocalSecondaryIndex]
[LocalSecondaryIndex]
[LocalSecondaryIndex]
[LocalSecondaryIndex]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createTable_billingMode :: Lens.Lens' CreateTable (Prelude.Maybe BillingMode)
createTable_billingMode :: (Maybe BillingMode -> f (Maybe BillingMode))
-> CreateTable -> f CreateTable
createTable_billingMode = (CreateTable -> Maybe BillingMode)
-> (CreateTable -> Maybe BillingMode -> CreateTable)
-> Lens
CreateTable CreateTable (Maybe BillingMode) (Maybe BillingMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTable' {Maybe BillingMode
billingMode :: Maybe BillingMode
$sel:billingMode:CreateTable' :: CreateTable -> Maybe BillingMode
billingMode} -> Maybe BillingMode
billingMode) (\s :: CreateTable
s@CreateTable' {} Maybe BillingMode
a -> CreateTable
s {$sel:billingMode:CreateTable' :: Maybe BillingMode
billingMode = Maybe BillingMode
a} :: CreateTable)
createTable_tags :: Lens.Lens' CreateTable (Prelude.Maybe [Tag])
createTable_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> CreateTable -> f CreateTable
createTable_tags = (CreateTable -> Maybe [Tag])
-> (CreateTable -> Maybe [Tag] -> CreateTable)
-> Lens CreateTable CreateTable (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTable' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateTable' :: CreateTable -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateTable
s@CreateTable' {} Maybe [Tag]
a -> CreateTable
s {$sel:tags:CreateTable' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateTable) ((Maybe [Tag] -> f (Maybe [Tag])) -> CreateTable -> f CreateTable)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateTable
-> f CreateTable
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createTable_streamSpecification :: Lens.Lens' CreateTable (Prelude.Maybe StreamSpecification)
createTable_streamSpecification :: (Maybe StreamSpecification -> f (Maybe StreamSpecification))
-> CreateTable -> f CreateTable
createTable_streamSpecification = (CreateTable -> Maybe StreamSpecification)
-> (CreateTable -> Maybe StreamSpecification -> CreateTable)
-> Lens
CreateTable
CreateTable
(Maybe StreamSpecification)
(Maybe StreamSpecification)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTable' {Maybe StreamSpecification
streamSpecification :: Maybe StreamSpecification
$sel:streamSpecification:CreateTable' :: CreateTable -> Maybe StreamSpecification
streamSpecification} -> Maybe StreamSpecification
streamSpecification) (\s :: CreateTable
s@CreateTable' {} Maybe StreamSpecification
a -> CreateTable
s {$sel:streamSpecification:CreateTable' :: Maybe StreamSpecification
streamSpecification = Maybe StreamSpecification
a} :: CreateTable)
createTable_attributeDefinitions :: Lens.Lens' CreateTable [AttributeDefinition]
createTable_attributeDefinitions :: ([AttributeDefinition] -> f [AttributeDefinition])
-> CreateTable -> f CreateTable
createTable_attributeDefinitions = (CreateTable -> [AttributeDefinition])
-> (CreateTable -> [AttributeDefinition] -> CreateTable)
-> Lens
CreateTable CreateTable [AttributeDefinition] [AttributeDefinition]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTable' {[AttributeDefinition]
attributeDefinitions :: [AttributeDefinition]
$sel:attributeDefinitions:CreateTable' :: CreateTable -> [AttributeDefinition]
attributeDefinitions} -> [AttributeDefinition]
attributeDefinitions) (\s :: CreateTable
s@CreateTable' {} [AttributeDefinition]
a -> CreateTable
s {$sel:attributeDefinitions:CreateTable' :: [AttributeDefinition]
attributeDefinitions = [AttributeDefinition]
a} :: CreateTable) (([AttributeDefinition] -> f [AttributeDefinition])
-> CreateTable -> f CreateTable)
-> (([AttributeDefinition] -> f [AttributeDefinition])
-> [AttributeDefinition] -> f [AttributeDefinition])
-> ([AttributeDefinition] -> f [AttributeDefinition])
-> CreateTable
-> f CreateTable
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([AttributeDefinition] -> f [AttributeDefinition])
-> [AttributeDefinition] -> f [AttributeDefinition]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createTable_tableName :: Lens.Lens' CreateTable Prelude.Text
createTable_tableName :: (Text -> f Text) -> CreateTable -> f CreateTable
createTable_tableName = (CreateTable -> Text)
-> (CreateTable -> Text -> CreateTable)
-> Lens CreateTable CreateTable Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTable' {Text
tableName :: Text
$sel:tableName:CreateTable' :: CreateTable -> Text
tableName} -> Text
tableName) (\s :: CreateTable
s@CreateTable' {} Text
a -> CreateTable
s {$sel:tableName:CreateTable' :: Text
tableName = Text
a} :: CreateTable)
createTable_keySchema :: Lens.Lens' CreateTable (Prelude.NonEmpty KeySchemaElement)
createTable_keySchema :: (NonEmpty KeySchemaElement -> f (NonEmpty KeySchemaElement))
-> CreateTable -> f CreateTable
createTable_keySchema = (CreateTable -> NonEmpty KeySchemaElement)
-> (CreateTable -> NonEmpty KeySchemaElement -> CreateTable)
-> Lens
CreateTable
CreateTable
(NonEmpty KeySchemaElement)
(NonEmpty KeySchemaElement)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTable' {NonEmpty KeySchemaElement
keySchema :: NonEmpty KeySchemaElement
$sel:keySchema:CreateTable' :: CreateTable -> NonEmpty KeySchemaElement
keySchema} -> NonEmpty KeySchemaElement
keySchema) (\s :: CreateTable
s@CreateTable' {} NonEmpty KeySchemaElement
a -> CreateTable
s {$sel:keySchema:CreateTable' :: NonEmpty KeySchemaElement
keySchema = NonEmpty KeySchemaElement
a} :: CreateTable) ((NonEmpty KeySchemaElement -> f (NonEmpty KeySchemaElement))
-> CreateTable -> f CreateTable)
-> ((NonEmpty KeySchemaElement -> f (NonEmpty KeySchemaElement))
-> NonEmpty KeySchemaElement -> f (NonEmpty KeySchemaElement))
-> (NonEmpty KeySchemaElement -> f (NonEmpty KeySchemaElement))
-> CreateTable
-> f CreateTable
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
instance Core.AWSRequest CreateTable where
type AWSResponse CreateTable = CreateTableResponse
request :: CreateTable -> Request CreateTable
request = Service -> CreateTable -> Request CreateTable
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateTable
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateTable)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateTable))
-> Logger
-> Service
-> Proxy CreateTable
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateTable)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe TableDescription -> Int -> CreateTableResponse
CreateTableResponse'
(Maybe TableDescription -> Int -> CreateTableResponse)
-> Either String (Maybe TableDescription)
-> Either String (Int -> CreateTableResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe TableDescription)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TableDescription")
Either String (Int -> CreateTableResponse)
-> Either String Int -> Either String CreateTableResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreateTable
instance Prelude.NFData CreateTable
instance Core.ToHeaders CreateTable where
toHeaders :: CreateTable -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateTable -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"DynamoDB_20120810.CreateTable" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON CreateTable where
toJSON :: CreateTable -> Value
toJSON CreateTable' {[AttributeDefinition]
Maybe [LocalSecondaryIndex]
Maybe [GlobalSecondaryIndex]
Maybe [Tag]
Maybe BillingMode
Maybe ProvisionedThroughput
Maybe SSESpecification
Maybe StreamSpecification
NonEmpty KeySchemaElement
Text
keySchema :: NonEmpty KeySchemaElement
tableName :: Text
attributeDefinitions :: [AttributeDefinition]
streamSpecification :: Maybe StreamSpecification
tags :: Maybe [Tag]
billingMode :: Maybe BillingMode
localSecondaryIndexes :: Maybe [LocalSecondaryIndex]
globalSecondaryIndexes :: Maybe [GlobalSecondaryIndex]
sSESpecification :: Maybe SSESpecification
provisionedThroughput :: Maybe ProvisionedThroughput
$sel:keySchema:CreateTable' :: CreateTable -> NonEmpty KeySchemaElement
$sel:tableName:CreateTable' :: CreateTable -> Text
$sel:attributeDefinitions:CreateTable' :: CreateTable -> [AttributeDefinition]
$sel:streamSpecification:CreateTable' :: CreateTable -> Maybe StreamSpecification
$sel:tags:CreateTable' :: CreateTable -> Maybe [Tag]
$sel:billingMode:CreateTable' :: CreateTable -> Maybe BillingMode
$sel:localSecondaryIndexes:CreateTable' :: CreateTable -> Maybe [LocalSecondaryIndex]
$sel:globalSecondaryIndexes:CreateTable' :: CreateTable -> Maybe [GlobalSecondaryIndex]
$sel:sSESpecification:CreateTable' :: CreateTable -> Maybe SSESpecification
$sel:provisionedThroughput:CreateTable' :: CreateTable -> Maybe ProvisionedThroughput
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ProvisionedThroughput" Text -> ProvisionedThroughput -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(ProvisionedThroughput -> Pair)
-> Maybe ProvisionedThroughput -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ProvisionedThroughput
provisionedThroughput,
(Text
"SSESpecification" Text -> SSESpecification -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(SSESpecification -> Pair) -> Maybe SSESpecification -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SSESpecification
sSESpecification,
(Text
"GlobalSecondaryIndexes" Text -> [GlobalSecondaryIndex] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([GlobalSecondaryIndex] -> Pair)
-> Maybe [GlobalSecondaryIndex] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [GlobalSecondaryIndex]
globalSecondaryIndexes,
(Text
"LocalSecondaryIndexes" Text -> [LocalSecondaryIndex] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([LocalSecondaryIndex] -> Pair)
-> Maybe [LocalSecondaryIndex] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [LocalSecondaryIndex]
localSecondaryIndexes,
(Text
"BillingMode" Text -> BillingMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (BillingMode -> Pair) -> Maybe BillingMode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BillingMode
billingMode,
(Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
(Text
"StreamSpecification" Text -> StreamSpecification -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(StreamSpecification -> Pair)
-> Maybe StreamSpecification -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StreamSpecification
streamSpecification,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"AttributeDefinitions"
Text -> [AttributeDefinition] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [AttributeDefinition]
attributeDefinitions
),
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
"KeySchema" Text -> NonEmpty KeySchemaElement -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty KeySchemaElement
keySchema)
]
)
instance Core.ToPath CreateTable where
toPath :: CreateTable -> ByteString
toPath = ByteString -> CreateTable -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateTable where
toQuery :: CreateTable -> QueryString
toQuery = QueryString -> CreateTable -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateTableResponse = CreateTableResponse'
{
CreateTableResponse -> Maybe TableDescription
tableDescription :: Prelude.Maybe TableDescription,
CreateTableResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateTableResponse -> CreateTableResponse -> Bool
(CreateTableResponse -> CreateTableResponse -> Bool)
-> (CreateTableResponse -> CreateTableResponse -> Bool)
-> Eq CreateTableResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTableResponse -> CreateTableResponse -> Bool
$c/= :: CreateTableResponse -> CreateTableResponse -> Bool
== :: CreateTableResponse -> CreateTableResponse -> Bool
$c== :: CreateTableResponse -> CreateTableResponse -> Bool
Prelude.Eq, ReadPrec [CreateTableResponse]
ReadPrec CreateTableResponse
Int -> ReadS CreateTableResponse
ReadS [CreateTableResponse]
(Int -> ReadS CreateTableResponse)
-> ReadS [CreateTableResponse]
-> ReadPrec CreateTableResponse
-> ReadPrec [CreateTableResponse]
-> Read CreateTableResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTableResponse]
$creadListPrec :: ReadPrec [CreateTableResponse]
readPrec :: ReadPrec CreateTableResponse
$creadPrec :: ReadPrec CreateTableResponse
readList :: ReadS [CreateTableResponse]
$creadList :: ReadS [CreateTableResponse]
readsPrec :: Int -> ReadS CreateTableResponse
$creadsPrec :: Int -> ReadS CreateTableResponse
Prelude.Read, Int -> CreateTableResponse -> ShowS
[CreateTableResponse] -> ShowS
CreateTableResponse -> String
(Int -> CreateTableResponse -> ShowS)
-> (CreateTableResponse -> String)
-> ([CreateTableResponse] -> ShowS)
-> Show CreateTableResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTableResponse] -> ShowS
$cshowList :: [CreateTableResponse] -> ShowS
show :: CreateTableResponse -> String
$cshow :: CreateTableResponse -> String
showsPrec :: Int -> CreateTableResponse -> ShowS
$cshowsPrec :: Int -> CreateTableResponse -> ShowS
Prelude.Show, (forall x. CreateTableResponse -> Rep CreateTableResponse x)
-> (forall x. Rep CreateTableResponse x -> CreateTableResponse)
-> Generic CreateTableResponse
forall x. Rep CreateTableResponse x -> CreateTableResponse
forall x. CreateTableResponse -> Rep CreateTableResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTableResponse x -> CreateTableResponse
$cfrom :: forall x. CreateTableResponse -> Rep CreateTableResponse x
Prelude.Generic)
newCreateTableResponse ::
Prelude.Int ->
CreateTableResponse
newCreateTableResponse :: Int -> CreateTableResponse
newCreateTableResponse Int
pHttpStatus_ =
CreateTableResponse' :: Maybe TableDescription -> Int -> CreateTableResponse
CreateTableResponse'
{ $sel:tableDescription:CreateTableResponse' :: Maybe TableDescription
tableDescription =
Maybe TableDescription
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateTableResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createTableResponse_tableDescription :: Lens.Lens' CreateTableResponse (Prelude.Maybe TableDescription)
createTableResponse_tableDescription :: (Maybe TableDescription -> f (Maybe TableDescription))
-> CreateTableResponse -> f CreateTableResponse
createTableResponse_tableDescription = (CreateTableResponse -> Maybe TableDescription)
-> (CreateTableResponse
-> Maybe TableDescription -> CreateTableResponse)
-> Lens
CreateTableResponse
CreateTableResponse
(Maybe TableDescription)
(Maybe TableDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTableResponse' {Maybe TableDescription
tableDescription :: Maybe TableDescription
$sel:tableDescription:CreateTableResponse' :: CreateTableResponse -> Maybe TableDescription
tableDescription} -> Maybe TableDescription
tableDescription) (\s :: CreateTableResponse
s@CreateTableResponse' {} Maybe TableDescription
a -> CreateTableResponse
s {$sel:tableDescription:CreateTableResponse' :: Maybe TableDescription
tableDescription = Maybe TableDescription
a} :: CreateTableResponse)
createTableResponse_httpStatus :: Lens.Lens' CreateTableResponse Prelude.Int
createTableResponse_httpStatus :: (Int -> f Int) -> CreateTableResponse -> f CreateTableResponse
createTableResponse_httpStatus = (CreateTableResponse -> Int)
-> (CreateTableResponse -> Int -> CreateTableResponse)
-> Lens CreateTableResponse CreateTableResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTableResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateTableResponse' :: CreateTableResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateTableResponse
s@CreateTableResponse' {} Int
a -> CreateTableResponse
s {$sel:httpStatus:CreateTableResponse' :: Int
httpStatus = Int
a} :: CreateTableResponse)
instance Prelude.NFData CreateTableResponse