{-# 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.BatchDeleteConnection
(
batchDeleteConnection
, BatchDeleteConnection
, bdcCatalogId
, bdcConnectionNameList
, batchDeleteConnectionResponse
, BatchDeleteConnectionResponse
, bdcrsSucceeded
, bdcrsErrors
, bdcrsResponseStatus
) 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 BatchDeleteConnection = BatchDeleteConnection'
{ _bdcCatalogId :: !(Maybe Text)
, _bdcConnectionNameList :: ![Text]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
batchDeleteConnection
:: BatchDeleteConnection
batchDeleteConnection =
BatchDeleteConnection'
{_bdcCatalogId = Nothing, _bdcConnectionNameList = mempty}
bdcCatalogId :: Lens' BatchDeleteConnection (Maybe Text)
bdcCatalogId = lens _bdcCatalogId (\ s a -> s{_bdcCatalogId = a})
bdcConnectionNameList :: Lens' BatchDeleteConnection [Text]
bdcConnectionNameList = lens _bdcConnectionNameList (\ s a -> s{_bdcConnectionNameList = a}) . _Coerce
instance AWSRequest BatchDeleteConnection where
type Rs BatchDeleteConnection =
BatchDeleteConnectionResponse
request = postJSON glue
response
= receiveJSON
(\ s h x ->
BatchDeleteConnectionResponse' <$>
(x .?> "Succeeded" .!@ mempty) <*>
(x .?> "Errors" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable BatchDeleteConnection where
instance NFData BatchDeleteConnection where
instance ToHeaders BatchDeleteConnection where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSGlue.BatchDeleteConnection" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON BatchDeleteConnection where
toJSON BatchDeleteConnection'{..}
= object
(catMaybes
[("CatalogId" .=) <$> _bdcCatalogId,
Just
("ConnectionNameList" .= _bdcConnectionNameList)])
instance ToPath BatchDeleteConnection where
toPath = const "/"
instance ToQuery BatchDeleteConnection where
toQuery = const mempty
data BatchDeleteConnectionResponse = BatchDeleteConnectionResponse'
{ _bdcrsSucceeded :: !(Maybe [Text])
, _bdcrsErrors :: !(Maybe (Map Text ErrorDetail))
, _bdcrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
batchDeleteConnectionResponse
:: Int
-> BatchDeleteConnectionResponse
batchDeleteConnectionResponse pResponseStatus_ =
BatchDeleteConnectionResponse'
{ _bdcrsSucceeded = Nothing
, _bdcrsErrors = Nothing
, _bdcrsResponseStatus = pResponseStatus_
}
bdcrsSucceeded :: Lens' BatchDeleteConnectionResponse [Text]
bdcrsSucceeded = lens _bdcrsSucceeded (\ s a -> s{_bdcrsSucceeded = a}) . _Default . _Coerce
bdcrsErrors :: Lens' BatchDeleteConnectionResponse (HashMap Text ErrorDetail)
bdcrsErrors = lens _bdcrsErrors (\ s a -> s{_bdcrsErrors = a}) . _Default . _Map
bdcrsResponseStatus :: Lens' BatchDeleteConnectionResponse Int
bdcrsResponseStatus = lens _bdcrsResponseStatus (\ s a -> s{_bdcrsResponseStatus = a})
instance NFData BatchDeleteConnectionResponse where