{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.Glue.BatchDeletePartition
(
batchDeletePartition
, BatchDeletePartition
, bdpCatalogId
, bdpDatabaseName
, bdpTableName
, bdpPartitionsToDelete
, batchDeletePartitionResponse
, BatchDeletePartitionResponse
, bdprsErrors
, bdprsResponseStatus
) where
import Network.AWS.Glue.Types
import Network.AWS.Glue.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data BatchDeletePartition = BatchDeletePartition'
{ _bdpCatalogId :: !(Maybe Text)
, _bdpDatabaseName :: !Text
, _bdpTableName :: !Text
, _bdpPartitionsToDelete :: ![PartitionValueList]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
batchDeletePartition
:: Text
-> Text
-> BatchDeletePartition
batchDeletePartition pDatabaseName_ pTableName_ =
BatchDeletePartition'
{ _bdpCatalogId = Nothing
, _bdpDatabaseName = pDatabaseName_
, _bdpTableName = pTableName_
, _bdpPartitionsToDelete = mempty
}
bdpCatalogId :: Lens' BatchDeletePartition (Maybe Text)
bdpCatalogId = lens _bdpCatalogId (\ s a -> s{_bdpCatalogId = a})
bdpDatabaseName :: Lens' BatchDeletePartition Text
bdpDatabaseName = lens _bdpDatabaseName (\ s a -> s{_bdpDatabaseName = a})
bdpTableName :: Lens' BatchDeletePartition Text
bdpTableName = lens _bdpTableName (\ s a -> s{_bdpTableName = a})
bdpPartitionsToDelete :: Lens' BatchDeletePartition [PartitionValueList]
bdpPartitionsToDelete = lens _bdpPartitionsToDelete (\ s a -> s{_bdpPartitionsToDelete = a}) . _Coerce
instance AWSRequest BatchDeletePartition where
type Rs BatchDeletePartition =
BatchDeletePartitionResponse
request = postJSON glue
response
= receiveJSON
(\ s h x ->
BatchDeletePartitionResponse' <$>
(x .?> "Errors" .!@ mempty) <*> (pure (fromEnum s)))
instance Hashable BatchDeletePartition where
instance NFData BatchDeletePartition where
instance ToHeaders BatchDeletePartition where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSGlue.BatchDeletePartition" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON BatchDeletePartition where
toJSON BatchDeletePartition'{..}
= object
(catMaybes
[("CatalogId" .=) <$> _bdpCatalogId,
Just ("DatabaseName" .= _bdpDatabaseName),
Just ("TableName" .= _bdpTableName),
Just
("PartitionsToDelete" .= _bdpPartitionsToDelete)])
instance ToPath BatchDeletePartition where
toPath = const "/"
instance ToQuery BatchDeletePartition where
toQuery = const mempty
data BatchDeletePartitionResponse = BatchDeletePartitionResponse'
{ _bdprsErrors :: !(Maybe [PartitionError])
, _bdprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
batchDeletePartitionResponse
:: Int
-> BatchDeletePartitionResponse
batchDeletePartitionResponse pResponseStatus_ =
BatchDeletePartitionResponse'
{_bdprsErrors = Nothing, _bdprsResponseStatus = pResponseStatus_}
bdprsErrors :: Lens' BatchDeletePartitionResponse [PartitionError]
bdprsErrors = lens _bdprsErrors (\ s a -> s{_bdprsErrors = a}) . _Default . _Coerce
bdprsResponseStatus :: Lens' BatchDeletePartitionResponse Int
bdprsResponseStatus = lens _bdprsResponseStatus (\ s a -> s{_bdprsResponseStatus = a})
instance NFData BatchDeletePartitionResponse where