{-# 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 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 UpdateGlobalTable = UpdateGlobalTable'
{
UpdateGlobalTable -> Text
globalTableName :: Prelude.Text,
UpdateGlobalTable -> [ReplicaUpdate]
replicaUpdates :: [ReplicaUpdate]
}
deriving (UpdateGlobalTable -> UpdateGlobalTable -> Bool
(UpdateGlobalTable -> UpdateGlobalTable -> Bool)
-> (UpdateGlobalTable -> UpdateGlobalTable -> Bool)
-> Eq UpdateGlobalTable
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]
(Int -> ReadS UpdateGlobalTable)
-> ReadS [UpdateGlobalTable]
-> ReadPrec UpdateGlobalTable
-> ReadPrec [UpdateGlobalTable]
-> Read 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
(Int -> UpdateGlobalTable -> ShowS)
-> (UpdateGlobalTable -> String)
-> ([UpdateGlobalTable] -> ShowS)
-> Show UpdateGlobalTable
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. UpdateGlobalTable -> Rep UpdateGlobalTable x)
-> (forall x. Rep UpdateGlobalTable x -> UpdateGlobalTable)
-> Generic UpdateGlobalTable
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' :: Text -> [ReplicaUpdate] -> UpdateGlobalTable
UpdateGlobalTable'
{ $sel:globalTableName:UpdateGlobalTable' :: Text
globalTableName =
Text
pGlobalTableName_,
$sel:replicaUpdates:UpdateGlobalTable' :: [ReplicaUpdate]
replicaUpdates = [ReplicaUpdate]
forall a. Monoid a => a
Prelude.mempty
}
updateGlobalTable_globalTableName :: Lens.Lens' UpdateGlobalTable Prelude.Text
updateGlobalTable_globalTableName :: (Text -> f Text) -> UpdateGlobalTable -> f UpdateGlobalTable
updateGlobalTable_globalTableName = (UpdateGlobalTable -> Text)
-> (UpdateGlobalTable -> Text -> UpdateGlobalTable)
-> Lens UpdateGlobalTable UpdateGlobalTable Text Text
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 :: ([ReplicaUpdate] -> f [ReplicaUpdate])
-> UpdateGlobalTable -> f UpdateGlobalTable
updateGlobalTable_replicaUpdates = (UpdateGlobalTable -> [ReplicaUpdate])
-> (UpdateGlobalTable -> [ReplicaUpdate] -> UpdateGlobalTable)
-> Lens
UpdateGlobalTable UpdateGlobalTable [ReplicaUpdate] [ReplicaUpdate]
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) (([ReplicaUpdate] -> f [ReplicaUpdate])
-> UpdateGlobalTable -> f UpdateGlobalTable)
-> (([ReplicaUpdate] -> f [ReplicaUpdate])
-> [ReplicaUpdate] -> f [ReplicaUpdate])
-> ([ReplicaUpdate] -> f [ReplicaUpdate])
-> UpdateGlobalTable
-> f UpdateGlobalTable
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ReplicaUpdate] -> f [ReplicaUpdate])
-> [ReplicaUpdate] -> f [ReplicaUpdate]
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 :: UpdateGlobalTable -> Request UpdateGlobalTable
request = Service -> UpdateGlobalTable -> Request UpdateGlobalTable
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateGlobalTable
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateGlobalTable)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateGlobalTable))
-> Logger
-> Service
-> Proxy UpdateGlobalTable
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateGlobalTable)))
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 GlobalTableDescription -> Int -> UpdateGlobalTableResponse
UpdateGlobalTableResponse'
(Maybe GlobalTableDescription -> Int -> UpdateGlobalTableResponse)
-> Either String (Maybe GlobalTableDescription)
-> Either String (Int -> UpdateGlobalTableResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe GlobalTableDescription)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"GlobalTableDescription")
Either String (Int -> UpdateGlobalTableResponse)
-> Either String Int -> Either String UpdateGlobalTableResponse
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 UpdateGlobalTable
instance Prelude.NFData UpdateGlobalTable
instance Core.ToHeaders UpdateGlobalTable where
toHeaders :: UpdateGlobalTable -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateGlobalTable -> 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.UpdateGlobalTable" ::
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 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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"GlobalTableName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
globalTableName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ReplicaUpdates" Text -> [ReplicaUpdate] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [ReplicaUpdate]
replicaUpdates)
]
)
instance Core.ToPath UpdateGlobalTable where
toPath :: UpdateGlobalTable -> ByteString
toPath = ByteString -> UpdateGlobalTable -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateGlobalTable where
toQuery :: UpdateGlobalTable -> QueryString
toQuery = QueryString -> UpdateGlobalTable -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(UpdateGlobalTableResponse -> UpdateGlobalTableResponse -> Bool)
-> (UpdateGlobalTableResponse -> UpdateGlobalTableResponse -> Bool)
-> Eq UpdateGlobalTableResponse
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]
(Int -> ReadS UpdateGlobalTableResponse)
-> ReadS [UpdateGlobalTableResponse]
-> ReadPrec UpdateGlobalTableResponse
-> ReadPrec [UpdateGlobalTableResponse]
-> Read 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
(Int -> UpdateGlobalTableResponse -> ShowS)
-> (UpdateGlobalTableResponse -> String)
-> ([UpdateGlobalTableResponse] -> ShowS)
-> Show UpdateGlobalTableResponse
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.
UpdateGlobalTableResponse -> Rep UpdateGlobalTableResponse x)
-> (forall x.
Rep UpdateGlobalTableResponse x -> UpdateGlobalTableResponse)
-> Generic UpdateGlobalTableResponse
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' :: Maybe GlobalTableDescription -> Int -> UpdateGlobalTableResponse
UpdateGlobalTableResponse'
{ $sel:globalTableDescription:UpdateGlobalTableResponse' :: Maybe GlobalTableDescription
globalTableDescription =
Maybe GlobalTableDescription
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateGlobalTableResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateGlobalTableResponse_globalTableDescription :: Lens.Lens' UpdateGlobalTableResponse (Prelude.Maybe GlobalTableDescription)
updateGlobalTableResponse_globalTableDescription :: (Maybe GlobalTableDescription -> f (Maybe GlobalTableDescription))
-> UpdateGlobalTableResponse -> f UpdateGlobalTableResponse
updateGlobalTableResponse_globalTableDescription = (UpdateGlobalTableResponse -> Maybe GlobalTableDescription)
-> (UpdateGlobalTableResponse
-> Maybe GlobalTableDescription -> UpdateGlobalTableResponse)
-> Lens
UpdateGlobalTableResponse
UpdateGlobalTableResponse
(Maybe GlobalTableDescription)
(Maybe 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 :: (Int -> f Int)
-> UpdateGlobalTableResponse -> f UpdateGlobalTableResponse
updateGlobalTableResponse_httpStatus = (UpdateGlobalTableResponse -> Int)
-> (UpdateGlobalTableResponse -> Int -> UpdateGlobalTableResponse)
-> Lens UpdateGlobalTableResponse UpdateGlobalTableResponse Int Int
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