{-# 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.DescribeExport
(
DescribeExport (..),
newDescribeExport,
describeExport_exportArn,
DescribeExportResponse (..),
newDescribeExportResponse,
describeExportResponse_exportDescription,
describeExportResponse_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 DescribeExport = DescribeExport'
{
DescribeExport -> Text
exportArn :: Prelude.Text
}
deriving (DescribeExport -> DescribeExport -> Bool
(DescribeExport -> DescribeExport -> Bool)
-> (DescribeExport -> DescribeExport -> Bool) -> Eq DescribeExport
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeExport -> DescribeExport -> Bool
$c/= :: DescribeExport -> DescribeExport -> Bool
== :: DescribeExport -> DescribeExport -> Bool
$c== :: DescribeExport -> DescribeExport -> Bool
Prelude.Eq, ReadPrec [DescribeExport]
ReadPrec DescribeExport
Int -> ReadS DescribeExport
ReadS [DescribeExport]
(Int -> ReadS DescribeExport)
-> ReadS [DescribeExport]
-> ReadPrec DescribeExport
-> ReadPrec [DescribeExport]
-> Read DescribeExport
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeExport]
$creadListPrec :: ReadPrec [DescribeExport]
readPrec :: ReadPrec DescribeExport
$creadPrec :: ReadPrec DescribeExport
readList :: ReadS [DescribeExport]
$creadList :: ReadS [DescribeExport]
readsPrec :: Int -> ReadS DescribeExport
$creadsPrec :: Int -> ReadS DescribeExport
Prelude.Read, Int -> DescribeExport -> ShowS
[DescribeExport] -> ShowS
DescribeExport -> String
(Int -> DescribeExport -> ShowS)
-> (DescribeExport -> String)
-> ([DescribeExport] -> ShowS)
-> Show DescribeExport
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeExport] -> ShowS
$cshowList :: [DescribeExport] -> ShowS
show :: DescribeExport -> String
$cshow :: DescribeExport -> String
showsPrec :: Int -> DescribeExport -> ShowS
$cshowsPrec :: Int -> DescribeExport -> ShowS
Prelude.Show, (forall x. DescribeExport -> Rep DescribeExport x)
-> (forall x. Rep DescribeExport x -> DescribeExport)
-> Generic DescribeExport
forall x. Rep DescribeExport x -> DescribeExport
forall x. DescribeExport -> Rep DescribeExport x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeExport x -> DescribeExport
$cfrom :: forall x. DescribeExport -> Rep DescribeExport x
Prelude.Generic)
newDescribeExport ::
Prelude.Text ->
DescribeExport
newDescribeExport :: Text -> DescribeExport
newDescribeExport Text
pExportArn_ =
DescribeExport' :: Text -> DescribeExport
DescribeExport' {$sel:exportArn:DescribeExport' :: Text
exportArn = Text
pExportArn_}
describeExport_exportArn :: Lens.Lens' DescribeExport Prelude.Text
describeExport_exportArn :: (Text -> f Text) -> DescribeExport -> f DescribeExport
describeExport_exportArn = (DescribeExport -> Text)
-> (DescribeExport -> Text -> DescribeExport)
-> Lens DescribeExport DescribeExport Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeExport' {Text
exportArn :: Text
$sel:exportArn:DescribeExport' :: DescribeExport -> Text
exportArn} -> Text
exportArn) (\s :: DescribeExport
s@DescribeExport' {} Text
a -> DescribeExport
s {$sel:exportArn:DescribeExport' :: Text
exportArn = Text
a} :: DescribeExport)
instance Core.AWSRequest DescribeExport where
type
AWSResponse DescribeExport =
DescribeExportResponse
request :: DescribeExport -> Request DescribeExport
request = Service -> DescribeExport -> Request DescribeExport
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeExport
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeExport)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeExport))
-> Logger
-> Service
-> Proxy DescribeExport
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeExport)))
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 ExportDescription -> Int -> DescribeExportResponse
DescribeExportResponse'
(Maybe ExportDescription -> Int -> DescribeExportResponse)
-> Either String (Maybe ExportDescription)
-> Either String (Int -> DescribeExportResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ExportDescription)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ExportDescription")
Either String (Int -> DescribeExportResponse)
-> Either String Int -> Either String DescribeExportResponse
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 DescribeExport
instance Prelude.NFData DescribeExport
instance Core.ToHeaders DescribeExport where
toHeaders :: DescribeExport -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeExport -> 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.DescribeExport" ::
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 DescribeExport where
toJSON :: DescribeExport -> Value
toJSON DescribeExport' {Text
exportArn :: Text
$sel:exportArn:DescribeExport' :: DescribeExport -> 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
"ExportArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
exportArn)]
)
instance Core.ToPath DescribeExport where
toPath :: DescribeExport -> ByteString
toPath = ByteString -> DescribeExport -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeExport where
toQuery :: DescribeExport -> QueryString
toQuery = QueryString -> DescribeExport -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeExportResponse = DescribeExportResponse'
{
DescribeExportResponse -> Maybe ExportDescription
exportDescription :: Prelude.Maybe ExportDescription,
DescribeExportResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeExportResponse -> DescribeExportResponse -> Bool
(DescribeExportResponse -> DescribeExportResponse -> Bool)
-> (DescribeExportResponse -> DescribeExportResponse -> Bool)
-> Eq DescribeExportResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeExportResponse -> DescribeExportResponse -> Bool
$c/= :: DescribeExportResponse -> DescribeExportResponse -> Bool
== :: DescribeExportResponse -> DescribeExportResponse -> Bool
$c== :: DescribeExportResponse -> DescribeExportResponse -> Bool
Prelude.Eq, ReadPrec [DescribeExportResponse]
ReadPrec DescribeExportResponse
Int -> ReadS DescribeExportResponse
ReadS [DescribeExportResponse]
(Int -> ReadS DescribeExportResponse)
-> ReadS [DescribeExportResponse]
-> ReadPrec DescribeExportResponse
-> ReadPrec [DescribeExportResponse]
-> Read DescribeExportResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeExportResponse]
$creadListPrec :: ReadPrec [DescribeExportResponse]
readPrec :: ReadPrec DescribeExportResponse
$creadPrec :: ReadPrec DescribeExportResponse
readList :: ReadS [DescribeExportResponse]
$creadList :: ReadS [DescribeExportResponse]
readsPrec :: Int -> ReadS DescribeExportResponse
$creadsPrec :: Int -> ReadS DescribeExportResponse
Prelude.Read, Int -> DescribeExportResponse -> ShowS
[DescribeExportResponse] -> ShowS
DescribeExportResponse -> String
(Int -> DescribeExportResponse -> ShowS)
-> (DescribeExportResponse -> String)
-> ([DescribeExportResponse] -> ShowS)
-> Show DescribeExportResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeExportResponse] -> ShowS
$cshowList :: [DescribeExportResponse] -> ShowS
show :: DescribeExportResponse -> String
$cshow :: DescribeExportResponse -> String
showsPrec :: Int -> DescribeExportResponse -> ShowS
$cshowsPrec :: Int -> DescribeExportResponse -> ShowS
Prelude.Show, (forall x. DescribeExportResponse -> Rep DescribeExportResponse x)
-> (forall x.
Rep DescribeExportResponse x -> DescribeExportResponse)
-> Generic DescribeExportResponse
forall x. Rep DescribeExportResponse x -> DescribeExportResponse
forall x. DescribeExportResponse -> Rep DescribeExportResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeExportResponse x -> DescribeExportResponse
$cfrom :: forall x. DescribeExportResponse -> Rep DescribeExportResponse x
Prelude.Generic)
newDescribeExportResponse ::
Prelude.Int ->
DescribeExportResponse
newDescribeExportResponse :: Int -> DescribeExportResponse
newDescribeExportResponse Int
pHttpStatus_ =
DescribeExportResponse' :: Maybe ExportDescription -> Int -> DescribeExportResponse
DescribeExportResponse'
{ $sel:exportDescription:DescribeExportResponse' :: Maybe ExportDescription
exportDescription =
Maybe ExportDescription
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeExportResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeExportResponse_exportDescription :: Lens.Lens' DescribeExportResponse (Prelude.Maybe ExportDescription)
describeExportResponse_exportDescription :: (Maybe ExportDescription -> f (Maybe ExportDescription))
-> DescribeExportResponse -> f DescribeExportResponse
describeExportResponse_exportDescription = (DescribeExportResponse -> Maybe ExportDescription)
-> (DescribeExportResponse
-> Maybe ExportDescription -> DescribeExportResponse)
-> Lens
DescribeExportResponse
DescribeExportResponse
(Maybe ExportDescription)
(Maybe ExportDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeExportResponse' {Maybe ExportDescription
exportDescription :: Maybe ExportDescription
$sel:exportDescription:DescribeExportResponse' :: DescribeExportResponse -> Maybe ExportDescription
exportDescription} -> Maybe ExportDescription
exportDescription) (\s :: DescribeExportResponse
s@DescribeExportResponse' {} Maybe ExportDescription
a -> DescribeExportResponse
s {$sel:exportDescription:DescribeExportResponse' :: Maybe ExportDescription
exportDescription = Maybe ExportDescription
a} :: DescribeExportResponse)
describeExportResponse_httpStatus :: Lens.Lens' DescribeExportResponse Prelude.Int
describeExportResponse_httpStatus :: (Int -> f Int)
-> DescribeExportResponse -> f DescribeExportResponse
describeExportResponse_httpStatus = (DescribeExportResponse -> Int)
-> (DescribeExportResponse -> Int -> DescribeExportResponse)
-> Lens DescribeExportResponse DescribeExportResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeExportResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeExportResponse' :: DescribeExportResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeExportResponse
s@DescribeExportResponse' {} Int
a -> DescribeExportResponse
s {$sel:httpStatus:DescribeExportResponse' :: Int
httpStatus = Int
a} :: DescribeExportResponse)
instance Prelude.NFData DescribeExportResponse