{-# 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.TerminateSession
(
TerminateSession (..),
newTerminateSession,
terminateSession_sessionId,
TerminateSessionResponse (..),
newTerminateSessionResponse,
terminateSessionResponse_state,
terminateSessionResponse_httpStatus,
)
where
import Amazonka.Athena.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data TerminateSession = TerminateSession'
{
TerminateSession -> Text
sessionId :: Prelude.Text
}
deriving (TerminateSession -> TerminateSession -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TerminateSession -> TerminateSession -> Bool
$c/= :: TerminateSession -> TerminateSession -> Bool
== :: TerminateSession -> TerminateSession -> Bool
$c== :: TerminateSession -> TerminateSession -> Bool
Prelude.Eq, ReadPrec [TerminateSession]
ReadPrec TerminateSession
Int -> ReadS TerminateSession
ReadS [TerminateSession]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TerminateSession]
$creadListPrec :: ReadPrec [TerminateSession]
readPrec :: ReadPrec TerminateSession
$creadPrec :: ReadPrec TerminateSession
readList :: ReadS [TerminateSession]
$creadList :: ReadS [TerminateSession]
readsPrec :: Int -> ReadS TerminateSession
$creadsPrec :: Int -> ReadS TerminateSession
Prelude.Read, Int -> TerminateSession -> ShowS
[TerminateSession] -> ShowS
TerminateSession -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TerminateSession] -> ShowS
$cshowList :: [TerminateSession] -> ShowS
show :: TerminateSession -> String
$cshow :: TerminateSession -> String
showsPrec :: Int -> TerminateSession -> ShowS
$cshowsPrec :: Int -> TerminateSession -> ShowS
Prelude.Show, forall x. Rep TerminateSession x -> TerminateSession
forall x. TerminateSession -> Rep TerminateSession x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TerminateSession x -> TerminateSession
$cfrom :: forall x. TerminateSession -> Rep TerminateSession x
Prelude.Generic)
newTerminateSession ::
Prelude.Text ->
TerminateSession
newTerminateSession :: Text -> TerminateSession
newTerminateSession Text
pSessionId_ =
TerminateSession' {$sel:sessionId:TerminateSession' :: Text
sessionId = Text
pSessionId_}
terminateSession_sessionId :: Lens.Lens' TerminateSession Prelude.Text
terminateSession_sessionId :: Lens' TerminateSession Text
terminateSession_sessionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TerminateSession' {Text
sessionId :: Text
$sel:sessionId:TerminateSession' :: TerminateSession -> Text
sessionId} -> Text
sessionId) (\s :: TerminateSession
s@TerminateSession' {} Text
a -> TerminateSession
s {$sel:sessionId:TerminateSession' :: Text
sessionId = Text
a} :: TerminateSession)
instance Core.AWSRequest TerminateSession where
type
AWSResponse TerminateSession =
TerminateSessionResponse
request :: (Service -> Service)
-> TerminateSession -> Request TerminateSession
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy TerminateSession
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TerminateSession)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe SessionState -> Int -> TerminateSessionResponse
TerminateSessionResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"State")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable TerminateSession where
hashWithSalt :: Int -> TerminateSession -> Int
hashWithSalt Int
_salt TerminateSession' {Text
sessionId :: Text
$sel:sessionId:TerminateSession' :: TerminateSession -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sessionId
instance Prelude.NFData TerminateSession where
rnf :: TerminateSession -> ()
rnf TerminateSession' {Text
sessionId :: Text
$sel:sessionId:TerminateSession' :: TerminateSession -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
sessionId
instance Data.ToHeaders TerminateSession where
toHeaders :: TerminateSession -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AmazonAthena.TerminateSession" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON TerminateSession where
toJSON :: TerminateSession -> Value
toJSON TerminateSession' {Text
sessionId :: Text
$sel:sessionId:TerminateSession' :: TerminateSession -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"SessionId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
sessionId)]
)
instance Data.ToPath TerminateSession where
toPath :: TerminateSession -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery TerminateSession where
toQuery :: TerminateSession -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data TerminateSessionResponse = TerminateSessionResponse'
{
TerminateSessionResponse -> Maybe SessionState
state :: Prelude.Maybe SessionState,
TerminateSessionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (TerminateSessionResponse -> TerminateSessionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TerminateSessionResponse -> TerminateSessionResponse -> Bool
$c/= :: TerminateSessionResponse -> TerminateSessionResponse -> Bool
== :: TerminateSessionResponse -> TerminateSessionResponse -> Bool
$c== :: TerminateSessionResponse -> TerminateSessionResponse -> Bool
Prelude.Eq, ReadPrec [TerminateSessionResponse]
ReadPrec TerminateSessionResponse
Int -> ReadS TerminateSessionResponse
ReadS [TerminateSessionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TerminateSessionResponse]
$creadListPrec :: ReadPrec [TerminateSessionResponse]
readPrec :: ReadPrec TerminateSessionResponse
$creadPrec :: ReadPrec TerminateSessionResponse
readList :: ReadS [TerminateSessionResponse]
$creadList :: ReadS [TerminateSessionResponse]
readsPrec :: Int -> ReadS TerminateSessionResponse
$creadsPrec :: Int -> ReadS TerminateSessionResponse
Prelude.Read, Int -> TerminateSessionResponse -> ShowS
[TerminateSessionResponse] -> ShowS
TerminateSessionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TerminateSessionResponse] -> ShowS
$cshowList :: [TerminateSessionResponse] -> ShowS
show :: TerminateSessionResponse -> String
$cshow :: TerminateSessionResponse -> String
showsPrec :: Int -> TerminateSessionResponse -> ShowS
$cshowsPrec :: Int -> TerminateSessionResponse -> ShowS
Prelude.Show, forall x.
Rep TerminateSessionResponse x -> TerminateSessionResponse
forall x.
TerminateSessionResponse -> Rep TerminateSessionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TerminateSessionResponse x -> TerminateSessionResponse
$cfrom :: forall x.
TerminateSessionResponse -> Rep TerminateSessionResponse x
Prelude.Generic)
newTerminateSessionResponse ::
Prelude.Int ->
TerminateSessionResponse
newTerminateSessionResponse :: Int -> TerminateSessionResponse
newTerminateSessionResponse Int
pHttpStatus_ =
TerminateSessionResponse'
{ $sel:state:TerminateSessionResponse' :: Maybe SessionState
state = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:TerminateSessionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
terminateSessionResponse_state :: Lens.Lens' TerminateSessionResponse (Prelude.Maybe SessionState)
terminateSessionResponse_state :: Lens' TerminateSessionResponse (Maybe SessionState)
terminateSessionResponse_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TerminateSessionResponse' {Maybe SessionState
state :: Maybe SessionState
$sel:state:TerminateSessionResponse' :: TerminateSessionResponse -> Maybe SessionState
state} -> Maybe SessionState
state) (\s :: TerminateSessionResponse
s@TerminateSessionResponse' {} Maybe SessionState
a -> TerminateSessionResponse
s {$sel:state:TerminateSessionResponse' :: Maybe SessionState
state = Maybe SessionState
a} :: TerminateSessionResponse)
terminateSessionResponse_httpStatus :: Lens.Lens' TerminateSessionResponse Prelude.Int
terminateSessionResponse_httpStatus :: Lens' TerminateSessionResponse Int
terminateSessionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TerminateSessionResponse' {Int
httpStatus :: Int
$sel:httpStatus:TerminateSessionResponse' :: TerminateSessionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: TerminateSessionResponse
s@TerminateSessionResponse' {} Int
a -> TerminateSessionResponse
s {$sel:httpStatus:TerminateSessionResponse' :: Int
httpStatus = Int
a} :: TerminateSessionResponse)
instance Prelude.NFData TerminateSessionResponse where
rnf :: TerminateSessionResponse -> ()
rnf TerminateSessionResponse' {Int
Maybe SessionState
httpStatus :: Int
state :: Maybe SessionState
$sel:httpStatus:TerminateSessionResponse' :: TerminateSessionResponse -> Int
$sel:state:TerminateSessionResponse' :: TerminateSessionResponse -> Maybe SessionState
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe SessionState
state
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus