module Network.AWS.Glue.BatchCreatePartition
(
batchCreatePartition
, BatchCreatePartition
, bcpCatalogId
, bcpDatabaseName
, bcpTableName
, bcpPartitionInputList
, batchCreatePartitionResponse
, BatchCreatePartitionResponse
, bcprsErrors
, bcprsResponseStatus
) 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 BatchCreatePartition = BatchCreatePartition'
{ _bcpCatalogId :: !(Maybe Text)
, _bcpDatabaseName :: !Text
, _bcpTableName :: !Text
, _bcpPartitionInputList :: ![PartitionInput]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
batchCreatePartition
:: Text
-> Text
-> BatchCreatePartition
batchCreatePartition pDatabaseName_ pTableName_ =
BatchCreatePartition'
{ _bcpCatalogId = Nothing
, _bcpDatabaseName = pDatabaseName_
, _bcpTableName = pTableName_
, _bcpPartitionInputList = mempty
}
bcpCatalogId :: Lens' BatchCreatePartition (Maybe Text)
bcpCatalogId = lens _bcpCatalogId (\ s a -> s{_bcpCatalogId = a});
bcpDatabaseName :: Lens' BatchCreatePartition Text
bcpDatabaseName = lens _bcpDatabaseName (\ s a -> s{_bcpDatabaseName = a});
bcpTableName :: Lens' BatchCreatePartition Text
bcpTableName = lens _bcpTableName (\ s a -> s{_bcpTableName = a});
bcpPartitionInputList :: Lens' BatchCreatePartition [PartitionInput]
bcpPartitionInputList = lens _bcpPartitionInputList (\ s a -> s{_bcpPartitionInputList = a}) . _Coerce;
instance AWSRequest BatchCreatePartition where
type Rs BatchCreatePartition =
BatchCreatePartitionResponse
request = postJSON glue
response
= receiveJSON
(\ s h x ->
BatchCreatePartitionResponse' <$>
(x .?> "Errors" .!@ mempty) <*> (pure (fromEnum s)))
instance Hashable BatchCreatePartition where
instance NFData BatchCreatePartition where
instance ToHeaders BatchCreatePartition where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSGlue.BatchCreatePartition" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON BatchCreatePartition where
toJSON BatchCreatePartition'{..}
= object
(catMaybes
[("CatalogId" .=) <$> _bcpCatalogId,
Just ("DatabaseName" .= _bcpDatabaseName),
Just ("TableName" .= _bcpTableName),
Just
("PartitionInputList" .= _bcpPartitionInputList)])
instance ToPath BatchCreatePartition where
toPath = const "/"
instance ToQuery BatchCreatePartition where
toQuery = const mempty
data BatchCreatePartitionResponse = BatchCreatePartitionResponse'
{ _bcprsErrors :: !(Maybe [PartitionError])
, _bcprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
batchCreatePartitionResponse
:: Int
-> BatchCreatePartitionResponse
batchCreatePartitionResponse pResponseStatus_ =
BatchCreatePartitionResponse'
{_bcprsErrors = Nothing, _bcprsResponseStatus = pResponseStatus_}
bcprsErrors :: Lens' BatchCreatePartitionResponse [PartitionError]
bcprsErrors = lens _bcprsErrors (\ s a -> s{_bcprsErrors = a}) . _Default . _Coerce;
bcprsResponseStatus :: Lens' BatchCreatePartitionResponse Int
bcprsResponseStatus = lens _bcprsResponseStatus (\ s a -> s{_bcprsResponseStatus = a});
instance NFData BatchCreatePartitionResponse where