{-# 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.Amplify.StopJob
(
StopJob (..),
newStopJob,
stopJob_appId,
stopJob_branchName,
stopJob_jobId,
StopJobResponse (..),
newStopJobResponse,
stopJobResponse_httpStatus,
stopJobResponse_jobSummary,
)
where
import Amazonka.Amplify.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 StopJob = StopJob'
{
StopJob -> Text
appId :: Prelude.Text,
StopJob -> Text
branchName :: Prelude.Text,
StopJob -> Text
jobId :: Prelude.Text
}
deriving (StopJob -> StopJob -> Bool
(StopJob -> StopJob -> Bool)
-> (StopJob -> StopJob -> Bool) -> Eq StopJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopJob -> StopJob -> Bool
$c/= :: StopJob -> StopJob -> Bool
== :: StopJob -> StopJob -> Bool
$c== :: StopJob -> StopJob -> Bool
Prelude.Eq, ReadPrec [StopJob]
ReadPrec StopJob
Int -> ReadS StopJob
ReadS [StopJob]
(Int -> ReadS StopJob)
-> ReadS [StopJob]
-> ReadPrec StopJob
-> ReadPrec [StopJob]
-> Read StopJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopJob]
$creadListPrec :: ReadPrec [StopJob]
readPrec :: ReadPrec StopJob
$creadPrec :: ReadPrec StopJob
readList :: ReadS [StopJob]
$creadList :: ReadS [StopJob]
readsPrec :: Int -> ReadS StopJob
$creadsPrec :: Int -> ReadS StopJob
Prelude.Read, Int -> StopJob -> ShowS
[StopJob] -> ShowS
StopJob -> String
(Int -> StopJob -> ShowS)
-> (StopJob -> String) -> ([StopJob] -> ShowS) -> Show StopJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopJob] -> ShowS
$cshowList :: [StopJob] -> ShowS
show :: StopJob -> String
$cshow :: StopJob -> String
showsPrec :: Int -> StopJob -> ShowS
$cshowsPrec :: Int -> StopJob -> ShowS
Prelude.Show, (forall x. StopJob -> Rep StopJob x)
-> (forall x. Rep StopJob x -> StopJob) -> Generic StopJob
forall x. Rep StopJob x -> StopJob
forall x. StopJob -> Rep StopJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopJob x -> StopJob
$cfrom :: forall x. StopJob -> Rep StopJob x
Prelude.Generic)
newStopJob ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
StopJob
newStopJob :: Text -> Text -> Text -> StopJob
newStopJob Text
pAppId_ Text
pBranchName_ Text
pJobId_ =
StopJob' :: Text -> Text -> Text -> StopJob
StopJob'
{ $sel:appId:StopJob' :: Text
appId = Text
pAppId_,
$sel:branchName:StopJob' :: Text
branchName = Text
pBranchName_,
$sel:jobId:StopJob' :: Text
jobId = Text
pJobId_
}
stopJob_appId :: Lens.Lens' StopJob Prelude.Text
stopJob_appId :: (Text -> f Text) -> StopJob -> f StopJob
stopJob_appId = (StopJob -> Text)
-> (StopJob -> Text -> StopJob) -> Lens StopJob StopJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopJob' {Text
appId :: Text
$sel:appId:StopJob' :: StopJob -> Text
appId} -> Text
appId) (\s :: StopJob
s@StopJob' {} Text
a -> StopJob
s {$sel:appId:StopJob' :: Text
appId = Text
a} :: StopJob)
stopJob_branchName :: Lens.Lens' StopJob Prelude.Text
stopJob_branchName :: (Text -> f Text) -> StopJob -> f StopJob
stopJob_branchName = (StopJob -> Text)
-> (StopJob -> Text -> StopJob) -> Lens StopJob StopJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopJob' {Text
branchName :: Text
$sel:branchName:StopJob' :: StopJob -> Text
branchName} -> Text
branchName) (\s :: StopJob
s@StopJob' {} Text
a -> StopJob
s {$sel:branchName:StopJob' :: Text
branchName = Text
a} :: StopJob)
stopJob_jobId :: Lens.Lens' StopJob Prelude.Text
stopJob_jobId :: (Text -> f Text) -> StopJob -> f StopJob
stopJob_jobId = (StopJob -> Text)
-> (StopJob -> Text -> StopJob) -> Lens StopJob StopJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopJob' {Text
jobId :: Text
$sel:jobId:StopJob' :: StopJob -> Text
jobId} -> Text
jobId) (\s :: StopJob
s@StopJob' {} Text
a -> StopJob
s {$sel:jobId:StopJob' :: Text
jobId = Text
a} :: StopJob)
instance Core.AWSRequest StopJob where
type AWSResponse StopJob = StopJobResponse
request :: StopJob -> Request StopJob
request = Service -> StopJob -> Request StopJob
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
response :: Logger
-> Service
-> Proxy StopJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopJob)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StopJob))
-> Logger
-> Service
-> Proxy StopJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopJob)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> JobSummary -> StopJobResponse
StopJobResponse'
(Int -> JobSummary -> StopJobResponse)
-> Either String Int
-> Either String (JobSummary -> StopJobResponse)
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))
Either String (JobSummary -> StopJobResponse)
-> Either String JobSummary -> Either String StopJobResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String JobSummary
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"jobSummary")
)
instance Prelude.Hashable StopJob
instance Prelude.NFData StopJob
instance Core.ToHeaders StopJob where
toHeaders :: StopJob -> ResponseHeaders
toHeaders =
ResponseHeaders -> StopJob -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.ToPath StopJob where
toPath :: StopJob -> ByteString
toPath StopJob' {Text
jobId :: Text
branchName :: Text
appId :: Text
$sel:jobId:StopJob' :: StopJob -> Text
$sel:branchName:StopJob' :: StopJob -> Text
$sel:appId:StopJob' :: StopJob -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/apps/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
appId,
ByteString
"/branches/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
branchName,
ByteString
"/jobs/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
jobId,
ByteString
"/stop"
]
instance Core.ToQuery StopJob where
toQuery :: StopJob -> QueryString
toQuery = QueryString -> StopJob -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StopJobResponse = StopJobResponse'
{
StopJobResponse -> Int
httpStatus :: Prelude.Int,
StopJobResponse -> JobSummary
jobSummary :: JobSummary
}
deriving (StopJobResponse -> StopJobResponse -> Bool
(StopJobResponse -> StopJobResponse -> Bool)
-> (StopJobResponse -> StopJobResponse -> Bool)
-> Eq StopJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopJobResponse -> StopJobResponse -> Bool
$c/= :: StopJobResponse -> StopJobResponse -> Bool
== :: StopJobResponse -> StopJobResponse -> Bool
$c== :: StopJobResponse -> StopJobResponse -> Bool
Prelude.Eq, ReadPrec [StopJobResponse]
ReadPrec StopJobResponse
Int -> ReadS StopJobResponse
ReadS [StopJobResponse]
(Int -> ReadS StopJobResponse)
-> ReadS [StopJobResponse]
-> ReadPrec StopJobResponse
-> ReadPrec [StopJobResponse]
-> Read StopJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopJobResponse]
$creadListPrec :: ReadPrec [StopJobResponse]
readPrec :: ReadPrec StopJobResponse
$creadPrec :: ReadPrec StopJobResponse
readList :: ReadS [StopJobResponse]
$creadList :: ReadS [StopJobResponse]
readsPrec :: Int -> ReadS StopJobResponse
$creadsPrec :: Int -> ReadS StopJobResponse
Prelude.Read, Int -> StopJobResponse -> ShowS
[StopJobResponse] -> ShowS
StopJobResponse -> String
(Int -> StopJobResponse -> ShowS)
-> (StopJobResponse -> String)
-> ([StopJobResponse] -> ShowS)
-> Show StopJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopJobResponse] -> ShowS
$cshowList :: [StopJobResponse] -> ShowS
show :: StopJobResponse -> String
$cshow :: StopJobResponse -> String
showsPrec :: Int -> StopJobResponse -> ShowS
$cshowsPrec :: Int -> StopJobResponse -> ShowS
Prelude.Show, (forall x. StopJobResponse -> Rep StopJobResponse x)
-> (forall x. Rep StopJobResponse x -> StopJobResponse)
-> Generic StopJobResponse
forall x. Rep StopJobResponse x -> StopJobResponse
forall x. StopJobResponse -> Rep StopJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopJobResponse x -> StopJobResponse
$cfrom :: forall x. StopJobResponse -> Rep StopJobResponse x
Prelude.Generic)
newStopJobResponse ::
Prelude.Int ->
JobSummary ->
StopJobResponse
newStopJobResponse :: Int -> JobSummary -> StopJobResponse
newStopJobResponse Int
pHttpStatus_ JobSummary
pJobSummary_ =
StopJobResponse' :: Int -> JobSummary -> StopJobResponse
StopJobResponse'
{ $sel:httpStatus:StopJobResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:jobSummary:StopJobResponse' :: JobSummary
jobSummary = JobSummary
pJobSummary_
}
stopJobResponse_httpStatus :: Lens.Lens' StopJobResponse Prelude.Int
stopJobResponse_httpStatus :: (Int -> f Int) -> StopJobResponse -> f StopJobResponse
stopJobResponse_httpStatus = (StopJobResponse -> Int)
-> (StopJobResponse -> Int -> StopJobResponse)
-> Lens StopJobResponse StopJobResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopJobResponse' {Int
httpStatus :: Int
$sel:httpStatus:StopJobResponse' :: StopJobResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StopJobResponse
s@StopJobResponse' {} Int
a -> StopJobResponse
s {$sel:httpStatus:StopJobResponse' :: Int
httpStatus = Int
a} :: StopJobResponse)
stopJobResponse_jobSummary :: Lens.Lens' StopJobResponse JobSummary
stopJobResponse_jobSummary :: (JobSummary -> f JobSummary)
-> StopJobResponse -> f StopJobResponse
stopJobResponse_jobSummary = (StopJobResponse -> JobSummary)
-> (StopJobResponse -> JobSummary -> StopJobResponse)
-> Lens StopJobResponse StopJobResponse JobSummary JobSummary
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopJobResponse' {JobSummary
jobSummary :: JobSummary
$sel:jobSummary:StopJobResponse' :: StopJobResponse -> JobSummary
jobSummary} -> JobSummary
jobSummary) (\s :: StopJobResponse
s@StopJobResponse' {} JobSummary
a -> StopJobResponse
s {$sel:jobSummary:StopJobResponse' :: JobSummary
jobSummary = JobSummary
a} :: StopJobResponse)
instance Prelude.NFData StopJobResponse