{-# 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.DescribeGlobalTable
(
DescribeGlobalTable (..),
newDescribeGlobalTable,
describeGlobalTable_globalTableName,
DescribeGlobalTableResponse (..),
newDescribeGlobalTableResponse,
describeGlobalTableResponse_globalTableDescription,
describeGlobalTableResponse_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 DescribeGlobalTable = DescribeGlobalTable'
{
DescribeGlobalTable -> Text
globalTableName :: Prelude.Text
}
deriving (DescribeGlobalTable -> DescribeGlobalTable -> Bool
(DescribeGlobalTable -> DescribeGlobalTable -> Bool)
-> (DescribeGlobalTable -> DescribeGlobalTable -> Bool)
-> Eq DescribeGlobalTable
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeGlobalTable -> DescribeGlobalTable -> Bool
$c/= :: DescribeGlobalTable -> DescribeGlobalTable -> Bool
== :: DescribeGlobalTable -> DescribeGlobalTable -> Bool
$c== :: DescribeGlobalTable -> DescribeGlobalTable -> Bool
Prelude.Eq, ReadPrec [DescribeGlobalTable]
ReadPrec DescribeGlobalTable
Int -> ReadS DescribeGlobalTable
ReadS [DescribeGlobalTable]
(Int -> ReadS DescribeGlobalTable)
-> ReadS [DescribeGlobalTable]
-> ReadPrec DescribeGlobalTable
-> ReadPrec [DescribeGlobalTable]
-> Read DescribeGlobalTable
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeGlobalTable]
$creadListPrec :: ReadPrec [DescribeGlobalTable]
readPrec :: ReadPrec DescribeGlobalTable
$creadPrec :: ReadPrec DescribeGlobalTable
readList :: ReadS [DescribeGlobalTable]
$creadList :: ReadS [DescribeGlobalTable]
readsPrec :: Int -> ReadS DescribeGlobalTable
$creadsPrec :: Int -> ReadS DescribeGlobalTable
Prelude.Read, Int -> DescribeGlobalTable -> ShowS
[DescribeGlobalTable] -> ShowS
DescribeGlobalTable -> String
(Int -> DescribeGlobalTable -> ShowS)
-> (DescribeGlobalTable -> String)
-> ([DescribeGlobalTable] -> ShowS)
-> Show DescribeGlobalTable
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeGlobalTable] -> ShowS
$cshowList :: [DescribeGlobalTable] -> ShowS
show :: DescribeGlobalTable -> String
$cshow :: DescribeGlobalTable -> String
showsPrec :: Int -> DescribeGlobalTable -> ShowS
$cshowsPrec :: Int -> DescribeGlobalTable -> ShowS
Prelude.Show, (forall x. DescribeGlobalTable -> Rep DescribeGlobalTable x)
-> (forall x. Rep DescribeGlobalTable x -> DescribeGlobalTable)
-> Generic DescribeGlobalTable
forall x. Rep DescribeGlobalTable x -> DescribeGlobalTable
forall x. DescribeGlobalTable -> Rep DescribeGlobalTable x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeGlobalTable x -> DescribeGlobalTable
$cfrom :: forall x. DescribeGlobalTable -> Rep DescribeGlobalTable x
Prelude.Generic)
newDescribeGlobalTable ::
Prelude.Text ->
DescribeGlobalTable
newDescribeGlobalTable :: Text -> DescribeGlobalTable
newDescribeGlobalTable Text
pGlobalTableName_ =
DescribeGlobalTable' :: Text -> DescribeGlobalTable
DescribeGlobalTable'
{ $sel:globalTableName:DescribeGlobalTable' :: Text
globalTableName =
Text
pGlobalTableName_
}
describeGlobalTable_globalTableName :: Lens.Lens' DescribeGlobalTable Prelude.Text
describeGlobalTable_globalTableName :: (Text -> f Text) -> DescribeGlobalTable -> f DescribeGlobalTable
describeGlobalTable_globalTableName = (DescribeGlobalTable -> Text)
-> (DescribeGlobalTable -> Text -> DescribeGlobalTable)
-> Lens DescribeGlobalTable DescribeGlobalTable Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGlobalTable' {Text
globalTableName :: Text
$sel:globalTableName:DescribeGlobalTable' :: DescribeGlobalTable -> Text
globalTableName} -> Text
globalTableName) (\s :: DescribeGlobalTable
s@DescribeGlobalTable' {} Text
a -> DescribeGlobalTable
s {$sel:globalTableName:DescribeGlobalTable' :: Text
globalTableName = Text
a} :: DescribeGlobalTable)
instance Core.AWSRequest DescribeGlobalTable where
type
AWSResponse DescribeGlobalTable =
DescribeGlobalTableResponse
request :: DescribeGlobalTable -> Request DescribeGlobalTable
request = Service -> DescribeGlobalTable -> Request DescribeGlobalTable
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeGlobalTable
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeGlobalTable)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeGlobalTable))
-> Logger
-> Service
-> Proxy DescribeGlobalTable
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeGlobalTable)))
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 -> DescribeGlobalTableResponse
DescribeGlobalTableResponse'
(Maybe GlobalTableDescription
-> Int -> DescribeGlobalTableResponse)
-> Either String (Maybe GlobalTableDescription)
-> Either String (Int -> DescribeGlobalTableResponse)
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 -> DescribeGlobalTableResponse)
-> Either String Int -> Either String DescribeGlobalTableResponse
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 DescribeGlobalTable
instance Prelude.NFData DescribeGlobalTable
instance Core.ToHeaders DescribeGlobalTable where
toHeaders :: DescribeGlobalTable -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeGlobalTable -> 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.DescribeGlobalTable" ::
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 DescribeGlobalTable where
toJSON :: DescribeGlobalTable -> Value
toJSON DescribeGlobalTable' {Text
globalTableName :: Text
$sel:globalTableName:DescribeGlobalTable' :: DescribeGlobalTable -> 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)
]
)
instance Core.ToPath DescribeGlobalTable where
toPath :: DescribeGlobalTable -> ByteString
toPath = ByteString -> DescribeGlobalTable -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeGlobalTable where
toQuery :: DescribeGlobalTable -> QueryString
toQuery = QueryString -> DescribeGlobalTable -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeGlobalTableResponse = DescribeGlobalTableResponse'
{
DescribeGlobalTableResponse -> Maybe GlobalTableDescription
globalTableDescription :: Prelude.Maybe GlobalTableDescription,
DescribeGlobalTableResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeGlobalTableResponse -> DescribeGlobalTableResponse -> Bool
(DescribeGlobalTableResponse
-> DescribeGlobalTableResponse -> Bool)
-> (DescribeGlobalTableResponse
-> DescribeGlobalTableResponse -> Bool)
-> Eq DescribeGlobalTableResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeGlobalTableResponse -> DescribeGlobalTableResponse -> Bool
$c/= :: DescribeGlobalTableResponse -> DescribeGlobalTableResponse -> Bool
== :: DescribeGlobalTableResponse -> DescribeGlobalTableResponse -> Bool
$c== :: DescribeGlobalTableResponse -> DescribeGlobalTableResponse -> Bool
Prelude.Eq, ReadPrec [DescribeGlobalTableResponse]
ReadPrec DescribeGlobalTableResponse
Int -> ReadS DescribeGlobalTableResponse
ReadS [DescribeGlobalTableResponse]
(Int -> ReadS DescribeGlobalTableResponse)
-> ReadS [DescribeGlobalTableResponse]
-> ReadPrec DescribeGlobalTableResponse
-> ReadPrec [DescribeGlobalTableResponse]
-> Read DescribeGlobalTableResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeGlobalTableResponse]
$creadListPrec :: ReadPrec [DescribeGlobalTableResponse]
readPrec :: ReadPrec DescribeGlobalTableResponse
$creadPrec :: ReadPrec DescribeGlobalTableResponse
readList :: ReadS [DescribeGlobalTableResponse]
$creadList :: ReadS [DescribeGlobalTableResponse]
readsPrec :: Int -> ReadS DescribeGlobalTableResponse
$creadsPrec :: Int -> ReadS DescribeGlobalTableResponse
Prelude.Read, Int -> DescribeGlobalTableResponse -> ShowS
[DescribeGlobalTableResponse] -> ShowS
DescribeGlobalTableResponse -> String
(Int -> DescribeGlobalTableResponse -> ShowS)
-> (DescribeGlobalTableResponse -> String)
-> ([DescribeGlobalTableResponse] -> ShowS)
-> Show DescribeGlobalTableResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeGlobalTableResponse] -> ShowS
$cshowList :: [DescribeGlobalTableResponse] -> ShowS
show :: DescribeGlobalTableResponse -> String
$cshow :: DescribeGlobalTableResponse -> String
showsPrec :: Int -> DescribeGlobalTableResponse -> ShowS
$cshowsPrec :: Int -> DescribeGlobalTableResponse -> ShowS
Prelude.Show, (forall x.
DescribeGlobalTableResponse -> Rep DescribeGlobalTableResponse x)
-> (forall x.
Rep DescribeGlobalTableResponse x -> DescribeGlobalTableResponse)
-> Generic DescribeGlobalTableResponse
forall x.
Rep DescribeGlobalTableResponse x -> DescribeGlobalTableResponse
forall x.
DescribeGlobalTableResponse -> Rep DescribeGlobalTableResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeGlobalTableResponse x -> DescribeGlobalTableResponse
$cfrom :: forall x.
DescribeGlobalTableResponse -> Rep DescribeGlobalTableResponse x
Prelude.Generic)
newDescribeGlobalTableResponse ::
Prelude.Int ->
DescribeGlobalTableResponse
newDescribeGlobalTableResponse :: Int -> DescribeGlobalTableResponse
newDescribeGlobalTableResponse Int
pHttpStatus_ =
DescribeGlobalTableResponse' :: Maybe GlobalTableDescription -> Int -> DescribeGlobalTableResponse
DescribeGlobalTableResponse'
{ $sel:globalTableDescription:DescribeGlobalTableResponse' :: Maybe GlobalTableDescription
globalTableDescription =
Maybe GlobalTableDescription
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeGlobalTableResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeGlobalTableResponse_globalTableDescription :: Lens.Lens' DescribeGlobalTableResponse (Prelude.Maybe GlobalTableDescription)
describeGlobalTableResponse_globalTableDescription :: (Maybe GlobalTableDescription -> f (Maybe GlobalTableDescription))
-> DescribeGlobalTableResponse -> f DescribeGlobalTableResponse
describeGlobalTableResponse_globalTableDescription = (DescribeGlobalTableResponse -> Maybe GlobalTableDescription)
-> (DescribeGlobalTableResponse
-> Maybe GlobalTableDescription -> DescribeGlobalTableResponse)
-> Lens
DescribeGlobalTableResponse
DescribeGlobalTableResponse
(Maybe GlobalTableDescription)
(Maybe GlobalTableDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGlobalTableResponse' {Maybe GlobalTableDescription
globalTableDescription :: Maybe GlobalTableDescription
$sel:globalTableDescription:DescribeGlobalTableResponse' :: DescribeGlobalTableResponse -> Maybe GlobalTableDescription
globalTableDescription} -> Maybe GlobalTableDescription
globalTableDescription) (\s :: DescribeGlobalTableResponse
s@DescribeGlobalTableResponse' {} Maybe GlobalTableDescription
a -> DescribeGlobalTableResponse
s {$sel:globalTableDescription:DescribeGlobalTableResponse' :: Maybe GlobalTableDescription
globalTableDescription = Maybe GlobalTableDescription
a} :: DescribeGlobalTableResponse)
describeGlobalTableResponse_httpStatus :: Lens.Lens' DescribeGlobalTableResponse Prelude.Int
describeGlobalTableResponse_httpStatus :: (Int -> f Int)
-> DescribeGlobalTableResponse -> f DescribeGlobalTableResponse
describeGlobalTableResponse_httpStatus = (DescribeGlobalTableResponse -> Int)
-> (DescribeGlobalTableResponse
-> Int -> DescribeGlobalTableResponse)
-> Lens
DescribeGlobalTableResponse DescribeGlobalTableResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGlobalTableResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeGlobalTableResponse' :: DescribeGlobalTableResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeGlobalTableResponse
s@DescribeGlobalTableResponse' {} Int
a -> DescribeGlobalTableResponse
s {$sel:httpStatus:DescribeGlobalTableResponse' :: Int
httpStatus = Int
a} :: DescribeGlobalTableResponse)
instance Prelude.NFData DescribeGlobalTableResponse