{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Network.Livy.Client.Interactive.CancelStatement
(
CancelStatement (..)
, cancelStatement
, cstmSessionId
, cstmStatementId
, CancelStatementResponse (..)
, csrMsg
) where
import Control.Lens
import Data.Aeson.TH
import Data.Text (Text)
import Data.Typeable
import Network.Livy.Client.Internal.JSON
import Network.Livy.Client.Types.Session
import Network.Livy.Client.Types.Statement
import Network.Livy.Internal.Text
import Network.Livy.Request
import Network.Livy.Types
data CancelStatement = CancelStatement
{ _cstmSessionId :: SessionId
, _cstmStatementId :: StatementId
} deriving (Eq, Show, Typeable)
makeLenses ''CancelStatement
deriveToJSON (recordPrefixOptions 5) ''CancelStatement
instance ToPath CancelStatement where
toPath r = toPath
[ "sessions", toText $ r ^. cstmSessionId
, "statements", toText $ r ^. cstmStatementId
, "cancel"
]
instance LivyRequest CancelStatement where
request = post
cancelStatement :: SessionId -> StatementId -> CancelStatement
cancelStatement = CancelStatement
newtype CancelStatementResponse = CancelStatementResponse
{ _csrMsg :: Text
} deriving (Eq, Show, Typeable)
makeLenses ''CancelStatementResponse
deriveFromJSON (recordPrefixOptions 4) ''CancelStatementResponse
type instance LivyResponse CancelStatement = CancelStatementResponse