{-# 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.GetQueryExecution
(
getQueryExecution
, GetQueryExecution
, gqeQueryExecutionId
, getQueryExecutionResponse
, GetQueryExecutionResponse
, gqersQueryExecution
, gqersResponseStatus
) 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 GetQueryExecution = GetQueryExecution'
{ _gqeQueryExecutionId :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getQueryExecution
:: Text
-> GetQueryExecution
getQueryExecution pQueryExecutionId_ =
GetQueryExecution' {_gqeQueryExecutionId = pQueryExecutionId_}
gqeQueryExecutionId :: Lens' GetQueryExecution Text
gqeQueryExecutionId = lens _gqeQueryExecutionId (\ s a -> s{_gqeQueryExecutionId = a})
instance AWSRequest GetQueryExecution where
type Rs GetQueryExecution = GetQueryExecutionResponse
request = postJSON athena
response
= receiveJSON
(\ s h x ->
GetQueryExecutionResponse' <$>
(x .?> "QueryExecution") <*> (pure (fromEnum s)))
instance Hashable GetQueryExecution where
instance NFData GetQueryExecution where
instance ToHeaders GetQueryExecution where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonAthena.GetQueryExecution" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetQueryExecution where
toJSON GetQueryExecution'{..}
= object
(catMaybes
[Just ("QueryExecutionId" .= _gqeQueryExecutionId)])
instance ToPath GetQueryExecution where
toPath = const "/"
instance ToQuery GetQueryExecution where
toQuery = const mempty
data GetQueryExecutionResponse = GetQueryExecutionResponse'
{ _gqersQueryExecution :: !(Maybe QueryExecution)
, _gqersResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getQueryExecutionResponse
:: Int
-> GetQueryExecutionResponse
getQueryExecutionResponse pResponseStatus_ =
GetQueryExecutionResponse'
{_gqersQueryExecution = Nothing, _gqersResponseStatus = pResponseStatus_}
gqersQueryExecution :: Lens' GetQueryExecutionResponse (Maybe QueryExecution)
gqersQueryExecution = lens _gqersQueryExecution (\ s a -> s{_gqersQueryExecution = a})
gqersResponseStatus :: Lens' GetQueryExecutionResponse Int
gqersResponseStatus = lens _gqersResponseStatus (\ s a -> s{_gqersResponseStatus = a})
instance NFData GetQueryExecutionResponse where