{-# 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.IoT.DescribeJobExecution
(
DescribeJobExecution (..),
newDescribeJobExecution,
describeJobExecution_executionNumber,
describeJobExecution_jobId,
describeJobExecution_thingName,
DescribeJobExecutionResponse (..),
newDescribeJobExecutionResponse,
describeJobExecutionResponse_execution,
describeJobExecutionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoT.Types
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 DescribeJobExecution = DescribeJobExecution'
{
DescribeJobExecution -> Maybe Integer
executionNumber :: Prelude.Maybe Prelude.Integer,
DescribeJobExecution -> Text
jobId :: Prelude.Text,
DescribeJobExecution -> Text
thingName :: Prelude.Text
}
deriving (DescribeJobExecution -> DescribeJobExecution -> Bool
(DescribeJobExecution -> DescribeJobExecution -> Bool)
-> (DescribeJobExecution -> DescribeJobExecution -> Bool)
-> Eq DescribeJobExecution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeJobExecution -> DescribeJobExecution -> Bool
$c/= :: DescribeJobExecution -> DescribeJobExecution -> Bool
== :: DescribeJobExecution -> DescribeJobExecution -> Bool
$c== :: DescribeJobExecution -> DescribeJobExecution -> Bool
Prelude.Eq, ReadPrec [DescribeJobExecution]
ReadPrec DescribeJobExecution
Int -> ReadS DescribeJobExecution
ReadS [DescribeJobExecution]
(Int -> ReadS DescribeJobExecution)
-> ReadS [DescribeJobExecution]
-> ReadPrec DescribeJobExecution
-> ReadPrec [DescribeJobExecution]
-> Read DescribeJobExecution
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeJobExecution]
$creadListPrec :: ReadPrec [DescribeJobExecution]
readPrec :: ReadPrec DescribeJobExecution
$creadPrec :: ReadPrec DescribeJobExecution
readList :: ReadS [DescribeJobExecution]
$creadList :: ReadS [DescribeJobExecution]
readsPrec :: Int -> ReadS DescribeJobExecution
$creadsPrec :: Int -> ReadS DescribeJobExecution
Prelude.Read, Int -> DescribeJobExecution -> ShowS
[DescribeJobExecution] -> ShowS
DescribeJobExecution -> String
(Int -> DescribeJobExecution -> ShowS)
-> (DescribeJobExecution -> String)
-> ([DescribeJobExecution] -> ShowS)
-> Show DescribeJobExecution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeJobExecution] -> ShowS
$cshowList :: [DescribeJobExecution] -> ShowS
show :: DescribeJobExecution -> String
$cshow :: DescribeJobExecution -> String
showsPrec :: Int -> DescribeJobExecution -> ShowS
$cshowsPrec :: Int -> DescribeJobExecution -> ShowS
Prelude.Show, (forall x. DescribeJobExecution -> Rep DescribeJobExecution x)
-> (forall x. Rep DescribeJobExecution x -> DescribeJobExecution)
-> Generic DescribeJobExecution
forall x. Rep DescribeJobExecution x -> DescribeJobExecution
forall x. DescribeJobExecution -> Rep DescribeJobExecution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeJobExecution x -> DescribeJobExecution
$cfrom :: forall x. DescribeJobExecution -> Rep DescribeJobExecution x
Prelude.Generic)
newDescribeJobExecution ::
Prelude.Text ->
Prelude.Text ->
DescribeJobExecution
newDescribeJobExecution :: Text -> Text -> DescribeJobExecution
newDescribeJobExecution Text
pJobId_ Text
pThingName_ =
DescribeJobExecution' :: Maybe Integer -> Text -> Text -> DescribeJobExecution
DescribeJobExecution'
{ $sel:executionNumber:DescribeJobExecution' :: Maybe Integer
executionNumber =
Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:jobId:DescribeJobExecution' :: Text
jobId = Text
pJobId_,
$sel:thingName:DescribeJobExecution' :: Text
thingName = Text
pThingName_
}
describeJobExecution_executionNumber :: Lens.Lens' DescribeJobExecution (Prelude.Maybe Prelude.Integer)
describeJobExecution_executionNumber :: (Maybe Integer -> f (Maybe Integer))
-> DescribeJobExecution -> f DescribeJobExecution
describeJobExecution_executionNumber = (DescribeJobExecution -> Maybe Integer)
-> (DescribeJobExecution -> Maybe Integer -> DescribeJobExecution)
-> Lens
DescribeJobExecution
DescribeJobExecution
(Maybe Integer)
(Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJobExecution' {Maybe Integer
executionNumber :: Maybe Integer
$sel:executionNumber:DescribeJobExecution' :: DescribeJobExecution -> Maybe Integer
executionNumber} -> Maybe Integer
executionNumber) (\s :: DescribeJobExecution
s@DescribeJobExecution' {} Maybe Integer
a -> DescribeJobExecution
s {$sel:executionNumber:DescribeJobExecution' :: Maybe Integer
executionNumber = Maybe Integer
a} :: DescribeJobExecution)
describeJobExecution_jobId :: Lens.Lens' DescribeJobExecution Prelude.Text
describeJobExecution_jobId :: (Text -> f Text) -> DescribeJobExecution -> f DescribeJobExecution
describeJobExecution_jobId = (DescribeJobExecution -> Text)
-> (DescribeJobExecution -> Text -> DescribeJobExecution)
-> Lens DescribeJobExecution DescribeJobExecution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJobExecution' {Text
jobId :: Text
$sel:jobId:DescribeJobExecution' :: DescribeJobExecution -> Text
jobId} -> Text
jobId) (\s :: DescribeJobExecution
s@DescribeJobExecution' {} Text
a -> DescribeJobExecution
s {$sel:jobId:DescribeJobExecution' :: Text
jobId = Text
a} :: DescribeJobExecution)
describeJobExecution_thingName :: Lens.Lens' DescribeJobExecution Prelude.Text
describeJobExecution_thingName :: (Text -> f Text) -> DescribeJobExecution -> f DescribeJobExecution
describeJobExecution_thingName = (DescribeJobExecution -> Text)
-> (DescribeJobExecution -> Text -> DescribeJobExecution)
-> Lens DescribeJobExecution DescribeJobExecution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJobExecution' {Text
thingName :: Text
$sel:thingName:DescribeJobExecution' :: DescribeJobExecution -> Text
thingName} -> Text
thingName) (\s :: DescribeJobExecution
s@DescribeJobExecution' {} Text
a -> DescribeJobExecution
s {$sel:thingName:DescribeJobExecution' :: Text
thingName = Text
a} :: DescribeJobExecution)
instance Core.AWSRequest DescribeJobExecution where
type
AWSResponse DescribeJobExecution =
DescribeJobExecutionResponse
request :: DescribeJobExecution -> Request DescribeJobExecution
request = Service -> DescribeJobExecution -> Request DescribeJobExecution
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeJobExecution
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeJobExecution)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeJobExecution))
-> Logger
-> Service
-> Proxy DescribeJobExecution
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeJobExecution)))
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 JobExecution -> Int -> DescribeJobExecutionResponse
DescribeJobExecutionResponse'
(Maybe JobExecution -> Int -> DescribeJobExecutionResponse)
-> Either String (Maybe JobExecution)
-> Either String (Int -> DescribeJobExecutionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe JobExecution)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"execution")
Either String (Int -> DescribeJobExecutionResponse)
-> Either String Int -> Either String DescribeJobExecutionResponse
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 DescribeJobExecution
instance Prelude.NFData DescribeJobExecution
instance Core.ToHeaders DescribeJobExecution where
toHeaders :: DescribeJobExecution -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeJobExecution -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath DescribeJobExecution where
toPath :: DescribeJobExecution -> ByteString
toPath DescribeJobExecution' {Maybe Integer
Text
thingName :: Text
jobId :: Text
executionNumber :: Maybe Integer
$sel:thingName:DescribeJobExecution' :: DescribeJobExecution -> Text
$sel:jobId:DescribeJobExecution' :: DescribeJobExecution -> Text
$sel:executionNumber:DescribeJobExecution' :: DescribeJobExecution -> Maybe Integer
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/things/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
thingName,
ByteString
"/jobs/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
jobId
]
instance Core.ToQuery DescribeJobExecution where
toQuery :: DescribeJobExecution -> QueryString
toQuery DescribeJobExecution' {Maybe Integer
Text
thingName :: Text
jobId :: Text
executionNumber :: Maybe Integer
$sel:thingName:DescribeJobExecution' :: DescribeJobExecution -> Text
$sel:jobId:DescribeJobExecution' :: DescribeJobExecution -> Text
$sel:executionNumber:DescribeJobExecution' :: DescribeJobExecution -> Maybe Integer
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"executionNumber" ByteString -> Maybe Integer -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Integer
executionNumber]
data DescribeJobExecutionResponse = DescribeJobExecutionResponse'
{
DescribeJobExecutionResponse -> Maybe JobExecution
execution :: Prelude.Maybe JobExecution,
DescribeJobExecutionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeJobExecutionResponse
-> DescribeJobExecutionResponse -> Bool
(DescribeJobExecutionResponse
-> DescribeJobExecutionResponse -> Bool)
-> (DescribeJobExecutionResponse
-> DescribeJobExecutionResponse -> Bool)
-> Eq DescribeJobExecutionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeJobExecutionResponse
-> DescribeJobExecutionResponse -> Bool
$c/= :: DescribeJobExecutionResponse
-> DescribeJobExecutionResponse -> Bool
== :: DescribeJobExecutionResponse
-> DescribeJobExecutionResponse -> Bool
$c== :: DescribeJobExecutionResponse
-> DescribeJobExecutionResponse -> Bool
Prelude.Eq, ReadPrec [DescribeJobExecutionResponse]
ReadPrec DescribeJobExecutionResponse
Int -> ReadS DescribeJobExecutionResponse
ReadS [DescribeJobExecutionResponse]
(Int -> ReadS DescribeJobExecutionResponse)
-> ReadS [DescribeJobExecutionResponse]
-> ReadPrec DescribeJobExecutionResponse
-> ReadPrec [DescribeJobExecutionResponse]
-> Read DescribeJobExecutionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeJobExecutionResponse]
$creadListPrec :: ReadPrec [DescribeJobExecutionResponse]
readPrec :: ReadPrec DescribeJobExecutionResponse
$creadPrec :: ReadPrec DescribeJobExecutionResponse
readList :: ReadS [DescribeJobExecutionResponse]
$creadList :: ReadS [DescribeJobExecutionResponse]
readsPrec :: Int -> ReadS DescribeJobExecutionResponse
$creadsPrec :: Int -> ReadS DescribeJobExecutionResponse
Prelude.Read, Int -> DescribeJobExecutionResponse -> ShowS
[DescribeJobExecutionResponse] -> ShowS
DescribeJobExecutionResponse -> String
(Int -> DescribeJobExecutionResponse -> ShowS)
-> (DescribeJobExecutionResponse -> String)
-> ([DescribeJobExecutionResponse] -> ShowS)
-> Show DescribeJobExecutionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeJobExecutionResponse] -> ShowS
$cshowList :: [DescribeJobExecutionResponse] -> ShowS
show :: DescribeJobExecutionResponse -> String
$cshow :: DescribeJobExecutionResponse -> String
showsPrec :: Int -> DescribeJobExecutionResponse -> ShowS
$cshowsPrec :: Int -> DescribeJobExecutionResponse -> ShowS
Prelude.Show, (forall x.
DescribeJobExecutionResponse -> Rep DescribeJobExecutionResponse x)
-> (forall x.
Rep DescribeJobExecutionResponse x -> DescribeJobExecutionResponse)
-> Generic DescribeJobExecutionResponse
forall x.
Rep DescribeJobExecutionResponse x -> DescribeJobExecutionResponse
forall x.
DescribeJobExecutionResponse -> Rep DescribeJobExecutionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeJobExecutionResponse x -> DescribeJobExecutionResponse
$cfrom :: forall x.
DescribeJobExecutionResponse -> Rep DescribeJobExecutionResponse x
Prelude.Generic)
newDescribeJobExecutionResponse ::
Prelude.Int ->
DescribeJobExecutionResponse
newDescribeJobExecutionResponse :: Int -> DescribeJobExecutionResponse
newDescribeJobExecutionResponse Int
pHttpStatus_ =
DescribeJobExecutionResponse' :: Maybe JobExecution -> Int -> DescribeJobExecutionResponse
DescribeJobExecutionResponse'
{ $sel:execution:DescribeJobExecutionResponse' :: Maybe JobExecution
execution =
Maybe JobExecution
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeJobExecutionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeJobExecutionResponse_execution :: Lens.Lens' DescribeJobExecutionResponse (Prelude.Maybe JobExecution)
describeJobExecutionResponse_execution :: (Maybe JobExecution -> f (Maybe JobExecution))
-> DescribeJobExecutionResponse -> f DescribeJobExecutionResponse
describeJobExecutionResponse_execution = (DescribeJobExecutionResponse -> Maybe JobExecution)
-> (DescribeJobExecutionResponse
-> Maybe JobExecution -> DescribeJobExecutionResponse)
-> Lens
DescribeJobExecutionResponse
DescribeJobExecutionResponse
(Maybe JobExecution)
(Maybe JobExecution)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJobExecutionResponse' {Maybe JobExecution
execution :: Maybe JobExecution
$sel:execution:DescribeJobExecutionResponse' :: DescribeJobExecutionResponse -> Maybe JobExecution
execution} -> Maybe JobExecution
execution) (\s :: DescribeJobExecutionResponse
s@DescribeJobExecutionResponse' {} Maybe JobExecution
a -> DescribeJobExecutionResponse
s {$sel:execution:DescribeJobExecutionResponse' :: Maybe JobExecution
execution = Maybe JobExecution
a} :: DescribeJobExecutionResponse)
describeJobExecutionResponse_httpStatus :: Lens.Lens' DescribeJobExecutionResponse Prelude.Int
describeJobExecutionResponse_httpStatus :: (Int -> f Int)
-> DescribeJobExecutionResponse -> f DescribeJobExecutionResponse
describeJobExecutionResponse_httpStatus = (DescribeJobExecutionResponse -> Int)
-> (DescribeJobExecutionResponse
-> Int -> DescribeJobExecutionResponse)
-> Lens
DescribeJobExecutionResponse DescribeJobExecutionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJobExecutionResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeJobExecutionResponse' :: DescribeJobExecutionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeJobExecutionResponse
s@DescribeJobExecutionResponse' {} Int
a -> DescribeJobExecutionResponse
s {$sel:httpStatus:DescribeJobExecutionResponse' :: Int
httpStatus = Int
a} :: DescribeJobExecutionResponse)
instance Prelude.NFData DescribeJobExecutionResponse