{-# 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.StartJob
(
StartJob (..),
newStartJob,
startJob_commitId,
startJob_commitMessage,
startJob_commitTime,
startJob_jobId,
startJob_jobReason,
startJob_appId,
startJob_branchName,
startJob_jobType,
StartJobResponse (..),
newStartJobResponse,
startJobResponse_httpStatus,
startJobResponse_jobSummary,
)
where
import Amazonka.Amplify.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 StartJob = StartJob'
{
StartJob -> Maybe Text
commitId :: Prelude.Maybe Prelude.Text,
StartJob -> Maybe Text
commitMessage :: Prelude.Maybe Prelude.Text,
StartJob -> Maybe POSIX
commitTime :: Prelude.Maybe Data.POSIX,
StartJob -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
StartJob -> Maybe Text
jobReason :: Prelude.Maybe Prelude.Text,
StartJob -> Text
appId :: Prelude.Text,
StartJob -> Text
branchName :: Prelude.Text,
StartJob -> JobType
jobType :: JobType
}
deriving (StartJob -> StartJob -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartJob -> StartJob -> Bool
$c/= :: StartJob -> StartJob -> Bool
== :: StartJob -> StartJob -> Bool
$c== :: StartJob -> StartJob -> Bool
Prelude.Eq, ReadPrec [StartJob]
ReadPrec StartJob
Int -> ReadS StartJob
ReadS [StartJob]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartJob]
$creadListPrec :: ReadPrec [StartJob]
readPrec :: ReadPrec StartJob
$creadPrec :: ReadPrec StartJob
readList :: ReadS [StartJob]
$creadList :: ReadS [StartJob]
readsPrec :: Int -> ReadS StartJob
$creadsPrec :: Int -> ReadS StartJob
Prelude.Read, Int -> StartJob -> ShowS
[StartJob] -> ShowS
StartJob -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartJob] -> ShowS
$cshowList :: [StartJob] -> ShowS
show :: StartJob -> String
$cshow :: StartJob -> String
showsPrec :: Int -> StartJob -> ShowS
$cshowsPrec :: Int -> StartJob -> ShowS
Prelude.Show, forall x. Rep StartJob x -> StartJob
forall x. StartJob -> Rep StartJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartJob x -> StartJob
$cfrom :: forall x. StartJob -> Rep StartJob x
Prelude.Generic)
newStartJob ::
Prelude.Text ->
Prelude.Text ->
JobType ->
StartJob
newStartJob :: Text -> Text -> JobType -> StartJob
newStartJob Text
pAppId_ Text
pBranchName_ JobType
pJobType_ =
StartJob'
{ $sel:commitId:StartJob' :: Maybe Text
commitId = forall a. Maybe a
Prelude.Nothing,
$sel:commitMessage:StartJob' :: Maybe Text
commitMessage = forall a. Maybe a
Prelude.Nothing,
$sel:commitTime:StartJob' :: Maybe POSIX
commitTime = forall a. Maybe a
Prelude.Nothing,
$sel:jobId:StartJob' :: Maybe Text
jobId = forall a. Maybe a
Prelude.Nothing,
$sel:jobReason:StartJob' :: Maybe Text
jobReason = forall a. Maybe a
Prelude.Nothing,
$sel:appId:StartJob' :: Text
appId = Text
pAppId_,
$sel:branchName:StartJob' :: Text
branchName = Text
pBranchName_,
$sel:jobType:StartJob' :: JobType
jobType = JobType
pJobType_
}
startJob_commitId :: Lens.Lens' StartJob (Prelude.Maybe Prelude.Text)
startJob_commitId :: Lens' StartJob (Maybe Text)
startJob_commitId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJob' {Maybe Text
commitId :: Maybe Text
$sel:commitId:StartJob' :: StartJob -> Maybe Text
commitId} -> Maybe Text
commitId) (\s :: StartJob
s@StartJob' {} Maybe Text
a -> StartJob
s {$sel:commitId:StartJob' :: Maybe Text
commitId = Maybe Text
a} :: StartJob)
startJob_commitMessage :: Lens.Lens' StartJob (Prelude.Maybe Prelude.Text)
startJob_commitMessage :: Lens' StartJob (Maybe Text)
startJob_commitMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJob' {Maybe Text
commitMessage :: Maybe Text
$sel:commitMessage:StartJob' :: StartJob -> Maybe Text
commitMessage} -> Maybe Text
commitMessage) (\s :: StartJob
s@StartJob' {} Maybe Text
a -> StartJob
s {$sel:commitMessage:StartJob' :: Maybe Text
commitMessage = Maybe Text
a} :: StartJob)
startJob_commitTime :: Lens.Lens' StartJob (Prelude.Maybe Prelude.UTCTime)
startJob_commitTime :: Lens' StartJob (Maybe UTCTime)
startJob_commitTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJob' {Maybe POSIX
commitTime :: Maybe POSIX
$sel:commitTime:StartJob' :: StartJob -> Maybe POSIX
commitTime} -> Maybe POSIX
commitTime) (\s :: StartJob
s@StartJob' {} Maybe POSIX
a -> StartJob
s {$sel:commitTime:StartJob' :: Maybe POSIX
commitTime = Maybe POSIX
a} :: StartJob) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
startJob_jobId :: Lens.Lens' StartJob (Prelude.Maybe Prelude.Text)
startJob_jobId :: Lens' StartJob (Maybe Text)
startJob_jobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJob' {Maybe Text
jobId :: Maybe Text
$sel:jobId:StartJob' :: StartJob -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: StartJob
s@StartJob' {} Maybe Text
a -> StartJob
s {$sel:jobId:StartJob' :: Maybe Text
jobId = Maybe Text
a} :: StartJob)
startJob_jobReason :: Lens.Lens' StartJob (Prelude.Maybe Prelude.Text)
startJob_jobReason :: Lens' StartJob (Maybe Text)
startJob_jobReason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJob' {Maybe Text
jobReason :: Maybe Text
$sel:jobReason:StartJob' :: StartJob -> Maybe Text
jobReason} -> Maybe Text
jobReason) (\s :: StartJob
s@StartJob' {} Maybe Text
a -> StartJob
s {$sel:jobReason:StartJob' :: Maybe Text
jobReason = Maybe Text
a} :: StartJob)
startJob_appId :: Lens.Lens' StartJob Prelude.Text
startJob_appId :: Lens' StartJob Text
startJob_appId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJob' {Text
appId :: Text
$sel:appId:StartJob' :: StartJob -> Text
appId} -> Text
appId) (\s :: StartJob
s@StartJob' {} Text
a -> StartJob
s {$sel:appId:StartJob' :: Text
appId = Text
a} :: StartJob)
startJob_branchName :: Lens.Lens' StartJob Prelude.Text
startJob_branchName :: Lens' StartJob Text
startJob_branchName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJob' {Text
branchName :: Text
$sel:branchName:StartJob' :: StartJob -> Text
branchName} -> Text
branchName) (\s :: StartJob
s@StartJob' {} Text
a -> StartJob
s {$sel:branchName:StartJob' :: Text
branchName = Text
a} :: StartJob)
startJob_jobType :: Lens.Lens' StartJob JobType
startJob_jobType :: Lens' StartJob JobType
startJob_jobType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJob' {JobType
jobType :: JobType
$sel:jobType:StartJob' :: StartJob -> JobType
jobType} -> JobType
jobType) (\s :: StartJob
s@StartJob' {} JobType
a -> StartJob
s {$sel:jobType:StartJob' :: JobType
jobType = JobType
a} :: StartJob)
instance Core.AWSRequest StartJob where
type AWSResponse StartJob = StartJobResponse
request :: (Service -> Service) -> StartJob -> Request StartJob
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 StartJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartJob)))
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 ->
Int -> JobSummary -> StartJobResponse
StartJobResponse'
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))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"jobSummary")
)
instance Prelude.Hashable StartJob where
hashWithSalt :: Int -> StartJob -> Int
hashWithSalt Int
_salt StartJob' {Maybe Text
Maybe POSIX
Text
JobType
jobType :: JobType
branchName :: Text
appId :: Text
jobReason :: Maybe Text
jobId :: Maybe Text
commitTime :: Maybe POSIX
commitMessage :: Maybe Text
commitId :: Maybe Text
$sel:jobType:StartJob' :: StartJob -> JobType
$sel:branchName:StartJob' :: StartJob -> Text
$sel:appId:StartJob' :: StartJob -> Text
$sel:jobReason:StartJob' :: StartJob -> Maybe Text
$sel:jobId:StartJob' :: StartJob -> Maybe Text
$sel:commitTime:StartJob' :: StartJob -> Maybe POSIX
$sel:commitMessage:StartJob' :: StartJob -> Maybe Text
$sel:commitId:StartJob' :: StartJob -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
commitId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
commitMessage
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
commitTime
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
jobId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
jobReason
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
appId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
branchName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` JobType
jobType
instance Prelude.NFData StartJob where
rnf :: StartJob -> ()
rnf StartJob' {Maybe Text
Maybe POSIX
Text
JobType
jobType :: JobType
branchName :: Text
appId :: Text
jobReason :: Maybe Text
jobId :: Maybe Text
commitTime :: Maybe POSIX
commitMessage :: Maybe Text
commitId :: Maybe Text
$sel:jobType:StartJob' :: StartJob -> JobType
$sel:branchName:StartJob' :: StartJob -> Text
$sel:appId:StartJob' :: StartJob -> Text
$sel:jobReason:StartJob' :: StartJob -> Maybe Text
$sel:jobId:StartJob' :: StartJob -> Maybe Text
$sel:commitTime:StartJob' :: StartJob -> Maybe POSIX
$sel:commitMessage:StartJob' :: StartJob -> Maybe Text
$sel:commitId:StartJob' :: StartJob -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
commitId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
commitMessage
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
commitTime
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
jobId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
jobReason
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
appId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
branchName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf JobType
jobType
instance Data.ToHeaders StartJob where
toHeaders :: StartJob -> 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 StartJob where
toJSON :: StartJob -> Value
toJSON StartJob' {Maybe Text
Maybe POSIX
Text
JobType
jobType :: JobType
branchName :: Text
appId :: Text
jobReason :: Maybe Text
jobId :: Maybe Text
commitTime :: Maybe POSIX
commitMessage :: Maybe Text
commitId :: Maybe Text
$sel:jobType:StartJob' :: StartJob -> JobType
$sel:branchName:StartJob' :: StartJob -> Text
$sel:appId:StartJob' :: StartJob -> Text
$sel:jobReason:StartJob' :: StartJob -> Maybe Text
$sel:jobId:StartJob' :: StartJob -> Maybe Text
$sel:commitTime:StartJob' :: StartJob -> Maybe POSIX
$sel:commitMessage:StartJob' :: StartJob -> Maybe Text
$sel:commitId:StartJob' :: StartJob -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"commitId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
commitId,
(Key
"commitMessage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
commitMessage,
(Key
"commitTime" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
commitTime,
(Key
"jobId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
jobId,
(Key
"jobReason" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
jobReason,
forall a. a -> Maybe a
Prelude.Just (Key
"jobType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= JobType
jobType)
]
)
instance Data.ToPath StartJob where
toPath :: StartJob -> ByteString
toPath StartJob' {Maybe Text
Maybe POSIX
Text
JobType
jobType :: JobType
branchName :: Text
appId :: Text
jobReason :: Maybe Text
jobId :: Maybe Text
commitTime :: Maybe POSIX
commitMessage :: Maybe Text
commitId :: Maybe Text
$sel:jobType:StartJob' :: StartJob -> JobType
$sel:branchName:StartJob' :: StartJob -> Text
$sel:appId:StartJob' :: StartJob -> Text
$sel:jobReason:StartJob' :: StartJob -> Maybe Text
$sel:jobId:StartJob' :: StartJob -> Maybe Text
$sel:commitTime:StartJob' :: StartJob -> Maybe POSIX
$sel:commitMessage:StartJob' :: StartJob -> Maybe Text
$sel:commitId:StartJob' :: StartJob -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/apps/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
appId,
ByteString
"/branches/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
branchName,
ByteString
"/jobs"
]
instance Data.ToQuery StartJob where
toQuery :: StartJob -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data StartJobResponse = StartJobResponse'
{
StartJobResponse -> Int
httpStatus :: Prelude.Int,
StartJobResponse -> JobSummary
jobSummary :: JobSummary
}
deriving (StartJobResponse -> StartJobResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartJobResponse -> StartJobResponse -> Bool
$c/= :: StartJobResponse -> StartJobResponse -> Bool
== :: StartJobResponse -> StartJobResponse -> Bool
$c== :: StartJobResponse -> StartJobResponse -> Bool
Prelude.Eq, ReadPrec [StartJobResponse]
ReadPrec StartJobResponse
Int -> ReadS StartJobResponse
ReadS [StartJobResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartJobResponse]
$creadListPrec :: ReadPrec [StartJobResponse]
readPrec :: ReadPrec StartJobResponse
$creadPrec :: ReadPrec StartJobResponse
readList :: ReadS [StartJobResponse]
$creadList :: ReadS [StartJobResponse]
readsPrec :: Int -> ReadS StartJobResponse
$creadsPrec :: Int -> ReadS StartJobResponse
Prelude.Read, Int -> StartJobResponse -> ShowS
[StartJobResponse] -> ShowS
StartJobResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartJobResponse] -> ShowS
$cshowList :: [StartJobResponse] -> ShowS
show :: StartJobResponse -> String
$cshow :: StartJobResponse -> String
showsPrec :: Int -> StartJobResponse -> ShowS
$cshowsPrec :: Int -> StartJobResponse -> ShowS
Prelude.Show, forall x. Rep StartJobResponse x -> StartJobResponse
forall x. StartJobResponse -> Rep StartJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartJobResponse x -> StartJobResponse
$cfrom :: forall x. StartJobResponse -> Rep StartJobResponse x
Prelude.Generic)
newStartJobResponse ::
Prelude.Int ->
JobSummary ->
StartJobResponse
newStartJobResponse :: Int -> JobSummary -> StartJobResponse
newStartJobResponse Int
pHttpStatus_ JobSummary
pJobSummary_ =
StartJobResponse'
{ $sel:httpStatus:StartJobResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:jobSummary:StartJobResponse' :: JobSummary
jobSummary = JobSummary
pJobSummary_
}
startJobResponse_httpStatus :: Lens.Lens' StartJobResponse Prelude.Int
startJobResponse_httpStatus :: Lens' StartJobResponse Int
startJobResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJobResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartJobResponse' :: StartJobResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartJobResponse
s@StartJobResponse' {} Int
a -> StartJobResponse
s {$sel:httpStatus:StartJobResponse' :: Int
httpStatus = Int
a} :: StartJobResponse)
startJobResponse_jobSummary :: Lens.Lens' StartJobResponse JobSummary
startJobResponse_jobSummary :: Lens' StartJobResponse JobSummary
startJobResponse_jobSummary = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJobResponse' {JobSummary
jobSummary :: JobSummary
$sel:jobSummary:StartJobResponse' :: StartJobResponse -> JobSummary
jobSummary} -> JobSummary
jobSummary) (\s :: StartJobResponse
s@StartJobResponse' {} JobSummary
a -> StartJobResponse
s {$sel:jobSummary:StartJobResponse' :: JobSummary
jobSummary = JobSummary
a} :: StartJobResponse)
instance Prelude.NFData StartJobResponse where
rnf :: StartJobResponse -> ()
rnf StartJobResponse' {Int
JobSummary
jobSummary :: JobSummary
httpStatus :: Int
$sel:jobSummary:StartJobResponse' :: StartJobResponse -> JobSummary
$sel:httpStatus:StartJobResponse' :: StartJobResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf JobSummary
jobSummary