{-# 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.Glue.GetTable
(
GetTable (..),
newGetTable,
getTable_catalogId,
getTable_queryAsOfTime,
getTable_transactionId,
getTable_databaseName,
getTable_name,
GetTableResponse (..),
newGetTableResponse,
getTableResponse_table,
getTableResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Glue.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetTable = GetTable'
{
GetTable -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
GetTable -> Maybe POSIX
queryAsOfTime :: Prelude.Maybe Data.POSIX,
GetTable -> Maybe Text
transactionId :: Prelude.Maybe Prelude.Text,
GetTable -> Text
databaseName :: Prelude.Text,
GetTable -> Text
name :: Prelude.Text
}
deriving (GetTable -> GetTable -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTable -> GetTable -> Bool
$c/= :: GetTable -> GetTable -> Bool
== :: GetTable -> GetTable -> Bool
$c== :: GetTable -> GetTable -> Bool
Prelude.Eq, ReadPrec [GetTable]
ReadPrec GetTable
Int -> ReadS GetTable
ReadS [GetTable]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTable]
$creadListPrec :: ReadPrec [GetTable]
readPrec :: ReadPrec GetTable
$creadPrec :: ReadPrec GetTable
readList :: ReadS [GetTable]
$creadList :: ReadS [GetTable]
readsPrec :: Int -> ReadS GetTable
$creadsPrec :: Int -> ReadS GetTable
Prelude.Read, Int -> GetTable -> ShowS
[GetTable] -> ShowS
GetTable -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTable] -> ShowS
$cshowList :: [GetTable] -> ShowS
show :: GetTable -> String
$cshow :: GetTable -> String
showsPrec :: Int -> GetTable -> ShowS
$cshowsPrec :: Int -> GetTable -> ShowS
Prelude.Show, forall x. Rep GetTable x -> GetTable
forall x. GetTable -> Rep GetTable x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTable x -> GetTable
$cfrom :: forall x. GetTable -> Rep GetTable x
Prelude.Generic)
newGetTable ::
Prelude.Text ->
Prelude.Text ->
GetTable
newGetTable :: Text -> Text -> GetTable
newGetTable Text
pDatabaseName_ Text
pName_ =
GetTable'
{ $sel:catalogId:GetTable' :: Maybe Text
catalogId = forall a. Maybe a
Prelude.Nothing,
$sel:queryAsOfTime:GetTable' :: Maybe POSIX
queryAsOfTime = forall a. Maybe a
Prelude.Nothing,
$sel:transactionId:GetTable' :: Maybe Text
transactionId = forall a. Maybe a
Prelude.Nothing,
$sel:databaseName:GetTable' :: Text
databaseName = Text
pDatabaseName_,
$sel:name:GetTable' :: Text
name = Text
pName_
}
getTable_catalogId :: Lens.Lens' GetTable (Prelude.Maybe Prelude.Text)
getTable_catalogId :: Lens' GetTable (Maybe Text)
getTable_catalogId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTable' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:GetTable' :: GetTable -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: GetTable
s@GetTable' {} Maybe Text
a -> GetTable
s {$sel:catalogId:GetTable' :: Maybe Text
catalogId = Maybe Text
a} :: GetTable)
getTable_queryAsOfTime :: Lens.Lens' GetTable (Prelude.Maybe Prelude.UTCTime)
getTable_queryAsOfTime :: Lens' GetTable (Maybe UTCTime)
getTable_queryAsOfTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTable' {Maybe POSIX
queryAsOfTime :: Maybe POSIX
$sel:queryAsOfTime:GetTable' :: GetTable -> Maybe POSIX
queryAsOfTime} -> Maybe POSIX
queryAsOfTime) (\s :: GetTable
s@GetTable' {} Maybe POSIX
a -> GetTable
s {$sel:queryAsOfTime:GetTable' :: Maybe POSIX
queryAsOfTime = Maybe POSIX
a} :: GetTable) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
getTable_transactionId :: Lens.Lens' GetTable (Prelude.Maybe Prelude.Text)
getTable_transactionId :: Lens' GetTable (Maybe Text)
getTable_transactionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTable' {Maybe Text
transactionId :: Maybe Text
$sel:transactionId:GetTable' :: GetTable -> Maybe Text
transactionId} -> Maybe Text
transactionId) (\s :: GetTable
s@GetTable' {} Maybe Text
a -> GetTable
s {$sel:transactionId:GetTable' :: Maybe Text
transactionId = Maybe Text
a} :: GetTable)
getTable_databaseName :: Lens.Lens' GetTable Prelude.Text
getTable_databaseName :: Lens' GetTable Text
getTable_databaseName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTable' {Text
databaseName :: Text
$sel:databaseName:GetTable' :: GetTable -> Text
databaseName} -> Text
databaseName) (\s :: GetTable
s@GetTable' {} Text
a -> GetTable
s {$sel:databaseName:GetTable' :: Text
databaseName = Text
a} :: GetTable)
getTable_name :: Lens.Lens' GetTable Prelude.Text
getTable_name :: Lens' GetTable Text
getTable_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTable' {Text
name :: Text
$sel:name:GetTable' :: GetTable -> Text
name} -> Text
name) (\s :: GetTable
s@GetTable' {} Text
a -> GetTable
s {$sel:name:GetTable' :: Text
name = Text
a} :: GetTable)
instance Core.AWSRequest GetTable where
type AWSResponse GetTable = GetTableResponse
request :: (Service -> Service) -> GetTable -> Request GetTable
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 GetTable
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetTable)))
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 Table -> Int -> GetTableResponse
GetTableResponse'
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
"Table")
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 GetTable where
hashWithSalt :: Int -> GetTable -> Int
hashWithSalt Int
_salt GetTable' {Maybe Text
Maybe POSIX
Text
name :: Text
databaseName :: Text
transactionId :: Maybe Text
queryAsOfTime :: Maybe POSIX
catalogId :: Maybe Text
$sel:name:GetTable' :: GetTable -> Text
$sel:databaseName:GetTable' :: GetTable -> Text
$sel:transactionId:GetTable' :: GetTable -> Maybe Text
$sel:queryAsOfTime:GetTable' :: GetTable -> Maybe POSIX
$sel:catalogId:GetTable' :: GetTable -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
catalogId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
queryAsOfTime
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
transactionId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
databaseName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
instance Prelude.NFData GetTable where
rnf :: GetTable -> ()
rnf GetTable' {Maybe Text
Maybe POSIX
Text
name :: Text
databaseName :: Text
transactionId :: Maybe Text
queryAsOfTime :: Maybe POSIX
catalogId :: Maybe Text
$sel:name:GetTable' :: GetTable -> Text
$sel:databaseName:GetTable' :: GetTable -> Text
$sel:transactionId:GetTable' :: GetTable -> Maybe Text
$sel:queryAsOfTime:GetTable' :: GetTable -> Maybe POSIX
$sel:catalogId:GetTable' :: GetTable -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
catalogId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
queryAsOfTime
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
transactionId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
databaseName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
instance Data.ToHeaders GetTable where
toHeaders :: GetTable -> 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
"AWSGlue.GetTable" :: Prelude.ByteString),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetTable where
toJSON :: GetTable -> Value
toJSON GetTable' {Maybe Text
Maybe POSIX
Text
name :: Text
databaseName :: Text
transactionId :: Maybe Text
queryAsOfTime :: Maybe POSIX
catalogId :: Maybe Text
$sel:name:GetTable' :: GetTable -> Text
$sel:databaseName:GetTable' :: GetTable -> Text
$sel:transactionId:GetTable' :: GetTable -> Maybe Text
$sel:queryAsOfTime:GetTable' :: GetTable -> Maybe POSIX
$sel:catalogId:GetTable' :: GetTable -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"CatalogId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
catalogId,
(Key
"QueryAsOfTime" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
queryAsOfTime,
(Key
"TransactionId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
transactionId,
forall a. a -> Maybe a
Prelude.Just (Key
"DatabaseName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
databaseName),
forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)
]
)
instance Data.ToPath GetTable where
toPath :: GetTable -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetTable where
toQuery :: GetTable -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetTableResponse = GetTableResponse'
{
GetTableResponse -> Maybe Table
table :: Prelude.Maybe Table,
GetTableResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetTableResponse -> GetTableResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTableResponse -> GetTableResponse -> Bool
$c/= :: GetTableResponse -> GetTableResponse -> Bool
== :: GetTableResponse -> GetTableResponse -> Bool
$c== :: GetTableResponse -> GetTableResponse -> Bool
Prelude.Eq, ReadPrec [GetTableResponse]
ReadPrec GetTableResponse
Int -> ReadS GetTableResponse
ReadS [GetTableResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTableResponse]
$creadListPrec :: ReadPrec [GetTableResponse]
readPrec :: ReadPrec GetTableResponse
$creadPrec :: ReadPrec GetTableResponse
readList :: ReadS [GetTableResponse]
$creadList :: ReadS [GetTableResponse]
readsPrec :: Int -> ReadS GetTableResponse
$creadsPrec :: Int -> ReadS GetTableResponse
Prelude.Read, Int -> GetTableResponse -> ShowS
[GetTableResponse] -> ShowS
GetTableResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTableResponse] -> ShowS
$cshowList :: [GetTableResponse] -> ShowS
show :: GetTableResponse -> String
$cshow :: GetTableResponse -> String
showsPrec :: Int -> GetTableResponse -> ShowS
$cshowsPrec :: Int -> GetTableResponse -> ShowS
Prelude.Show, forall x. Rep GetTableResponse x -> GetTableResponse
forall x. GetTableResponse -> Rep GetTableResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTableResponse x -> GetTableResponse
$cfrom :: forall x. GetTableResponse -> Rep GetTableResponse x
Prelude.Generic)
newGetTableResponse ::
Prelude.Int ->
GetTableResponse
newGetTableResponse :: Int -> GetTableResponse
newGetTableResponse Int
pHttpStatus_ =
GetTableResponse'
{ $sel:table:GetTableResponse' :: Maybe Table
table = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetTableResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getTableResponse_table :: Lens.Lens' GetTableResponse (Prelude.Maybe Table)
getTableResponse_table :: Lens' GetTableResponse (Maybe Table)
getTableResponse_table = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTableResponse' {Maybe Table
table :: Maybe Table
$sel:table:GetTableResponse' :: GetTableResponse -> Maybe Table
table} -> Maybe Table
table) (\s :: GetTableResponse
s@GetTableResponse' {} Maybe Table
a -> GetTableResponse
s {$sel:table:GetTableResponse' :: Maybe Table
table = Maybe Table
a} :: GetTableResponse)
getTableResponse_httpStatus :: Lens.Lens' GetTableResponse Prelude.Int
getTableResponse_httpStatus :: Lens' GetTableResponse Int
getTableResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTableResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetTableResponse' :: GetTableResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetTableResponse
s@GetTableResponse' {} Int
a -> GetTableResponse
s {$sel:httpStatus:GetTableResponse' :: Int
httpStatus = Int
a} :: GetTableResponse)
instance Prelude.NFData GetTableResponse where
rnf :: GetTableResponse -> ()
rnf GetTableResponse' {Int
Maybe Table
httpStatus :: Int
table :: Maybe Table
$sel:httpStatus:GetTableResponse' :: GetTableResponse -> Int
$sel:table:GetTableResponse' :: GetTableResponse -> Maybe Table
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Table
table
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus