{-# 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.Athena.GetTableMetadata
(
GetTableMetadata (..),
newGetTableMetadata,
getTableMetadata_catalogName,
getTableMetadata_databaseName,
getTableMetadata_tableName,
GetTableMetadataResponse (..),
newGetTableMetadataResponse,
getTableMetadataResponse_tableMetadata,
getTableMetadataResponse_httpStatus,
)
where
import Amazonka.Athena.Types
import qualified Amazonka.Core as Core
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 GetTableMetadata = GetTableMetadata'
{
GetTableMetadata -> Text
catalogName :: Prelude.Text,
GetTableMetadata -> Text
databaseName :: Prelude.Text,
GetTableMetadata -> Text
tableName :: Prelude.Text
}
deriving (GetTableMetadata -> GetTableMetadata -> Bool
(GetTableMetadata -> GetTableMetadata -> Bool)
-> (GetTableMetadata -> GetTableMetadata -> Bool)
-> Eq GetTableMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTableMetadata -> GetTableMetadata -> Bool
$c/= :: GetTableMetadata -> GetTableMetadata -> Bool
== :: GetTableMetadata -> GetTableMetadata -> Bool
$c== :: GetTableMetadata -> GetTableMetadata -> Bool
Prelude.Eq, ReadPrec [GetTableMetadata]
ReadPrec GetTableMetadata
Int -> ReadS GetTableMetadata
ReadS [GetTableMetadata]
(Int -> ReadS GetTableMetadata)
-> ReadS [GetTableMetadata]
-> ReadPrec GetTableMetadata
-> ReadPrec [GetTableMetadata]
-> Read GetTableMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTableMetadata]
$creadListPrec :: ReadPrec [GetTableMetadata]
readPrec :: ReadPrec GetTableMetadata
$creadPrec :: ReadPrec GetTableMetadata
readList :: ReadS [GetTableMetadata]
$creadList :: ReadS [GetTableMetadata]
readsPrec :: Int -> ReadS GetTableMetadata
$creadsPrec :: Int -> ReadS GetTableMetadata
Prelude.Read, Int -> GetTableMetadata -> ShowS
[GetTableMetadata] -> ShowS
GetTableMetadata -> String
(Int -> GetTableMetadata -> ShowS)
-> (GetTableMetadata -> String)
-> ([GetTableMetadata] -> ShowS)
-> Show GetTableMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTableMetadata] -> ShowS
$cshowList :: [GetTableMetadata] -> ShowS
show :: GetTableMetadata -> String
$cshow :: GetTableMetadata -> String
showsPrec :: Int -> GetTableMetadata -> ShowS
$cshowsPrec :: Int -> GetTableMetadata -> ShowS
Prelude.Show, (forall x. GetTableMetadata -> Rep GetTableMetadata x)
-> (forall x. Rep GetTableMetadata x -> GetTableMetadata)
-> Generic GetTableMetadata
forall x. Rep GetTableMetadata x -> GetTableMetadata
forall x. GetTableMetadata -> Rep GetTableMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTableMetadata x -> GetTableMetadata
$cfrom :: forall x. GetTableMetadata -> Rep GetTableMetadata x
Prelude.Generic)
newGetTableMetadata ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
GetTableMetadata
newGetTableMetadata :: Text -> Text -> Text -> GetTableMetadata
newGetTableMetadata
Text
pCatalogName_
Text
pDatabaseName_
Text
pTableName_ =
GetTableMetadata' :: Text -> Text -> Text -> GetTableMetadata
GetTableMetadata'
{ $sel:catalogName:GetTableMetadata' :: Text
catalogName = Text
pCatalogName_,
$sel:databaseName:GetTableMetadata' :: Text
databaseName = Text
pDatabaseName_,
$sel:tableName:GetTableMetadata' :: Text
tableName = Text
pTableName_
}
getTableMetadata_catalogName :: Lens.Lens' GetTableMetadata Prelude.Text
getTableMetadata_catalogName :: (Text -> f Text) -> GetTableMetadata -> f GetTableMetadata
getTableMetadata_catalogName = (GetTableMetadata -> Text)
-> (GetTableMetadata -> Text -> GetTableMetadata)
-> Lens GetTableMetadata GetTableMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTableMetadata' {Text
catalogName :: Text
$sel:catalogName:GetTableMetadata' :: GetTableMetadata -> Text
catalogName} -> Text
catalogName) (\s :: GetTableMetadata
s@GetTableMetadata' {} Text
a -> GetTableMetadata
s {$sel:catalogName:GetTableMetadata' :: Text
catalogName = Text
a} :: GetTableMetadata)
getTableMetadata_databaseName :: Lens.Lens' GetTableMetadata Prelude.Text
getTableMetadata_databaseName :: (Text -> f Text) -> GetTableMetadata -> f GetTableMetadata
getTableMetadata_databaseName = (GetTableMetadata -> Text)
-> (GetTableMetadata -> Text -> GetTableMetadata)
-> Lens GetTableMetadata GetTableMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTableMetadata' {Text
databaseName :: Text
$sel:databaseName:GetTableMetadata' :: GetTableMetadata -> Text
databaseName} -> Text
databaseName) (\s :: GetTableMetadata
s@GetTableMetadata' {} Text
a -> GetTableMetadata
s {$sel:databaseName:GetTableMetadata' :: Text
databaseName = Text
a} :: GetTableMetadata)
getTableMetadata_tableName :: Lens.Lens' GetTableMetadata Prelude.Text
getTableMetadata_tableName :: (Text -> f Text) -> GetTableMetadata -> f GetTableMetadata
getTableMetadata_tableName = (GetTableMetadata -> Text)
-> (GetTableMetadata -> Text -> GetTableMetadata)
-> Lens GetTableMetadata GetTableMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTableMetadata' {Text
tableName :: Text
$sel:tableName:GetTableMetadata' :: GetTableMetadata -> Text
tableName} -> Text
tableName) (\s :: GetTableMetadata
s@GetTableMetadata' {} Text
a -> GetTableMetadata
s {$sel:tableName:GetTableMetadata' :: Text
tableName = Text
a} :: GetTableMetadata)
instance Core.AWSRequest GetTableMetadata where
type
AWSResponse GetTableMetadata =
GetTableMetadataResponse
request :: GetTableMetadata -> Request GetTableMetadata
request = Service -> GetTableMetadata -> Request GetTableMetadata
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetTableMetadata
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetTableMetadata)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetTableMetadata))
-> Logger
-> Service
-> Proxy GetTableMetadata
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetTableMetadata)))
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 TableMetadata -> Int -> GetTableMetadataResponse
GetTableMetadataResponse'
(Maybe TableMetadata -> Int -> GetTableMetadataResponse)
-> Either String (Maybe TableMetadata)
-> Either String (Int -> GetTableMetadataResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe TableMetadata)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TableMetadata")
Either String (Int -> GetTableMetadataResponse)
-> Either String Int -> Either String GetTableMetadataResponse
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 GetTableMetadata
instance Prelude.NFData GetTableMetadata
instance Core.ToHeaders GetTableMetadata where
toHeaders :: GetTableMetadata -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetTableMetadata -> 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
"AmazonAthena.GetTableMetadata" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON GetTableMetadata where
toJSON :: GetTableMetadata -> Value
toJSON GetTableMetadata' {Text
tableName :: Text
databaseName :: Text
catalogName :: Text
$sel:tableName:GetTableMetadata' :: GetTableMetadata -> Text
$sel:databaseName:GetTableMetadata' :: GetTableMetadata -> Text
$sel:catalogName:GetTableMetadata' :: GetTableMetadata -> 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
"CatalogName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
catalogName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DatabaseName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
databaseName),
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)
]
)
instance Core.ToPath GetTableMetadata where
toPath :: GetTableMetadata -> ByteString
toPath = ByteString -> GetTableMetadata -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetTableMetadata where
toQuery :: GetTableMetadata -> QueryString
toQuery = QueryString -> GetTableMetadata -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetTableMetadataResponse = GetTableMetadataResponse'
{
GetTableMetadataResponse -> Maybe TableMetadata
tableMetadata :: Prelude.Maybe TableMetadata,
GetTableMetadataResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetTableMetadataResponse -> GetTableMetadataResponse -> Bool
(GetTableMetadataResponse -> GetTableMetadataResponse -> Bool)
-> (GetTableMetadataResponse -> GetTableMetadataResponse -> Bool)
-> Eq GetTableMetadataResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTableMetadataResponse -> GetTableMetadataResponse -> Bool
$c/= :: GetTableMetadataResponse -> GetTableMetadataResponse -> Bool
== :: GetTableMetadataResponse -> GetTableMetadataResponse -> Bool
$c== :: GetTableMetadataResponse -> GetTableMetadataResponse -> Bool
Prelude.Eq, ReadPrec [GetTableMetadataResponse]
ReadPrec GetTableMetadataResponse
Int -> ReadS GetTableMetadataResponse
ReadS [GetTableMetadataResponse]
(Int -> ReadS GetTableMetadataResponse)
-> ReadS [GetTableMetadataResponse]
-> ReadPrec GetTableMetadataResponse
-> ReadPrec [GetTableMetadataResponse]
-> Read GetTableMetadataResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTableMetadataResponse]
$creadListPrec :: ReadPrec [GetTableMetadataResponse]
readPrec :: ReadPrec GetTableMetadataResponse
$creadPrec :: ReadPrec GetTableMetadataResponse
readList :: ReadS [GetTableMetadataResponse]
$creadList :: ReadS [GetTableMetadataResponse]
readsPrec :: Int -> ReadS GetTableMetadataResponse
$creadsPrec :: Int -> ReadS GetTableMetadataResponse
Prelude.Read, Int -> GetTableMetadataResponse -> ShowS
[GetTableMetadataResponse] -> ShowS
GetTableMetadataResponse -> String
(Int -> GetTableMetadataResponse -> ShowS)
-> (GetTableMetadataResponse -> String)
-> ([GetTableMetadataResponse] -> ShowS)
-> Show GetTableMetadataResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTableMetadataResponse] -> ShowS
$cshowList :: [GetTableMetadataResponse] -> ShowS
show :: GetTableMetadataResponse -> String
$cshow :: GetTableMetadataResponse -> String
showsPrec :: Int -> GetTableMetadataResponse -> ShowS
$cshowsPrec :: Int -> GetTableMetadataResponse -> ShowS
Prelude.Show, (forall x.
GetTableMetadataResponse -> Rep GetTableMetadataResponse x)
-> (forall x.
Rep GetTableMetadataResponse x -> GetTableMetadataResponse)
-> Generic GetTableMetadataResponse
forall x.
Rep GetTableMetadataResponse x -> GetTableMetadataResponse
forall x.
GetTableMetadataResponse -> Rep GetTableMetadataResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetTableMetadataResponse x -> GetTableMetadataResponse
$cfrom :: forall x.
GetTableMetadataResponse -> Rep GetTableMetadataResponse x
Prelude.Generic)
newGetTableMetadataResponse ::
Prelude.Int ->
GetTableMetadataResponse
newGetTableMetadataResponse :: Int -> GetTableMetadataResponse
newGetTableMetadataResponse Int
pHttpStatus_ =
GetTableMetadataResponse' :: Maybe TableMetadata -> Int -> GetTableMetadataResponse
GetTableMetadataResponse'
{ $sel:tableMetadata:GetTableMetadataResponse' :: Maybe TableMetadata
tableMetadata =
Maybe TableMetadata
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetTableMetadataResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getTableMetadataResponse_tableMetadata :: Lens.Lens' GetTableMetadataResponse (Prelude.Maybe TableMetadata)
getTableMetadataResponse_tableMetadata :: (Maybe TableMetadata -> f (Maybe TableMetadata))
-> GetTableMetadataResponse -> f GetTableMetadataResponse
getTableMetadataResponse_tableMetadata = (GetTableMetadataResponse -> Maybe TableMetadata)
-> (GetTableMetadataResponse
-> Maybe TableMetadata -> GetTableMetadataResponse)
-> Lens
GetTableMetadataResponse
GetTableMetadataResponse
(Maybe TableMetadata)
(Maybe TableMetadata)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTableMetadataResponse' {Maybe TableMetadata
tableMetadata :: Maybe TableMetadata
$sel:tableMetadata:GetTableMetadataResponse' :: GetTableMetadataResponse -> Maybe TableMetadata
tableMetadata} -> Maybe TableMetadata
tableMetadata) (\s :: GetTableMetadataResponse
s@GetTableMetadataResponse' {} Maybe TableMetadata
a -> GetTableMetadataResponse
s {$sel:tableMetadata:GetTableMetadataResponse' :: Maybe TableMetadata
tableMetadata = Maybe TableMetadata
a} :: GetTableMetadataResponse)
getTableMetadataResponse_httpStatus :: Lens.Lens' GetTableMetadataResponse Prelude.Int
getTableMetadataResponse_httpStatus :: (Int -> f Int)
-> GetTableMetadataResponse -> f GetTableMetadataResponse
getTableMetadataResponse_httpStatus = (GetTableMetadataResponse -> Int)
-> (GetTableMetadataResponse -> Int -> GetTableMetadataResponse)
-> Lens GetTableMetadataResponse GetTableMetadataResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTableMetadataResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetTableMetadataResponse' :: GetTableMetadataResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetTableMetadataResponse
s@GetTableMetadataResponse' {} Int
a -> GetTableMetadataResponse
s {$sel:httpStatus:GetTableMetadataResponse' :: Int
httpStatus = Int
a} :: GetTableMetadataResponse)
instance Prelude.NFData GetTableMetadataResponse