{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Athena.StopQueryExecution
(
StopQueryExecution (..),
newStopQueryExecution,
stopQueryExecution_queryExecutionId,
StopQueryExecutionResponse (..),
newStopQueryExecutionResponse,
stopQueryExecutionResponse_httpStatus,
)
where
import Amazonka.Athena.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data StopQueryExecution = StopQueryExecution'
{
StopQueryExecution -> Text
queryExecutionId :: Prelude.Text
}
deriving (StopQueryExecution -> StopQueryExecution -> Bool
(StopQueryExecution -> StopQueryExecution -> Bool)
-> (StopQueryExecution -> StopQueryExecution -> Bool)
-> Eq StopQueryExecution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopQueryExecution -> StopQueryExecution -> Bool
$c/= :: StopQueryExecution -> StopQueryExecution -> Bool
== :: StopQueryExecution -> StopQueryExecution -> Bool
$c== :: StopQueryExecution -> StopQueryExecution -> Bool
Prelude.Eq, ReadPrec [StopQueryExecution]
ReadPrec StopQueryExecution
Int -> ReadS StopQueryExecution
ReadS [StopQueryExecution]
(Int -> ReadS StopQueryExecution)
-> ReadS [StopQueryExecution]
-> ReadPrec StopQueryExecution
-> ReadPrec [StopQueryExecution]
-> Read StopQueryExecution
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopQueryExecution]
$creadListPrec :: ReadPrec [StopQueryExecution]
readPrec :: ReadPrec StopQueryExecution
$creadPrec :: ReadPrec StopQueryExecution
readList :: ReadS [StopQueryExecution]
$creadList :: ReadS [StopQueryExecution]
readsPrec :: Int -> ReadS StopQueryExecution
$creadsPrec :: Int -> ReadS StopQueryExecution
Prelude.Read, Int -> StopQueryExecution -> ShowS
[StopQueryExecution] -> ShowS
StopQueryExecution -> String
(Int -> StopQueryExecution -> ShowS)
-> (StopQueryExecution -> String)
-> ([StopQueryExecution] -> ShowS)
-> Show StopQueryExecution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopQueryExecution] -> ShowS
$cshowList :: [StopQueryExecution] -> ShowS
show :: StopQueryExecution -> String
$cshow :: StopQueryExecution -> String
showsPrec :: Int -> StopQueryExecution -> ShowS
$cshowsPrec :: Int -> StopQueryExecution -> ShowS
Prelude.Show, (forall x. StopQueryExecution -> Rep StopQueryExecution x)
-> (forall x. Rep StopQueryExecution x -> StopQueryExecution)
-> Generic StopQueryExecution
forall x. Rep StopQueryExecution x -> StopQueryExecution
forall x. StopQueryExecution -> Rep StopQueryExecution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopQueryExecution x -> StopQueryExecution
$cfrom :: forall x. StopQueryExecution -> Rep StopQueryExecution x
Prelude.Generic)
newStopQueryExecution ::
Prelude.Text ->
StopQueryExecution
newStopQueryExecution :: Text -> StopQueryExecution
newStopQueryExecution Text
pQueryExecutionId_ =
StopQueryExecution' :: Text -> StopQueryExecution
StopQueryExecution'
{ $sel:queryExecutionId:StopQueryExecution' :: Text
queryExecutionId =
Text
pQueryExecutionId_
}
stopQueryExecution_queryExecutionId :: Lens.Lens' StopQueryExecution Prelude.Text
stopQueryExecution_queryExecutionId :: (Text -> f Text) -> StopQueryExecution -> f StopQueryExecution
stopQueryExecution_queryExecutionId = (StopQueryExecution -> Text)
-> (StopQueryExecution -> Text -> StopQueryExecution)
-> Lens StopQueryExecution StopQueryExecution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopQueryExecution' {Text
queryExecutionId :: Text
$sel:queryExecutionId:StopQueryExecution' :: StopQueryExecution -> Text
queryExecutionId} -> Text
queryExecutionId) (\s :: StopQueryExecution
s@StopQueryExecution' {} Text
a -> StopQueryExecution
s {$sel:queryExecutionId:StopQueryExecution' :: Text
queryExecutionId = Text
a} :: StopQueryExecution)
instance Core.AWSRequest StopQueryExecution where
type
AWSResponse StopQueryExecution =
StopQueryExecutionResponse
request :: StopQueryExecution -> Request StopQueryExecution
request = Service -> StopQueryExecution -> Request StopQueryExecution
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StopQueryExecution
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StopQueryExecution)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse StopQueryExecution))
-> Logger
-> Service
-> Proxy StopQueryExecution
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StopQueryExecution)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> StopQueryExecutionResponse
StopQueryExecutionResponse'
(Int -> StopQueryExecutionResponse)
-> Either String Int -> Either String StopQueryExecutionResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable StopQueryExecution
instance Prelude.NFData StopQueryExecution
instance Core.ToHeaders StopQueryExecution where
toHeaders :: StopQueryExecution -> ResponseHeaders
toHeaders =
ResponseHeaders -> StopQueryExecution -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AmazonAthena.StopQueryExecution" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON StopQueryExecution where
toJSON :: StopQueryExecution -> Value
toJSON StopQueryExecution' {Text
queryExecutionId :: Text
$sel:queryExecutionId:StopQueryExecution' :: StopQueryExecution -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"QueryExecutionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
queryExecutionId)
]
)
instance Core.ToPath StopQueryExecution where
toPath :: StopQueryExecution -> ByteString
toPath = ByteString -> StopQueryExecution -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery StopQueryExecution where
toQuery :: StopQueryExecution -> QueryString
toQuery = QueryString -> StopQueryExecution -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StopQueryExecutionResponse = StopQueryExecutionResponse'
{
StopQueryExecutionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StopQueryExecutionResponse -> StopQueryExecutionResponse -> Bool
(StopQueryExecutionResponse -> StopQueryExecutionResponse -> Bool)
-> (StopQueryExecutionResponse
-> StopQueryExecutionResponse -> Bool)
-> Eq StopQueryExecutionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopQueryExecutionResponse -> StopQueryExecutionResponse -> Bool
$c/= :: StopQueryExecutionResponse -> StopQueryExecutionResponse -> Bool
== :: StopQueryExecutionResponse -> StopQueryExecutionResponse -> Bool
$c== :: StopQueryExecutionResponse -> StopQueryExecutionResponse -> Bool
Prelude.Eq, ReadPrec [StopQueryExecutionResponse]
ReadPrec StopQueryExecutionResponse
Int -> ReadS StopQueryExecutionResponse
ReadS [StopQueryExecutionResponse]
(Int -> ReadS StopQueryExecutionResponse)
-> ReadS [StopQueryExecutionResponse]
-> ReadPrec StopQueryExecutionResponse
-> ReadPrec [StopQueryExecutionResponse]
-> Read StopQueryExecutionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopQueryExecutionResponse]
$creadListPrec :: ReadPrec [StopQueryExecutionResponse]
readPrec :: ReadPrec StopQueryExecutionResponse
$creadPrec :: ReadPrec StopQueryExecutionResponse
readList :: ReadS [StopQueryExecutionResponse]
$creadList :: ReadS [StopQueryExecutionResponse]
readsPrec :: Int -> ReadS StopQueryExecutionResponse
$creadsPrec :: Int -> ReadS StopQueryExecutionResponse
Prelude.Read, Int -> StopQueryExecutionResponse -> ShowS
[StopQueryExecutionResponse] -> ShowS
StopQueryExecutionResponse -> String
(Int -> StopQueryExecutionResponse -> ShowS)
-> (StopQueryExecutionResponse -> String)
-> ([StopQueryExecutionResponse] -> ShowS)
-> Show StopQueryExecutionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopQueryExecutionResponse] -> ShowS
$cshowList :: [StopQueryExecutionResponse] -> ShowS
show :: StopQueryExecutionResponse -> String
$cshow :: StopQueryExecutionResponse -> String
showsPrec :: Int -> StopQueryExecutionResponse -> ShowS
$cshowsPrec :: Int -> StopQueryExecutionResponse -> ShowS
Prelude.Show, (forall x.
StopQueryExecutionResponse -> Rep StopQueryExecutionResponse x)
-> (forall x.
Rep StopQueryExecutionResponse x -> StopQueryExecutionResponse)
-> Generic StopQueryExecutionResponse
forall x.
Rep StopQueryExecutionResponse x -> StopQueryExecutionResponse
forall x.
StopQueryExecutionResponse -> Rep StopQueryExecutionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StopQueryExecutionResponse x -> StopQueryExecutionResponse
$cfrom :: forall x.
StopQueryExecutionResponse -> Rep StopQueryExecutionResponse x
Prelude.Generic)
newStopQueryExecutionResponse ::
Prelude.Int ->
StopQueryExecutionResponse
newStopQueryExecutionResponse :: Int -> StopQueryExecutionResponse
newStopQueryExecutionResponse Int
pHttpStatus_ =
StopQueryExecutionResponse' :: Int -> StopQueryExecutionResponse
StopQueryExecutionResponse'
{ $sel:httpStatus:StopQueryExecutionResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
stopQueryExecutionResponse_httpStatus :: Lens.Lens' StopQueryExecutionResponse Prelude.Int
stopQueryExecutionResponse_httpStatus :: (Int -> f Int)
-> StopQueryExecutionResponse -> f StopQueryExecutionResponse
stopQueryExecutionResponse_httpStatus = (StopQueryExecutionResponse -> Int)
-> (StopQueryExecutionResponse
-> Int -> StopQueryExecutionResponse)
-> Lens
StopQueryExecutionResponse StopQueryExecutionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopQueryExecutionResponse' {Int
httpStatus :: Int
$sel:httpStatus:StopQueryExecutionResponse' :: StopQueryExecutionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StopQueryExecutionResponse
s@StopQueryExecutionResponse' {} Int
a -> StopQueryExecutionResponse
s {$sel:httpStatus:StopQueryExecutionResponse' :: Int
httpStatus = Int
a} :: StopQueryExecutionResponse)
instance Prelude.NFData StopQueryExecutionResponse