{-# 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.BatchDeletePartition
(
BatchDeletePartition (..),
newBatchDeletePartition,
batchDeletePartition_catalogId,
batchDeletePartition_databaseName,
batchDeletePartition_tableName,
batchDeletePartition_partitionsToDelete,
BatchDeletePartitionResponse (..),
newBatchDeletePartitionResponse,
batchDeletePartitionResponse_errors,
batchDeletePartitionResponse_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 BatchDeletePartition = BatchDeletePartition'
{
BatchDeletePartition -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
BatchDeletePartition -> Text
databaseName :: Prelude.Text,
BatchDeletePartition -> Text
tableName :: Prelude.Text,
BatchDeletePartition -> [PartitionValueList]
partitionsToDelete :: [PartitionValueList]
}
deriving (BatchDeletePartition -> BatchDeletePartition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDeletePartition -> BatchDeletePartition -> Bool
$c/= :: BatchDeletePartition -> BatchDeletePartition -> Bool
== :: BatchDeletePartition -> BatchDeletePartition -> Bool
$c== :: BatchDeletePartition -> BatchDeletePartition -> Bool
Prelude.Eq, ReadPrec [BatchDeletePartition]
ReadPrec BatchDeletePartition
Int -> ReadS BatchDeletePartition
ReadS [BatchDeletePartition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchDeletePartition]
$creadListPrec :: ReadPrec [BatchDeletePartition]
readPrec :: ReadPrec BatchDeletePartition
$creadPrec :: ReadPrec BatchDeletePartition
readList :: ReadS [BatchDeletePartition]
$creadList :: ReadS [BatchDeletePartition]
readsPrec :: Int -> ReadS BatchDeletePartition
$creadsPrec :: Int -> ReadS BatchDeletePartition
Prelude.Read, Int -> BatchDeletePartition -> ShowS
[BatchDeletePartition] -> ShowS
BatchDeletePartition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDeletePartition] -> ShowS
$cshowList :: [BatchDeletePartition] -> ShowS
show :: BatchDeletePartition -> String
$cshow :: BatchDeletePartition -> String
showsPrec :: Int -> BatchDeletePartition -> ShowS
$cshowsPrec :: Int -> BatchDeletePartition -> ShowS
Prelude.Show, forall x. Rep BatchDeletePartition x -> BatchDeletePartition
forall x. BatchDeletePartition -> Rep BatchDeletePartition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchDeletePartition x -> BatchDeletePartition
$cfrom :: forall x. BatchDeletePartition -> Rep BatchDeletePartition x
Prelude.Generic)
newBatchDeletePartition ::
Prelude.Text ->
Prelude.Text ->
BatchDeletePartition
newBatchDeletePartition :: Text -> Text -> BatchDeletePartition
newBatchDeletePartition Text
pDatabaseName_ Text
pTableName_ =
BatchDeletePartition'
{ $sel:catalogId:BatchDeletePartition' :: Maybe Text
catalogId = forall a. Maybe a
Prelude.Nothing,
$sel:databaseName:BatchDeletePartition' :: Text
databaseName = Text
pDatabaseName_,
$sel:tableName:BatchDeletePartition' :: Text
tableName = Text
pTableName_,
$sel:partitionsToDelete:BatchDeletePartition' :: [PartitionValueList]
partitionsToDelete = forall a. Monoid a => a
Prelude.mempty
}
batchDeletePartition_catalogId :: Lens.Lens' BatchDeletePartition (Prelude.Maybe Prelude.Text)
batchDeletePartition_catalogId :: Lens' BatchDeletePartition (Maybe Text)
batchDeletePartition_catalogId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeletePartition' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:BatchDeletePartition' :: BatchDeletePartition -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: BatchDeletePartition
s@BatchDeletePartition' {} Maybe Text
a -> BatchDeletePartition
s {$sel:catalogId:BatchDeletePartition' :: Maybe Text
catalogId = Maybe Text
a} :: BatchDeletePartition)
batchDeletePartition_databaseName :: Lens.Lens' BatchDeletePartition Prelude.Text
batchDeletePartition_databaseName :: Lens' BatchDeletePartition Text
batchDeletePartition_databaseName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeletePartition' {Text
databaseName :: Text
$sel:databaseName:BatchDeletePartition' :: BatchDeletePartition -> Text
databaseName} -> Text
databaseName) (\s :: BatchDeletePartition
s@BatchDeletePartition' {} Text
a -> BatchDeletePartition
s {$sel:databaseName:BatchDeletePartition' :: Text
databaseName = Text
a} :: BatchDeletePartition)
batchDeletePartition_tableName :: Lens.Lens' BatchDeletePartition Prelude.Text
batchDeletePartition_tableName :: Lens' BatchDeletePartition Text
batchDeletePartition_tableName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeletePartition' {Text
tableName :: Text
$sel:tableName:BatchDeletePartition' :: BatchDeletePartition -> Text
tableName} -> Text
tableName) (\s :: BatchDeletePartition
s@BatchDeletePartition' {} Text
a -> BatchDeletePartition
s {$sel:tableName:BatchDeletePartition' :: Text
tableName = Text
a} :: BatchDeletePartition)
batchDeletePartition_partitionsToDelete :: Lens.Lens' BatchDeletePartition [PartitionValueList]
batchDeletePartition_partitionsToDelete :: Lens' BatchDeletePartition [PartitionValueList]
batchDeletePartition_partitionsToDelete = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeletePartition' {[PartitionValueList]
partitionsToDelete :: [PartitionValueList]
$sel:partitionsToDelete:BatchDeletePartition' :: BatchDeletePartition -> [PartitionValueList]
partitionsToDelete} -> [PartitionValueList]
partitionsToDelete) (\s :: BatchDeletePartition
s@BatchDeletePartition' {} [PartitionValueList]
a -> BatchDeletePartition
s {$sel:partitionsToDelete:BatchDeletePartition' :: [PartitionValueList]
partitionsToDelete = [PartitionValueList]
a} :: BatchDeletePartition) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest BatchDeletePartition where
type
AWSResponse BatchDeletePartition =
BatchDeletePartitionResponse
request :: (Service -> Service)
-> BatchDeletePartition -> Request BatchDeletePartition
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 BatchDeletePartition
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchDeletePartition)))
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 [PartitionError] -> Int -> BatchDeletePartitionResponse
BatchDeletePartitionResponse'
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
"Errors" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
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 BatchDeletePartition where
hashWithSalt :: Int -> BatchDeletePartition -> Int
hashWithSalt Int
_salt BatchDeletePartition' {[PartitionValueList]
Maybe Text
Text
partitionsToDelete :: [PartitionValueList]
tableName :: Text
databaseName :: Text
catalogId :: Maybe Text
$sel:partitionsToDelete:BatchDeletePartition' :: BatchDeletePartition -> [PartitionValueList]
$sel:tableName:BatchDeletePartition' :: BatchDeletePartition -> Text
$sel:databaseName:BatchDeletePartition' :: BatchDeletePartition -> Text
$sel:catalogId:BatchDeletePartition' :: BatchDeletePartition -> 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` Text
databaseName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
tableName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [PartitionValueList]
partitionsToDelete
instance Prelude.NFData BatchDeletePartition where
rnf :: BatchDeletePartition -> ()
rnf BatchDeletePartition' {[PartitionValueList]
Maybe Text
Text
partitionsToDelete :: [PartitionValueList]
tableName :: Text
databaseName :: Text
catalogId :: Maybe Text
$sel:partitionsToDelete:BatchDeletePartition' :: BatchDeletePartition -> [PartitionValueList]
$sel:tableName:BatchDeletePartition' :: BatchDeletePartition -> Text
$sel:databaseName:BatchDeletePartition' :: BatchDeletePartition -> Text
$sel:catalogId:BatchDeletePartition' :: BatchDeletePartition -> 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 Text
databaseName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
tableName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [PartitionValueList]
partitionsToDelete
instance Data.ToHeaders BatchDeletePartition where
toHeaders :: BatchDeletePartition -> 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.BatchDeletePartition" ::
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 BatchDeletePartition where
toJSON :: BatchDeletePartition -> Value
toJSON BatchDeletePartition' {[PartitionValueList]
Maybe Text
Text
partitionsToDelete :: [PartitionValueList]
tableName :: Text
databaseName :: Text
catalogId :: Maybe Text
$sel:partitionsToDelete:BatchDeletePartition' :: BatchDeletePartition -> [PartitionValueList]
$sel:tableName:BatchDeletePartition' :: BatchDeletePartition -> Text
$sel:databaseName:BatchDeletePartition' :: BatchDeletePartition -> Text
$sel:catalogId:BatchDeletePartition' :: BatchDeletePartition -> 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,
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
"TableName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
tableName),
forall a. a -> Maybe a
Prelude.Just
(Key
"PartitionsToDelete" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [PartitionValueList]
partitionsToDelete)
]
)
instance Data.ToPath BatchDeletePartition where
toPath :: BatchDeletePartition -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery BatchDeletePartition where
toQuery :: BatchDeletePartition -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data BatchDeletePartitionResponse = BatchDeletePartitionResponse'
{
BatchDeletePartitionResponse -> Maybe [PartitionError]
errors :: Prelude.Maybe [PartitionError],
BatchDeletePartitionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchDeletePartitionResponse
-> BatchDeletePartitionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDeletePartitionResponse
-> BatchDeletePartitionResponse -> Bool
$c/= :: BatchDeletePartitionResponse
-> BatchDeletePartitionResponse -> Bool
== :: BatchDeletePartitionResponse
-> BatchDeletePartitionResponse -> Bool
$c== :: BatchDeletePartitionResponse
-> BatchDeletePartitionResponse -> Bool
Prelude.Eq, ReadPrec [BatchDeletePartitionResponse]
ReadPrec BatchDeletePartitionResponse
Int -> ReadS BatchDeletePartitionResponse
ReadS [BatchDeletePartitionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchDeletePartitionResponse]
$creadListPrec :: ReadPrec [BatchDeletePartitionResponse]
readPrec :: ReadPrec BatchDeletePartitionResponse
$creadPrec :: ReadPrec BatchDeletePartitionResponse
readList :: ReadS [BatchDeletePartitionResponse]
$creadList :: ReadS [BatchDeletePartitionResponse]
readsPrec :: Int -> ReadS BatchDeletePartitionResponse
$creadsPrec :: Int -> ReadS BatchDeletePartitionResponse
Prelude.Read, Int -> BatchDeletePartitionResponse -> ShowS
[BatchDeletePartitionResponse] -> ShowS
BatchDeletePartitionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDeletePartitionResponse] -> ShowS
$cshowList :: [BatchDeletePartitionResponse] -> ShowS
show :: BatchDeletePartitionResponse -> String
$cshow :: BatchDeletePartitionResponse -> String
showsPrec :: Int -> BatchDeletePartitionResponse -> ShowS
$cshowsPrec :: Int -> BatchDeletePartitionResponse -> ShowS
Prelude.Show, forall x.
Rep BatchDeletePartitionResponse x -> BatchDeletePartitionResponse
forall x.
BatchDeletePartitionResponse -> Rep BatchDeletePartitionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchDeletePartitionResponse x -> BatchDeletePartitionResponse
$cfrom :: forall x.
BatchDeletePartitionResponse -> Rep BatchDeletePartitionResponse x
Prelude.Generic)
newBatchDeletePartitionResponse ::
Prelude.Int ->
BatchDeletePartitionResponse
newBatchDeletePartitionResponse :: Int -> BatchDeletePartitionResponse
newBatchDeletePartitionResponse Int
pHttpStatus_ =
BatchDeletePartitionResponse'
{ $sel:errors:BatchDeletePartitionResponse' :: Maybe [PartitionError]
errors =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchDeletePartitionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchDeletePartitionResponse_errors :: Lens.Lens' BatchDeletePartitionResponse (Prelude.Maybe [PartitionError])
batchDeletePartitionResponse_errors :: Lens' BatchDeletePartitionResponse (Maybe [PartitionError])
batchDeletePartitionResponse_errors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeletePartitionResponse' {Maybe [PartitionError]
errors :: Maybe [PartitionError]
$sel:errors:BatchDeletePartitionResponse' :: BatchDeletePartitionResponse -> Maybe [PartitionError]
errors} -> Maybe [PartitionError]
errors) (\s :: BatchDeletePartitionResponse
s@BatchDeletePartitionResponse' {} Maybe [PartitionError]
a -> BatchDeletePartitionResponse
s {$sel:errors:BatchDeletePartitionResponse' :: Maybe [PartitionError]
errors = Maybe [PartitionError]
a} :: BatchDeletePartitionResponse) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchDeletePartitionResponse_httpStatus :: Lens.Lens' BatchDeletePartitionResponse Prelude.Int
batchDeletePartitionResponse_httpStatus :: Lens' BatchDeletePartitionResponse Int
batchDeletePartitionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeletePartitionResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchDeletePartitionResponse' :: BatchDeletePartitionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchDeletePartitionResponse
s@BatchDeletePartitionResponse' {} Int
a -> BatchDeletePartitionResponse
s {$sel:httpStatus:BatchDeletePartitionResponse' :: Int
httpStatus = Int
a} :: BatchDeletePartitionResponse)
instance Prelude.NFData BatchDeletePartitionResponse where
rnf :: BatchDeletePartitionResponse -> ()
rnf BatchDeletePartitionResponse' {Int
Maybe [PartitionError]
httpStatus :: Int
errors :: Maybe [PartitionError]
$sel:httpStatus:BatchDeletePartitionResponse' :: BatchDeletePartitionResponse -> Int
$sel:errors:BatchDeletePartitionResponse' :: BatchDeletePartitionResponse -> Maybe [PartitionError]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [PartitionError]
errors
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus