{-# 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.UpdateTable
(
UpdateTable (..),
newUpdateTable,
updateTable_skipArchive,
updateTable_catalogId,
updateTable_databaseName,
updateTable_tableInput,
UpdateTableResponse (..),
newUpdateTableResponse,
updateTableResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Glue.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 UpdateTable = UpdateTable'
{
UpdateTable -> Maybe Bool
skipArchive :: Prelude.Maybe Prelude.Bool,
UpdateTable -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
UpdateTable -> Text
databaseName :: Prelude.Text,
UpdateTable -> TableInput
tableInput :: TableInput
}
deriving (UpdateTable -> UpdateTable -> Bool
(UpdateTable -> UpdateTable -> Bool)
-> (UpdateTable -> UpdateTable -> Bool) -> Eq UpdateTable
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateTable -> UpdateTable -> Bool
$c/= :: UpdateTable -> UpdateTable -> Bool
== :: UpdateTable -> UpdateTable -> Bool
$c== :: UpdateTable -> UpdateTable -> Bool
Prelude.Eq, ReadPrec [UpdateTable]
ReadPrec UpdateTable
Int -> ReadS UpdateTable
ReadS [UpdateTable]
(Int -> ReadS UpdateTable)
-> ReadS [UpdateTable]
-> ReadPrec UpdateTable
-> ReadPrec [UpdateTable]
-> Read UpdateTable
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateTable]
$creadListPrec :: ReadPrec [UpdateTable]
readPrec :: ReadPrec UpdateTable
$creadPrec :: ReadPrec UpdateTable
readList :: ReadS [UpdateTable]
$creadList :: ReadS [UpdateTable]
readsPrec :: Int -> ReadS UpdateTable
$creadsPrec :: Int -> ReadS UpdateTable
Prelude.Read, Int -> UpdateTable -> ShowS
[UpdateTable] -> ShowS
UpdateTable -> String
(Int -> UpdateTable -> ShowS)
-> (UpdateTable -> String)
-> ([UpdateTable] -> ShowS)
-> Show UpdateTable
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateTable] -> ShowS
$cshowList :: [UpdateTable] -> ShowS
show :: UpdateTable -> String
$cshow :: UpdateTable -> String
showsPrec :: Int -> UpdateTable -> ShowS
$cshowsPrec :: Int -> UpdateTable -> ShowS
Prelude.Show, (forall x. UpdateTable -> Rep UpdateTable x)
-> (forall x. Rep UpdateTable x -> UpdateTable)
-> Generic UpdateTable
forall x. Rep UpdateTable x -> UpdateTable
forall x. UpdateTable -> Rep UpdateTable x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateTable x -> UpdateTable
$cfrom :: forall x. UpdateTable -> Rep UpdateTable x
Prelude.Generic)
newUpdateTable ::
Prelude.Text ->
TableInput ->
UpdateTable
newUpdateTable :: Text -> TableInput -> UpdateTable
newUpdateTable Text
pDatabaseName_ TableInput
pTableInput_ =
UpdateTable' :: Maybe Bool -> Maybe Text -> Text -> TableInput -> UpdateTable
UpdateTable'
{ $sel:skipArchive:UpdateTable' :: Maybe Bool
skipArchive = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:catalogId:UpdateTable' :: Maybe Text
catalogId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:databaseName:UpdateTable' :: Text
databaseName = Text
pDatabaseName_,
$sel:tableInput:UpdateTable' :: TableInput
tableInput = TableInput
pTableInput_
}
updateTable_skipArchive :: Lens.Lens' UpdateTable (Prelude.Maybe Prelude.Bool)
updateTable_skipArchive :: (Maybe Bool -> f (Maybe Bool)) -> UpdateTable -> f UpdateTable
updateTable_skipArchive = (UpdateTable -> Maybe Bool)
-> (UpdateTable -> Maybe Bool -> UpdateTable)
-> Lens UpdateTable UpdateTable (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTable' {Maybe Bool
skipArchive :: Maybe Bool
$sel:skipArchive:UpdateTable' :: UpdateTable -> Maybe Bool
skipArchive} -> Maybe Bool
skipArchive) (\s :: UpdateTable
s@UpdateTable' {} Maybe Bool
a -> UpdateTable
s {$sel:skipArchive:UpdateTable' :: Maybe Bool
skipArchive = Maybe Bool
a} :: UpdateTable)
updateTable_catalogId :: Lens.Lens' UpdateTable (Prelude.Maybe Prelude.Text)
updateTable_catalogId :: (Maybe Text -> f (Maybe Text)) -> UpdateTable -> f UpdateTable
updateTable_catalogId = (UpdateTable -> Maybe Text)
-> (UpdateTable -> Maybe Text -> UpdateTable)
-> Lens UpdateTable UpdateTable (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTable' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:UpdateTable' :: UpdateTable -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: UpdateTable
s@UpdateTable' {} Maybe Text
a -> UpdateTable
s {$sel:catalogId:UpdateTable' :: Maybe Text
catalogId = Maybe Text
a} :: UpdateTable)
updateTable_databaseName :: Lens.Lens' UpdateTable Prelude.Text
updateTable_databaseName :: (Text -> f Text) -> UpdateTable -> f UpdateTable
updateTable_databaseName = (UpdateTable -> Text)
-> (UpdateTable -> Text -> UpdateTable)
-> Lens UpdateTable UpdateTable Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTable' {Text
databaseName :: Text
$sel:databaseName:UpdateTable' :: UpdateTable -> Text
databaseName} -> Text
databaseName) (\s :: UpdateTable
s@UpdateTable' {} Text
a -> UpdateTable
s {$sel:databaseName:UpdateTable' :: Text
databaseName = Text
a} :: UpdateTable)
updateTable_tableInput :: Lens.Lens' UpdateTable TableInput
updateTable_tableInput :: (TableInput -> f TableInput) -> UpdateTable -> f UpdateTable
updateTable_tableInput = (UpdateTable -> TableInput)
-> (UpdateTable -> TableInput -> UpdateTable)
-> Lens UpdateTable UpdateTable TableInput TableInput
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTable' {TableInput
tableInput :: TableInput
$sel:tableInput:UpdateTable' :: UpdateTable -> TableInput
tableInput} -> TableInput
tableInput) (\s :: UpdateTable
s@UpdateTable' {} TableInput
a -> UpdateTable
s {$sel:tableInput:UpdateTable' :: TableInput
tableInput = TableInput
a} :: UpdateTable)
instance Core.AWSRequest UpdateTable where
type AWSResponse UpdateTable = UpdateTableResponse
request :: UpdateTable -> Request UpdateTable
request = Service -> UpdateTable -> Request UpdateTable
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateTable
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateTable)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateTable))
-> Logger
-> Service
-> Proxy UpdateTable
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateTable)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> UpdateTableResponse
UpdateTableResponse'
(Int -> UpdateTableResponse)
-> Either String Int -> Either String UpdateTableResponse
forall (f :: * -> *) a b. Functor 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 UpdateTable
instance Prelude.NFData UpdateTable
instance Core.ToHeaders UpdateTable where
toHeaders :: UpdateTable -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateTable -> 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
"AWSGlue.UpdateTable" :: 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 UpdateTable where
toJSON :: UpdateTable -> Value
toJSON UpdateTable' {Maybe Bool
Maybe Text
Text
TableInput
tableInput :: TableInput
databaseName :: Text
catalogId :: Maybe Text
skipArchive :: Maybe Bool
$sel:tableInput:UpdateTable' :: UpdateTable -> TableInput
$sel:databaseName:UpdateTable' :: UpdateTable -> Text
$sel:catalogId:UpdateTable' :: UpdateTable -> Maybe Text
$sel:skipArchive:UpdateTable' :: UpdateTable -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"SkipArchive" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
skipArchive,
(Text
"CatalogId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
catalogId,
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
"TableInput" Text -> TableInput -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TableInput
tableInput)
]
)
instance Core.ToPath UpdateTable where
toPath :: UpdateTable -> ByteString
toPath = ByteString -> UpdateTable -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateTable where
toQuery :: UpdateTable -> QueryString
toQuery = QueryString -> UpdateTable -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateTableResponse = UpdateTableResponse'
{
UpdateTableResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateTableResponse -> UpdateTableResponse -> Bool
(UpdateTableResponse -> UpdateTableResponse -> Bool)
-> (UpdateTableResponse -> UpdateTableResponse -> Bool)
-> Eq UpdateTableResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateTableResponse -> UpdateTableResponse -> Bool
$c/= :: UpdateTableResponse -> UpdateTableResponse -> Bool
== :: UpdateTableResponse -> UpdateTableResponse -> Bool
$c== :: UpdateTableResponse -> UpdateTableResponse -> Bool
Prelude.Eq, ReadPrec [UpdateTableResponse]
ReadPrec UpdateTableResponse
Int -> ReadS UpdateTableResponse
ReadS [UpdateTableResponse]
(Int -> ReadS UpdateTableResponse)
-> ReadS [UpdateTableResponse]
-> ReadPrec UpdateTableResponse
-> ReadPrec [UpdateTableResponse]
-> Read UpdateTableResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateTableResponse]
$creadListPrec :: ReadPrec [UpdateTableResponse]
readPrec :: ReadPrec UpdateTableResponse
$creadPrec :: ReadPrec UpdateTableResponse
readList :: ReadS [UpdateTableResponse]
$creadList :: ReadS [UpdateTableResponse]
readsPrec :: Int -> ReadS UpdateTableResponse
$creadsPrec :: Int -> ReadS UpdateTableResponse
Prelude.Read, Int -> UpdateTableResponse -> ShowS
[UpdateTableResponse] -> ShowS
UpdateTableResponse -> String
(Int -> UpdateTableResponse -> ShowS)
-> (UpdateTableResponse -> String)
-> ([UpdateTableResponse] -> ShowS)
-> Show UpdateTableResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateTableResponse] -> ShowS
$cshowList :: [UpdateTableResponse] -> ShowS
show :: UpdateTableResponse -> String
$cshow :: UpdateTableResponse -> String
showsPrec :: Int -> UpdateTableResponse -> ShowS
$cshowsPrec :: Int -> UpdateTableResponse -> ShowS
Prelude.Show, (forall x. UpdateTableResponse -> Rep UpdateTableResponse x)
-> (forall x. Rep UpdateTableResponse x -> UpdateTableResponse)
-> Generic UpdateTableResponse
forall x. Rep UpdateTableResponse x -> UpdateTableResponse
forall x. UpdateTableResponse -> Rep UpdateTableResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateTableResponse x -> UpdateTableResponse
$cfrom :: forall x. UpdateTableResponse -> Rep UpdateTableResponse x
Prelude.Generic)
newUpdateTableResponse ::
Prelude.Int ->
UpdateTableResponse
newUpdateTableResponse :: Int -> UpdateTableResponse
newUpdateTableResponse Int
pHttpStatus_ =
UpdateTableResponse' :: Int -> UpdateTableResponse
UpdateTableResponse' {$sel:httpStatus:UpdateTableResponse' :: Int
httpStatus = Int
pHttpStatus_}
updateTableResponse_httpStatus :: Lens.Lens' UpdateTableResponse Prelude.Int
updateTableResponse_httpStatus :: (Int -> f Int) -> UpdateTableResponse -> f UpdateTableResponse
updateTableResponse_httpStatus = (UpdateTableResponse -> Int)
-> (UpdateTableResponse -> Int -> UpdateTableResponse)
-> Lens UpdateTableResponse UpdateTableResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTableResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateTableResponse' :: UpdateTableResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateTableResponse
s@UpdateTableResponse' {} Int
a -> UpdateTableResponse
s {$sel:httpStatus:UpdateTableResponse' :: Int
httpStatus = Int
a} :: UpdateTableResponse)
instance Prelude.NFData UpdateTableResponse