{-# 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.Batch.TerminateJob
(
TerminateJob (..),
newTerminateJob,
terminateJob_jobId,
terminateJob_reason,
TerminateJobResponse (..),
newTerminateJobResponse,
terminateJobResponse_httpStatus,
)
where
import Amazonka.Batch.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 TerminateJob = TerminateJob'
{
TerminateJob -> Text
jobId :: Prelude.Text,
TerminateJob -> Text
reason :: Prelude.Text
}
deriving (TerminateJob -> TerminateJob -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TerminateJob -> TerminateJob -> Bool
$c/= :: TerminateJob -> TerminateJob -> Bool
== :: TerminateJob -> TerminateJob -> Bool
$c== :: TerminateJob -> TerminateJob -> Bool
Prelude.Eq, ReadPrec [TerminateJob]
ReadPrec TerminateJob
Int -> ReadS TerminateJob
ReadS [TerminateJob]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TerminateJob]
$creadListPrec :: ReadPrec [TerminateJob]
readPrec :: ReadPrec TerminateJob
$creadPrec :: ReadPrec TerminateJob
readList :: ReadS [TerminateJob]
$creadList :: ReadS [TerminateJob]
readsPrec :: Int -> ReadS TerminateJob
$creadsPrec :: Int -> ReadS TerminateJob
Prelude.Read, Int -> TerminateJob -> ShowS
[TerminateJob] -> ShowS
TerminateJob -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TerminateJob] -> ShowS
$cshowList :: [TerminateJob] -> ShowS
show :: TerminateJob -> String
$cshow :: TerminateJob -> String
showsPrec :: Int -> TerminateJob -> ShowS
$cshowsPrec :: Int -> TerminateJob -> ShowS
Prelude.Show, forall x. Rep TerminateJob x -> TerminateJob
forall x. TerminateJob -> Rep TerminateJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TerminateJob x -> TerminateJob
$cfrom :: forall x. TerminateJob -> Rep TerminateJob x
Prelude.Generic)
newTerminateJob ::
Prelude.Text ->
Prelude.Text ->
TerminateJob
newTerminateJob :: Text -> Text -> TerminateJob
newTerminateJob Text
pJobId_ Text
pReason_ =
TerminateJob' {$sel:jobId:TerminateJob' :: Text
jobId = Text
pJobId_, $sel:reason:TerminateJob' :: Text
reason = Text
pReason_}
terminateJob_jobId :: Lens.Lens' TerminateJob Prelude.Text
terminateJob_jobId :: Lens' TerminateJob Text
terminateJob_jobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TerminateJob' {Text
jobId :: Text
$sel:jobId:TerminateJob' :: TerminateJob -> Text
jobId} -> Text
jobId) (\s :: TerminateJob
s@TerminateJob' {} Text
a -> TerminateJob
s {$sel:jobId:TerminateJob' :: Text
jobId = Text
a} :: TerminateJob)
terminateJob_reason :: Lens.Lens' TerminateJob Prelude.Text
terminateJob_reason :: Lens' TerminateJob Text
terminateJob_reason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TerminateJob' {Text
reason :: Text
$sel:reason:TerminateJob' :: TerminateJob -> Text
reason} -> Text
reason) (\s :: TerminateJob
s@TerminateJob' {} Text
a -> TerminateJob
s {$sel:reason:TerminateJob' :: Text
reason = Text
a} :: TerminateJob)
instance Core.AWSRequest TerminateJob where
type AWSResponse TerminateJob = TerminateJobResponse
request :: (Service -> Service) -> TerminateJob -> Request TerminateJob
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 TerminateJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TerminateJob)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> TerminateJobResponse
TerminateJobResponse'
forall (f :: * -> *) a b. Functor 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 TerminateJob where
hashWithSalt :: Int -> TerminateJob -> Int
hashWithSalt Int
_salt TerminateJob' {Text
reason :: Text
jobId :: Text
$sel:reason:TerminateJob' :: TerminateJob -> Text
$sel:jobId:TerminateJob' :: TerminateJob -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
jobId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
reason
instance Prelude.NFData TerminateJob where
rnf :: TerminateJob -> ()
rnf TerminateJob' {Text
reason :: Text
jobId :: Text
$sel:reason:TerminateJob' :: TerminateJob -> Text
$sel:jobId:TerminateJob' :: TerminateJob -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
jobId seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
reason
instance Data.ToHeaders TerminateJob where
toHeaders :: TerminateJob -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON TerminateJob where
toJSON :: TerminateJob -> Value
toJSON TerminateJob' {Text
reason :: Text
jobId :: Text
$sel:reason:TerminateJob' :: TerminateJob -> Text
$sel:jobId:TerminateJob' :: TerminateJob -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"jobId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
jobId),
forall a. a -> Maybe a
Prelude.Just (Key
"reason" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
reason)
]
)
instance Data.ToPath TerminateJob where
toPath :: TerminateJob -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/v1/terminatejob"
instance Data.ToQuery TerminateJob where
toQuery :: TerminateJob -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data TerminateJobResponse = TerminateJobResponse'
{
TerminateJobResponse -> Int
httpStatus :: Prelude.Int
}
deriving (TerminateJobResponse -> TerminateJobResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TerminateJobResponse -> TerminateJobResponse -> Bool
$c/= :: TerminateJobResponse -> TerminateJobResponse -> Bool
== :: TerminateJobResponse -> TerminateJobResponse -> Bool
$c== :: TerminateJobResponse -> TerminateJobResponse -> Bool
Prelude.Eq, ReadPrec [TerminateJobResponse]
ReadPrec TerminateJobResponse
Int -> ReadS TerminateJobResponse
ReadS [TerminateJobResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TerminateJobResponse]
$creadListPrec :: ReadPrec [TerminateJobResponse]
readPrec :: ReadPrec TerminateJobResponse
$creadPrec :: ReadPrec TerminateJobResponse
readList :: ReadS [TerminateJobResponse]
$creadList :: ReadS [TerminateJobResponse]
readsPrec :: Int -> ReadS TerminateJobResponse
$creadsPrec :: Int -> ReadS TerminateJobResponse
Prelude.Read, Int -> TerminateJobResponse -> ShowS
[TerminateJobResponse] -> ShowS
TerminateJobResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TerminateJobResponse] -> ShowS
$cshowList :: [TerminateJobResponse] -> ShowS
show :: TerminateJobResponse -> String
$cshow :: TerminateJobResponse -> String
showsPrec :: Int -> TerminateJobResponse -> ShowS
$cshowsPrec :: Int -> TerminateJobResponse -> ShowS
Prelude.Show, forall x. Rep TerminateJobResponse x -> TerminateJobResponse
forall x. TerminateJobResponse -> Rep TerminateJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TerminateJobResponse x -> TerminateJobResponse
$cfrom :: forall x. TerminateJobResponse -> Rep TerminateJobResponse x
Prelude.Generic)
newTerminateJobResponse ::
Prelude.Int ->
TerminateJobResponse
newTerminateJobResponse :: Int -> TerminateJobResponse
newTerminateJobResponse Int
pHttpStatus_ =
TerminateJobResponse' {$sel:httpStatus:TerminateJobResponse' :: Int
httpStatus = Int
pHttpStatus_}
terminateJobResponse_httpStatus :: Lens.Lens' TerminateJobResponse Prelude.Int
terminateJobResponse_httpStatus :: Lens' TerminateJobResponse Int
terminateJobResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TerminateJobResponse' {Int
httpStatus :: Int
$sel:httpStatus:TerminateJobResponse' :: TerminateJobResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: TerminateJobResponse
s@TerminateJobResponse' {} Int
a -> TerminateJobResponse
s {$sel:httpStatus:TerminateJobResponse' :: Int
httpStatus = Int
a} :: TerminateJobResponse)
instance Prelude.NFData TerminateJobResponse where
rnf :: TerminateJobResponse -> ()
rnf TerminateJobResponse' {Int
httpStatus :: Int
$sel:httpStatus:TerminateJobResponse' :: TerminateJobResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus