{-# 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.CodePipeline.GetJobDetails
(
GetJobDetails (..),
newGetJobDetails,
getJobDetails_jobId,
GetJobDetailsResponse (..),
newGetJobDetailsResponse,
getJobDetailsResponse_jobDetails,
getJobDetailsResponse_httpStatus,
)
where
import Amazonka.CodePipeline.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 GetJobDetails = GetJobDetails'
{
GetJobDetails -> Text
jobId :: Prelude.Text
}
deriving (GetJobDetails -> GetJobDetails -> Bool
(GetJobDetails -> GetJobDetails -> Bool)
-> (GetJobDetails -> GetJobDetails -> Bool) -> Eq GetJobDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetJobDetails -> GetJobDetails -> Bool
$c/= :: GetJobDetails -> GetJobDetails -> Bool
== :: GetJobDetails -> GetJobDetails -> Bool
$c== :: GetJobDetails -> GetJobDetails -> Bool
Prelude.Eq, ReadPrec [GetJobDetails]
ReadPrec GetJobDetails
Int -> ReadS GetJobDetails
ReadS [GetJobDetails]
(Int -> ReadS GetJobDetails)
-> ReadS [GetJobDetails]
-> ReadPrec GetJobDetails
-> ReadPrec [GetJobDetails]
-> Read GetJobDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetJobDetails]
$creadListPrec :: ReadPrec [GetJobDetails]
readPrec :: ReadPrec GetJobDetails
$creadPrec :: ReadPrec GetJobDetails
readList :: ReadS [GetJobDetails]
$creadList :: ReadS [GetJobDetails]
readsPrec :: Int -> ReadS GetJobDetails
$creadsPrec :: Int -> ReadS GetJobDetails
Prelude.Read, Int -> GetJobDetails -> ShowS
[GetJobDetails] -> ShowS
GetJobDetails -> String
(Int -> GetJobDetails -> ShowS)
-> (GetJobDetails -> String)
-> ([GetJobDetails] -> ShowS)
-> Show GetJobDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetJobDetails] -> ShowS
$cshowList :: [GetJobDetails] -> ShowS
show :: GetJobDetails -> String
$cshow :: GetJobDetails -> String
showsPrec :: Int -> GetJobDetails -> ShowS
$cshowsPrec :: Int -> GetJobDetails -> ShowS
Prelude.Show, (forall x. GetJobDetails -> Rep GetJobDetails x)
-> (forall x. Rep GetJobDetails x -> GetJobDetails)
-> Generic GetJobDetails
forall x. Rep GetJobDetails x -> GetJobDetails
forall x. GetJobDetails -> Rep GetJobDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetJobDetails x -> GetJobDetails
$cfrom :: forall x. GetJobDetails -> Rep GetJobDetails x
Prelude.Generic)
newGetJobDetails ::
Prelude.Text ->
GetJobDetails
newGetJobDetails :: Text -> GetJobDetails
newGetJobDetails Text
pJobId_ =
GetJobDetails' :: Text -> GetJobDetails
GetJobDetails' {$sel:jobId:GetJobDetails' :: Text
jobId = Text
pJobId_}
getJobDetails_jobId :: Lens.Lens' GetJobDetails Prelude.Text
getJobDetails_jobId :: (Text -> f Text) -> GetJobDetails -> f GetJobDetails
getJobDetails_jobId = (GetJobDetails -> Text)
-> (GetJobDetails -> Text -> GetJobDetails)
-> Lens GetJobDetails GetJobDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJobDetails' {Text
jobId :: Text
$sel:jobId:GetJobDetails' :: GetJobDetails -> Text
jobId} -> Text
jobId) (\s :: GetJobDetails
s@GetJobDetails' {} Text
a -> GetJobDetails
s {$sel:jobId:GetJobDetails' :: Text
jobId = Text
a} :: GetJobDetails)
instance Core.AWSRequest GetJobDetails where
type
AWSResponse GetJobDetails =
GetJobDetailsResponse
request :: GetJobDetails -> Request GetJobDetails
request = Service -> GetJobDetails -> Request GetJobDetails
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetJobDetails
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetJobDetails)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetJobDetails))
-> Logger
-> Service
-> Proxy GetJobDetails
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetJobDetails)))
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 ->
Maybe JobDetails -> Int -> GetJobDetailsResponse
GetJobDetailsResponse'
(Maybe JobDetails -> Int -> GetJobDetailsResponse)
-> Either String (Maybe JobDetails)
-> Either String (Int -> GetJobDetailsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe JobDetails)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"jobDetails")
Either String (Int -> GetJobDetailsResponse)
-> Either String Int -> Either String GetJobDetailsResponse
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable GetJobDetails
instance Prelude.NFData GetJobDetails
instance Core.ToHeaders GetJobDetails where
toHeaders :: GetJobDetails -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetJobDetails -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"CodePipeline_20150709.GetJobDetails" ::
Prelude.ByteString
),
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.ToJSON GetJobDetails where
toJSON :: GetJobDetails -> Value
toJSON GetJobDetails' {Text
jobId :: Text
$sel:jobId:GetJobDetails' :: GetJobDetails -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"jobId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
jobId)]
)
instance Core.ToPath GetJobDetails where
toPath :: GetJobDetails -> ByteString
toPath = ByteString -> GetJobDetails -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetJobDetails where
toQuery :: GetJobDetails -> QueryString
toQuery = QueryString -> GetJobDetails -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetJobDetailsResponse = GetJobDetailsResponse'
{
GetJobDetailsResponse -> Maybe JobDetails
jobDetails :: Prelude.Maybe JobDetails,
GetJobDetailsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetJobDetailsResponse -> GetJobDetailsResponse -> Bool
(GetJobDetailsResponse -> GetJobDetailsResponse -> Bool)
-> (GetJobDetailsResponse -> GetJobDetailsResponse -> Bool)
-> Eq GetJobDetailsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetJobDetailsResponse -> GetJobDetailsResponse -> Bool
$c/= :: GetJobDetailsResponse -> GetJobDetailsResponse -> Bool
== :: GetJobDetailsResponse -> GetJobDetailsResponse -> Bool
$c== :: GetJobDetailsResponse -> GetJobDetailsResponse -> Bool
Prelude.Eq, Int -> GetJobDetailsResponse -> ShowS
[GetJobDetailsResponse] -> ShowS
GetJobDetailsResponse -> String
(Int -> GetJobDetailsResponse -> ShowS)
-> (GetJobDetailsResponse -> String)
-> ([GetJobDetailsResponse] -> ShowS)
-> Show GetJobDetailsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetJobDetailsResponse] -> ShowS
$cshowList :: [GetJobDetailsResponse] -> ShowS
show :: GetJobDetailsResponse -> String
$cshow :: GetJobDetailsResponse -> String
showsPrec :: Int -> GetJobDetailsResponse -> ShowS
$cshowsPrec :: Int -> GetJobDetailsResponse -> ShowS
Prelude.Show, (forall x. GetJobDetailsResponse -> Rep GetJobDetailsResponse x)
-> (forall x. Rep GetJobDetailsResponse x -> GetJobDetailsResponse)
-> Generic GetJobDetailsResponse
forall x. Rep GetJobDetailsResponse x -> GetJobDetailsResponse
forall x. GetJobDetailsResponse -> Rep GetJobDetailsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetJobDetailsResponse x -> GetJobDetailsResponse
$cfrom :: forall x. GetJobDetailsResponse -> Rep GetJobDetailsResponse x
Prelude.Generic)
newGetJobDetailsResponse ::
Prelude.Int ->
GetJobDetailsResponse
newGetJobDetailsResponse :: Int -> GetJobDetailsResponse
newGetJobDetailsResponse Int
pHttpStatus_ =
GetJobDetailsResponse' :: Maybe JobDetails -> Int -> GetJobDetailsResponse
GetJobDetailsResponse'
{ $sel:jobDetails:GetJobDetailsResponse' :: Maybe JobDetails
jobDetails =
Maybe JobDetails
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetJobDetailsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getJobDetailsResponse_jobDetails :: Lens.Lens' GetJobDetailsResponse (Prelude.Maybe JobDetails)
getJobDetailsResponse_jobDetails :: (Maybe JobDetails -> f (Maybe JobDetails))
-> GetJobDetailsResponse -> f GetJobDetailsResponse
getJobDetailsResponse_jobDetails = (GetJobDetailsResponse -> Maybe JobDetails)
-> (GetJobDetailsResponse
-> Maybe JobDetails -> GetJobDetailsResponse)
-> Lens
GetJobDetailsResponse
GetJobDetailsResponse
(Maybe JobDetails)
(Maybe JobDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJobDetailsResponse' {Maybe JobDetails
jobDetails :: Maybe JobDetails
$sel:jobDetails:GetJobDetailsResponse' :: GetJobDetailsResponse -> Maybe JobDetails
jobDetails} -> Maybe JobDetails
jobDetails) (\s :: GetJobDetailsResponse
s@GetJobDetailsResponse' {} Maybe JobDetails
a -> GetJobDetailsResponse
s {$sel:jobDetails:GetJobDetailsResponse' :: Maybe JobDetails
jobDetails = Maybe JobDetails
a} :: GetJobDetailsResponse)
getJobDetailsResponse_httpStatus :: Lens.Lens' GetJobDetailsResponse Prelude.Int
getJobDetailsResponse_httpStatus :: (Int -> f Int) -> GetJobDetailsResponse -> f GetJobDetailsResponse
getJobDetailsResponse_httpStatus = (GetJobDetailsResponse -> Int)
-> (GetJobDetailsResponse -> Int -> GetJobDetailsResponse)
-> Lens GetJobDetailsResponse GetJobDetailsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJobDetailsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetJobDetailsResponse' :: GetJobDetailsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetJobDetailsResponse
s@GetJobDetailsResponse' {} Int
a -> GetJobDetailsResponse
s {$sel:httpStatus:GetJobDetailsResponse' :: Int
httpStatus = Int
a} :: GetJobDetailsResponse)
instance Prelude.NFData GetJobDetailsResponse