{-# 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.UpdateGlobalTable
(
UpdateGlobalTable (..),
newUpdateGlobalTable,
updateGlobalTable_globalTableName,
updateGlobalTable_replicaUpdates,
UpdateGlobalTableResponse (..),
newUpdateGlobalTableResponse,
updateGlobalTableResponse_globalTableDescription,
updateGlobalTableResponse_httpStatus,
)
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
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateGlobalTable = UpdateGlobalTable'
{
UpdateGlobalTable -> Text
globalTableName :: Prelude.Text,
UpdateGlobalTable -> [ReplicaUpdate]
replicaUpdates :: [ReplicaUpdate]
}
deriving (UpdateGlobalTable -> UpdateGlobalTable -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateGlobalTable -> UpdateGlobalTable -> Bool
$c/= :: UpdateGlobalTable -> UpdateGlobalTable -> Bool
== :: UpdateGlobalTable -> UpdateGlobalTable -> Bool
$c== :: UpdateGlobalTable -> UpdateGlobalTable -> Bool
Prelude.Eq, ReadPrec [UpdateGlobalTable]
ReadPrec UpdateGlobalTable
Int -> ReadS UpdateGlobalTable
ReadS [UpdateGlobalTable]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateGlobalTable]
$creadListPrec :: ReadPrec [UpdateGlobalTable]
readPrec :: ReadPrec UpdateGlobalTable
$creadPrec :: ReadPrec UpdateGlobalTable
readList :: ReadS [UpdateGlobalTable]
$creadList :: ReadS [UpdateGlobalTable]
readsPrec :: Int -> ReadS UpdateGlobalTable
$creadsPrec :: Int -> ReadS UpdateGlobalTable
Prelude.Read, Int -> UpdateGlobalTable -> ShowS
[UpdateGlobalTable] -> ShowS
UpdateGlobalTable -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateGlobalTable] -> ShowS
$cshowList :: [UpdateGlobalTable] -> ShowS
show :: UpdateGlobalTable -> String
$cshow :: UpdateGlobalTable -> String
showsPrec :: Int -> UpdateGlobalTable -> ShowS
$cshowsPrec :: Int -> UpdateGlobalTable -> ShowS
Prelude.Show, forall x. Rep UpdateGlobalTable x -> UpdateGlobalTable
forall x. UpdateGlobalTable -> Rep UpdateGlobalTable x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateGlobalTable x -> UpdateGlobalTable
$cfrom :: forall x. UpdateGlobalTable -> Rep UpdateGlobalTable x
Prelude.Generic)
newUpdateGlobalTable ::
Prelude.Text ->
UpdateGlobalTable
newUpdateGlobalTable :: Text -> UpdateGlobalTable
newUpdateGlobalTable Text
pGlobalTableName_ =
UpdateGlobalTable'
{ $sel:globalTableName:UpdateGlobalTable' :: Text
globalTableName =
Text
pGlobalTableName_,
$sel:replicaUpdates:UpdateGlobalTable' :: [ReplicaUpdate]
replicaUpdates = forall a. Monoid a => a
Prelude.mempty
}
updateGlobalTable_globalTableName :: Lens.Lens' UpdateGlobalTable Prelude.Text
updateGlobalTable_globalTableName :: Lens' UpdateGlobalTable Text
updateGlobalTable_globalTableName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGlobalTable' {Text
globalTableName :: Text
$sel:globalTableName:UpdateGlobalTable' :: UpdateGlobalTable -> Text
globalTableName} -> Text
globalTableName) (\s :: UpdateGlobalTable
s@UpdateGlobalTable' {} Text
a -> UpdateGlobalTable
s {$sel:globalTableName:UpdateGlobalTable' :: Text
globalTableName = Text
a} :: UpdateGlobalTable)
updateGlobalTable_replicaUpdates :: Lens.Lens' UpdateGlobalTable [ReplicaUpdate]
updateGlobalTable_replicaUpdates :: Lens' UpdateGlobalTable [ReplicaUpdate]
updateGlobalTable_replicaUpdates = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGlobalTable' {[ReplicaUpdate]
replicaUpdates :: [ReplicaUpdate]
$sel:replicaUpdates:UpdateGlobalTable' :: UpdateGlobalTable -> [ReplicaUpdate]
replicaUpdates} -> [ReplicaUpdate]
replicaUpdates) (\s :: UpdateGlobalTable
s@UpdateGlobalTable' {} [ReplicaUpdate]
a -> UpdateGlobalTable
s {$sel:replicaUpdates:UpdateGlobalTable' :: [ReplicaUpdate]
replicaUpdates = [ReplicaUpdate]
a} :: UpdateGlobalTable) 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
instance Core.AWSRequest UpdateGlobalTable where
type
AWSResponse UpdateGlobalTable =
UpdateGlobalTableResponse
request :: (Service -> Service)
-> UpdateGlobalTable -> Request UpdateGlobalTable
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateGlobalTable
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateGlobalTable)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe GlobalTableDescription -> Int -> UpdateGlobalTableResponse
UpdateGlobalTableResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"GlobalTableDescription")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable UpdateGlobalTable where
hashWithSalt :: Int -> UpdateGlobalTable -> Int
hashWithSalt Int
_salt UpdateGlobalTable' {[ReplicaUpdate]
Text
replicaUpdates :: [ReplicaUpdate]
globalTableName :: Text
$sel:replicaUpdates:UpdateGlobalTable' :: UpdateGlobalTable -> [ReplicaUpdate]
$sel:globalTableName:UpdateGlobalTable' :: UpdateGlobalTable -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
globalTableName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [ReplicaUpdate]
replicaUpdates
instance Prelude.NFData UpdateGlobalTable where
rnf :: UpdateGlobalTable -> ()
rnf UpdateGlobalTable' {[ReplicaUpdate]
Text
replicaUpdates :: [ReplicaUpdate]
globalTableName :: Text
$sel:replicaUpdates:UpdateGlobalTable' :: UpdateGlobalTable -> [ReplicaUpdate]
$sel:globalTableName:UpdateGlobalTable' :: UpdateGlobalTable -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
globalTableName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [ReplicaUpdate]
replicaUpdates
instance Data.ToHeaders UpdateGlobalTable where
toHeaders :: UpdateGlobalTable -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"DynamoDB_20120810.UpdateGlobalTable" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON UpdateGlobalTable where
toJSON :: UpdateGlobalTable -> Value
toJSON UpdateGlobalTable' {[ReplicaUpdate]
Text
replicaUpdates :: [ReplicaUpdate]
globalTableName :: Text
$sel:replicaUpdates:UpdateGlobalTable' :: UpdateGlobalTable -> [ReplicaUpdate]
$sel:globalTableName:UpdateGlobalTable' :: UpdateGlobalTable -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"GlobalTableName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
globalTableName),
forall a. a -> Maybe a
Prelude.Just
(Key
"ReplicaUpdates" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [ReplicaUpdate]
replicaUpdates)
]
)
instance Data.ToPath UpdateGlobalTable where
toPath :: UpdateGlobalTable -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery UpdateGlobalTable where
toQuery :: UpdateGlobalTable -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateGlobalTableResponse = UpdateGlobalTableResponse'
{
UpdateGlobalTableResponse -> Maybe GlobalTableDescription
globalTableDescription :: Prelude.Maybe GlobalTableDescription,
UpdateGlobalTableResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateGlobalTableResponse -> UpdateGlobalTableResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateGlobalTableResponse -> UpdateGlobalTableResponse -> Bool
$c/= :: UpdateGlobalTableResponse -> UpdateGlobalTableResponse -> Bool
== :: UpdateGlobalTableResponse -> UpdateGlobalTableResponse -> Bool
$c== :: UpdateGlobalTableResponse -> UpdateGlobalTableResponse -> Bool
Prelude.Eq, ReadPrec [UpdateGlobalTableResponse]
ReadPrec UpdateGlobalTableResponse
Int -> ReadS UpdateGlobalTableResponse
ReadS [UpdateGlobalTableResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateGlobalTableResponse]
$creadListPrec :: ReadPrec [UpdateGlobalTableResponse]
readPrec :: ReadPrec UpdateGlobalTableResponse
$creadPrec :: ReadPrec UpdateGlobalTableResponse
readList :: ReadS [UpdateGlobalTableResponse]
$creadList :: ReadS [UpdateGlobalTableResponse]
readsPrec :: Int -> ReadS UpdateGlobalTableResponse
$creadsPrec :: Int -> ReadS UpdateGlobalTableResponse
Prelude.Read, Int -> UpdateGlobalTableResponse -> ShowS
[UpdateGlobalTableResponse] -> ShowS
UpdateGlobalTableResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateGlobalTableResponse] -> ShowS
$cshowList :: [UpdateGlobalTableResponse] -> ShowS
show :: UpdateGlobalTableResponse -> String
$cshow :: UpdateGlobalTableResponse -> String
showsPrec :: Int -> UpdateGlobalTableResponse -> ShowS
$cshowsPrec :: Int -> UpdateGlobalTableResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateGlobalTableResponse x -> UpdateGlobalTableResponse
forall x.
UpdateGlobalTableResponse -> Rep UpdateGlobalTableResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateGlobalTableResponse x -> UpdateGlobalTableResponse
$cfrom :: forall x.
UpdateGlobalTableResponse -> Rep UpdateGlobalTableResponse x
Prelude.Generic)
newUpdateGlobalTableResponse ::
Prelude.Int ->
UpdateGlobalTableResponse
newUpdateGlobalTableResponse :: Int -> UpdateGlobalTableResponse
newUpdateGlobalTableResponse Int
pHttpStatus_ =
UpdateGlobalTableResponse'
{ $sel:globalTableDescription:UpdateGlobalTableResponse' :: Maybe GlobalTableDescription
globalTableDescription =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateGlobalTableResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateGlobalTableResponse_globalTableDescription :: Lens.Lens' UpdateGlobalTableResponse (Prelude.Maybe GlobalTableDescription)
updateGlobalTableResponse_globalTableDescription :: Lens' UpdateGlobalTableResponse (Maybe GlobalTableDescription)
updateGlobalTableResponse_globalTableDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGlobalTableResponse' {Maybe GlobalTableDescription
globalTableDescription :: Maybe GlobalTableDescription
$sel:globalTableDescription:UpdateGlobalTableResponse' :: UpdateGlobalTableResponse -> Maybe GlobalTableDescription
globalTableDescription} -> Maybe GlobalTableDescription
globalTableDescription) (\s :: UpdateGlobalTableResponse
s@UpdateGlobalTableResponse' {} Maybe GlobalTableDescription
a -> UpdateGlobalTableResponse
s {$sel:globalTableDescription:UpdateGlobalTableResponse' :: Maybe GlobalTableDescription
globalTableDescription = Maybe GlobalTableDescription
a} :: UpdateGlobalTableResponse)
updateGlobalTableResponse_httpStatus :: Lens.Lens' UpdateGlobalTableResponse Prelude.Int
updateGlobalTableResponse_httpStatus :: Lens' UpdateGlobalTableResponse Int
updateGlobalTableResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGlobalTableResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateGlobalTableResponse' :: UpdateGlobalTableResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateGlobalTableResponse
s@UpdateGlobalTableResponse' {} Int
a -> UpdateGlobalTableResponse
s {$sel:httpStatus:UpdateGlobalTableResponse' :: Int
httpStatus = Int
a} :: UpdateGlobalTableResponse)
instance Prelude.NFData UpdateGlobalTableResponse where
rnf :: UpdateGlobalTableResponse -> ()
rnf UpdateGlobalTableResponse' {Int
Maybe GlobalTableDescription
httpStatus :: Int
globalTableDescription :: Maybe GlobalTableDescription
$sel:httpStatus:UpdateGlobalTableResponse' :: UpdateGlobalTableResponse -> Int
$sel:globalTableDescription:UpdateGlobalTableResponse' :: UpdateGlobalTableResponse -> Maybe GlobalTableDescription
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe GlobalTableDescription
globalTableDescription
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus