{-# 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.BatchGetNamedQuery
(
batchGetNamedQuery
, BatchGetNamedQuery
, bgnqNamedQueryIds
, batchGetNamedQueryResponse
, BatchGetNamedQueryResponse
, bgnqrsNamedQueries
, bgnqrsUnprocessedNamedQueryIds
, bgnqrsResponseStatus
) 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 BatchGetNamedQuery = BatchGetNamedQuery'
{ _bgnqNamedQueryIds :: List1 Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
batchGetNamedQuery
:: NonEmpty Text
-> BatchGetNamedQuery
batchGetNamedQuery pNamedQueryIds_ =
BatchGetNamedQuery' {_bgnqNamedQueryIds = _List1 # pNamedQueryIds_}
bgnqNamedQueryIds :: Lens' BatchGetNamedQuery (NonEmpty Text)
bgnqNamedQueryIds = lens _bgnqNamedQueryIds (\ s a -> s{_bgnqNamedQueryIds = a}) . _List1
instance AWSRequest BatchGetNamedQuery where
type Rs BatchGetNamedQuery =
BatchGetNamedQueryResponse
request = postJSON athena
response
= receiveJSON
(\ s h x ->
BatchGetNamedQueryResponse' <$>
(x .?> "NamedQueries" .!@ mempty) <*>
(x .?> "UnprocessedNamedQueryIds" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable BatchGetNamedQuery where
instance NFData BatchGetNamedQuery where
instance ToHeaders BatchGetNamedQuery where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonAthena.BatchGetNamedQuery" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON BatchGetNamedQuery where
toJSON BatchGetNamedQuery'{..}
= object
(catMaybes
[Just ("NamedQueryIds" .= _bgnqNamedQueryIds)])
instance ToPath BatchGetNamedQuery where
toPath = const "/"
instance ToQuery BatchGetNamedQuery where
toQuery = const mempty
data BatchGetNamedQueryResponse = BatchGetNamedQueryResponse'
{ _bgnqrsNamedQueries :: !(Maybe [NamedQuery])
, _bgnqrsUnprocessedNamedQueryIds :: !(Maybe [UnprocessedNamedQueryId])
, _bgnqrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
batchGetNamedQueryResponse
:: Int
-> BatchGetNamedQueryResponse
batchGetNamedQueryResponse pResponseStatus_ =
BatchGetNamedQueryResponse'
{ _bgnqrsNamedQueries = Nothing
, _bgnqrsUnprocessedNamedQueryIds = Nothing
, _bgnqrsResponseStatus = pResponseStatus_
}
bgnqrsNamedQueries :: Lens' BatchGetNamedQueryResponse [NamedQuery]
bgnqrsNamedQueries = lens _bgnqrsNamedQueries (\ s a -> s{_bgnqrsNamedQueries = a}) . _Default . _Coerce
bgnqrsUnprocessedNamedQueryIds :: Lens' BatchGetNamedQueryResponse [UnprocessedNamedQueryId]
bgnqrsUnprocessedNamedQueryIds = lens _bgnqrsUnprocessedNamedQueryIds (\ s a -> s{_bgnqrsUnprocessedNamedQueryIds = a}) . _Default . _Coerce
bgnqrsResponseStatus :: Lens' BatchGetNamedQueryResponse Int
bgnqrsResponseStatus = lens _bgnqrsResponseStatus (\ s a -> s{_bgnqrsResponseStatus = a})
instance NFData BatchGetNamedQueryResponse where