{-# 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.GetNamedQuery
(
getNamedQuery
, GetNamedQuery
, gnqNamedQueryId
, getNamedQueryResponse
, GetNamedQueryResponse
, gnqrsNamedQuery
, gnqrsResponseStatus
) 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 GetNamedQuery = GetNamedQuery'
{ _gnqNamedQueryId :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getNamedQuery
:: Text
-> GetNamedQuery
getNamedQuery pNamedQueryId_ =
GetNamedQuery' {_gnqNamedQueryId = pNamedQueryId_}
gnqNamedQueryId :: Lens' GetNamedQuery Text
gnqNamedQueryId = lens _gnqNamedQueryId (\ s a -> s{_gnqNamedQueryId = a})
instance AWSRequest GetNamedQuery where
type Rs GetNamedQuery = GetNamedQueryResponse
request = postJSON athena
response
= receiveJSON
(\ s h x ->
GetNamedQueryResponse' <$>
(x .?> "NamedQuery") <*> (pure (fromEnum s)))
instance Hashable GetNamedQuery where
instance NFData GetNamedQuery where
instance ToHeaders GetNamedQuery where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonAthena.GetNamedQuery" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetNamedQuery where
toJSON GetNamedQuery'{..}
= object
(catMaybes
[Just ("NamedQueryId" .= _gnqNamedQueryId)])
instance ToPath GetNamedQuery where
toPath = const "/"
instance ToQuery GetNamedQuery where
toQuery = const mempty
data GetNamedQueryResponse = GetNamedQueryResponse'
{ _gnqrsNamedQuery :: !(Maybe NamedQuery)
, _gnqrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getNamedQueryResponse
:: Int
-> GetNamedQueryResponse
getNamedQueryResponse pResponseStatus_ =
GetNamedQueryResponse'
{_gnqrsNamedQuery = Nothing, _gnqrsResponseStatus = pResponseStatus_}
gnqrsNamedQuery :: Lens' GetNamedQueryResponse (Maybe NamedQuery)
gnqrsNamedQuery = lens _gnqrsNamedQuery (\ s a -> s{_gnqrsNamedQuery = a})
gnqrsResponseStatus :: Lens' GetNamedQueryResponse Int
gnqrsResponseStatus = lens _gnqrsResponseStatus (\ s a -> s{_gnqrsResponseStatus = a})
instance NFData GetNamedQueryResponse where