{-# 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.Athena.BatchGetQueryExecution
(
batchGetQueryExecution
, BatchGetQueryExecution
, bgqeQueryExecutionIds
, batchGetQueryExecutionResponse
, BatchGetQueryExecutionResponse
, bgqersUnprocessedQueryExecutionIds
, bgqersQueryExecutions
, bgqersResponseStatus
) where
import Network.AWS.Athena.Types
import Network.AWS.Athena.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype BatchGetQueryExecution = BatchGetQueryExecution'
{ _bgqeQueryExecutionIds :: List1 Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
batchGetQueryExecution
:: NonEmpty Text
-> BatchGetQueryExecution
batchGetQueryExecution pQueryExecutionIds_ =
BatchGetQueryExecution'
{_bgqeQueryExecutionIds = _List1 # pQueryExecutionIds_}
bgqeQueryExecutionIds :: Lens' BatchGetQueryExecution (NonEmpty Text)
bgqeQueryExecutionIds = lens _bgqeQueryExecutionIds (\ s a -> s{_bgqeQueryExecutionIds = a}) . _List1
instance AWSRequest BatchGetQueryExecution where
type Rs BatchGetQueryExecution =
BatchGetQueryExecutionResponse
request = postJSON athena
response
= receiveJSON
(\ s h x ->
BatchGetQueryExecutionResponse' <$>
(x .?> "UnprocessedQueryExecutionIds" .!@ mempty) <*>
(x .?> "QueryExecutions" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable BatchGetQueryExecution where
instance NFData BatchGetQueryExecution where
instance ToHeaders BatchGetQueryExecution where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonAthena.BatchGetQueryExecution" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON BatchGetQueryExecution where
toJSON BatchGetQueryExecution'{..}
= object
(catMaybes
[Just
("QueryExecutionIds" .= _bgqeQueryExecutionIds)])
instance ToPath BatchGetQueryExecution where
toPath = const "/"
instance ToQuery BatchGetQueryExecution where
toQuery = const mempty
data BatchGetQueryExecutionResponse = BatchGetQueryExecutionResponse'
{ _bgqersUnprocessedQueryExecutionIds :: !(Maybe [UnprocessedQueryExecutionId])
, _bgqersQueryExecutions :: !(Maybe [QueryExecution])
, _bgqersResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
batchGetQueryExecutionResponse
:: Int
-> BatchGetQueryExecutionResponse
batchGetQueryExecutionResponse pResponseStatus_ =
BatchGetQueryExecutionResponse'
{ _bgqersUnprocessedQueryExecutionIds = Nothing
, _bgqersQueryExecutions = Nothing
, _bgqersResponseStatus = pResponseStatus_
}
bgqersUnprocessedQueryExecutionIds :: Lens' BatchGetQueryExecutionResponse [UnprocessedQueryExecutionId]
bgqersUnprocessedQueryExecutionIds = lens _bgqersUnprocessedQueryExecutionIds (\ s a -> s{_bgqersUnprocessedQueryExecutionIds = a}) . _Default . _Coerce
bgqersQueryExecutions :: Lens' BatchGetQueryExecutionResponse [QueryExecution]
bgqersQueryExecutions = lens _bgqersQueryExecutions (\ s a -> s{_bgqersQueryExecutions = a}) . _Default . _Coerce
bgqersResponseStatus :: Lens' BatchGetQueryExecutionResponse Int
bgqersResponseStatus = lens _bgqersResponseStatus (\ s a -> s{_bgqersResponseStatus = a})
instance NFData BatchGetQueryExecutionResponse where