{-# 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.CancelJobExecution
(
CancelJobExecution (..),
newCancelJobExecution,
cancelJobExecution_force,
cancelJobExecution_statusDetails,
cancelJobExecution_expectedVersion,
cancelJobExecution_jobId,
cancelJobExecution_thingName,
CancelJobExecutionResponse (..),
newCancelJobExecutionResponse,
)
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 CancelJobExecution = CancelJobExecution'
{
CancelJobExecution -> Maybe Bool
force :: Prelude.Maybe Prelude.Bool,
CancelJobExecution -> Maybe (HashMap Text Text)
statusDetails :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
CancelJobExecution -> Maybe Integer
expectedVersion :: Prelude.Maybe Prelude.Integer,
CancelJobExecution -> Text
jobId :: Prelude.Text,
CancelJobExecution -> Text
thingName :: Prelude.Text
}
deriving (CancelJobExecution -> CancelJobExecution -> Bool
(CancelJobExecution -> CancelJobExecution -> Bool)
-> (CancelJobExecution -> CancelJobExecution -> Bool)
-> Eq CancelJobExecution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelJobExecution -> CancelJobExecution -> Bool
$c/= :: CancelJobExecution -> CancelJobExecution -> Bool
== :: CancelJobExecution -> CancelJobExecution -> Bool
$c== :: CancelJobExecution -> CancelJobExecution -> Bool
Prelude.Eq, ReadPrec [CancelJobExecution]
ReadPrec CancelJobExecution
Int -> ReadS CancelJobExecution
ReadS [CancelJobExecution]
(Int -> ReadS CancelJobExecution)
-> ReadS [CancelJobExecution]
-> ReadPrec CancelJobExecution
-> ReadPrec [CancelJobExecution]
-> Read CancelJobExecution
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelJobExecution]
$creadListPrec :: ReadPrec [CancelJobExecution]
readPrec :: ReadPrec CancelJobExecution
$creadPrec :: ReadPrec CancelJobExecution
readList :: ReadS [CancelJobExecution]
$creadList :: ReadS [CancelJobExecution]
readsPrec :: Int -> ReadS CancelJobExecution
$creadsPrec :: Int -> ReadS CancelJobExecution
Prelude.Read, Int -> CancelJobExecution -> ShowS
[CancelJobExecution] -> ShowS
CancelJobExecution -> String
(Int -> CancelJobExecution -> ShowS)
-> (CancelJobExecution -> String)
-> ([CancelJobExecution] -> ShowS)
-> Show CancelJobExecution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelJobExecution] -> ShowS
$cshowList :: [CancelJobExecution] -> ShowS
show :: CancelJobExecution -> String
$cshow :: CancelJobExecution -> String
showsPrec :: Int -> CancelJobExecution -> ShowS
$cshowsPrec :: Int -> CancelJobExecution -> ShowS
Prelude.Show, (forall x. CancelJobExecution -> Rep CancelJobExecution x)
-> (forall x. Rep CancelJobExecution x -> CancelJobExecution)
-> Generic CancelJobExecution
forall x. Rep CancelJobExecution x -> CancelJobExecution
forall x. CancelJobExecution -> Rep CancelJobExecution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CancelJobExecution x -> CancelJobExecution
$cfrom :: forall x. CancelJobExecution -> Rep CancelJobExecution x
Prelude.Generic)
newCancelJobExecution ::
Prelude.Text ->
Prelude.Text ->
CancelJobExecution
newCancelJobExecution :: Text -> Text -> CancelJobExecution
newCancelJobExecution Text
pJobId_ Text
pThingName_ =
CancelJobExecution' :: Maybe Bool
-> Maybe (HashMap Text Text)
-> Maybe Integer
-> Text
-> Text
-> CancelJobExecution
CancelJobExecution'
{ $sel:force:CancelJobExecution' :: Maybe Bool
force = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:statusDetails:CancelJobExecution' :: Maybe (HashMap Text Text)
statusDetails = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:expectedVersion:CancelJobExecution' :: Maybe Integer
expectedVersion = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:jobId:CancelJobExecution' :: Text
jobId = Text
pJobId_,
$sel:thingName:CancelJobExecution' :: Text
thingName = Text
pThingName_
}
cancelJobExecution_force :: Lens.Lens' CancelJobExecution (Prelude.Maybe Prelude.Bool)
cancelJobExecution_force :: (Maybe Bool -> f (Maybe Bool))
-> CancelJobExecution -> f CancelJobExecution
cancelJobExecution_force = (CancelJobExecution -> Maybe Bool)
-> (CancelJobExecution -> Maybe Bool -> CancelJobExecution)
-> Lens
CancelJobExecution CancelJobExecution (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelJobExecution' {Maybe Bool
force :: Maybe Bool
$sel:force:CancelJobExecution' :: CancelJobExecution -> Maybe Bool
force} -> Maybe Bool
force) (\s :: CancelJobExecution
s@CancelJobExecution' {} Maybe Bool
a -> CancelJobExecution
s {$sel:force:CancelJobExecution' :: Maybe Bool
force = Maybe Bool
a} :: CancelJobExecution)
cancelJobExecution_statusDetails :: Lens.Lens' CancelJobExecution (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
cancelJobExecution_statusDetails :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CancelJobExecution -> f CancelJobExecution
cancelJobExecution_statusDetails = (CancelJobExecution -> Maybe (HashMap Text Text))
-> (CancelJobExecution
-> Maybe (HashMap Text Text) -> CancelJobExecution)
-> Lens
CancelJobExecution
CancelJobExecution
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelJobExecution' {Maybe (HashMap Text Text)
statusDetails :: Maybe (HashMap Text Text)
$sel:statusDetails:CancelJobExecution' :: CancelJobExecution -> Maybe (HashMap Text Text)
statusDetails} -> Maybe (HashMap Text Text)
statusDetails) (\s :: CancelJobExecution
s@CancelJobExecution' {} Maybe (HashMap Text Text)
a -> CancelJobExecution
s {$sel:statusDetails:CancelJobExecution' :: Maybe (HashMap Text Text)
statusDetails = Maybe (HashMap Text Text)
a} :: CancelJobExecution) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CancelJobExecution -> f CancelJobExecution)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CancelJobExecution
-> f CancelJobExecution
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
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 AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
cancelJobExecution_expectedVersion :: Lens.Lens' CancelJobExecution (Prelude.Maybe Prelude.Integer)
cancelJobExecution_expectedVersion :: (Maybe Integer -> f (Maybe Integer))
-> CancelJobExecution -> f CancelJobExecution
cancelJobExecution_expectedVersion = (CancelJobExecution -> Maybe Integer)
-> (CancelJobExecution -> Maybe Integer -> CancelJobExecution)
-> Lens
CancelJobExecution
CancelJobExecution
(Maybe Integer)
(Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelJobExecution' {Maybe Integer
expectedVersion :: Maybe Integer
$sel:expectedVersion:CancelJobExecution' :: CancelJobExecution -> Maybe Integer
expectedVersion} -> Maybe Integer
expectedVersion) (\s :: CancelJobExecution
s@CancelJobExecution' {} Maybe Integer
a -> CancelJobExecution
s {$sel:expectedVersion:CancelJobExecution' :: Maybe Integer
expectedVersion = Maybe Integer
a} :: CancelJobExecution)
cancelJobExecution_jobId :: Lens.Lens' CancelJobExecution Prelude.Text
cancelJobExecution_jobId :: (Text -> f Text) -> CancelJobExecution -> f CancelJobExecution
cancelJobExecution_jobId = (CancelJobExecution -> Text)
-> (CancelJobExecution -> Text -> CancelJobExecution)
-> Lens CancelJobExecution CancelJobExecution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelJobExecution' {Text
jobId :: Text
$sel:jobId:CancelJobExecution' :: CancelJobExecution -> Text
jobId} -> Text
jobId) (\s :: CancelJobExecution
s@CancelJobExecution' {} Text
a -> CancelJobExecution
s {$sel:jobId:CancelJobExecution' :: Text
jobId = Text
a} :: CancelJobExecution)
cancelJobExecution_thingName :: Lens.Lens' CancelJobExecution Prelude.Text
cancelJobExecution_thingName :: (Text -> f Text) -> CancelJobExecution -> f CancelJobExecution
cancelJobExecution_thingName = (CancelJobExecution -> Text)
-> (CancelJobExecution -> Text -> CancelJobExecution)
-> Lens CancelJobExecution CancelJobExecution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelJobExecution' {Text
thingName :: Text
$sel:thingName:CancelJobExecution' :: CancelJobExecution -> Text
thingName} -> Text
thingName) (\s :: CancelJobExecution
s@CancelJobExecution' {} Text
a -> CancelJobExecution
s {$sel:thingName:CancelJobExecution' :: Text
thingName = Text
a} :: CancelJobExecution)
instance Core.AWSRequest CancelJobExecution where
type
AWSResponse CancelJobExecution =
CancelJobExecutionResponse
request :: CancelJobExecution -> Request CancelJobExecution
request = Service -> CancelJobExecution -> Request CancelJobExecution
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CancelJobExecution
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CancelJobExecution)))
response =
AWSResponse CancelJobExecution
-> Logger
-> Service
-> Proxy CancelJobExecution
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CancelJobExecution)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse CancelJobExecution
CancelJobExecutionResponse
CancelJobExecutionResponse'
instance Prelude.Hashable CancelJobExecution
instance Prelude.NFData CancelJobExecution
instance Core.ToHeaders CancelJobExecution where
toHeaders :: CancelJobExecution -> [Header]
toHeaders = [Header] -> CancelJobExecution -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON CancelJobExecution where
toJSON :: CancelJobExecution -> Value
toJSON CancelJobExecution' {Maybe Bool
Maybe Integer
Maybe (HashMap Text Text)
Text
thingName :: Text
jobId :: Text
expectedVersion :: Maybe Integer
statusDetails :: Maybe (HashMap Text Text)
force :: Maybe Bool
$sel:thingName:CancelJobExecution' :: CancelJobExecution -> Text
$sel:jobId:CancelJobExecution' :: CancelJobExecution -> Text
$sel:expectedVersion:CancelJobExecution' :: CancelJobExecution -> Maybe Integer
$sel:statusDetails:CancelJobExecution' :: CancelJobExecution -> Maybe (HashMap Text Text)
$sel:force:CancelJobExecution' :: CancelJobExecution -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"statusDetails" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
statusDetails,
(Text
"expectedVersion" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
expectedVersion
]
)
instance Core.ToPath CancelJobExecution where
toPath :: CancelJobExecution -> ByteString
toPath CancelJobExecution' {Maybe Bool
Maybe Integer
Maybe (HashMap Text Text)
Text
thingName :: Text
jobId :: Text
expectedVersion :: Maybe Integer
statusDetails :: Maybe (HashMap Text Text)
force :: Maybe Bool
$sel:thingName:CancelJobExecution' :: CancelJobExecution -> Text
$sel:jobId:CancelJobExecution' :: CancelJobExecution -> Text
$sel:expectedVersion:CancelJobExecution' :: CancelJobExecution -> Maybe Integer
$sel:statusDetails:CancelJobExecution' :: CancelJobExecution -> Maybe (HashMap Text Text)
$sel:force:CancelJobExecution' :: CancelJobExecution -> Maybe Bool
..} =
[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,
ByteString
"/cancel"
]
instance Core.ToQuery CancelJobExecution where
toQuery :: CancelJobExecution -> QueryString
toQuery CancelJobExecution' {Maybe Bool
Maybe Integer
Maybe (HashMap Text Text)
Text
thingName :: Text
jobId :: Text
expectedVersion :: Maybe Integer
statusDetails :: Maybe (HashMap Text Text)
force :: Maybe Bool
$sel:thingName:CancelJobExecution' :: CancelJobExecution -> Text
$sel:jobId:CancelJobExecution' :: CancelJobExecution -> Text
$sel:expectedVersion:CancelJobExecution' :: CancelJobExecution -> Maybe Integer
$sel:statusDetails:CancelJobExecution' :: CancelJobExecution -> Maybe (HashMap Text Text)
$sel:force:CancelJobExecution' :: CancelJobExecution -> Maybe Bool
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"force" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
force]
data CancelJobExecutionResponse = CancelJobExecutionResponse'
{
}
deriving (CancelJobExecutionResponse -> CancelJobExecutionResponse -> Bool
(CancelJobExecutionResponse -> CancelJobExecutionResponse -> Bool)
-> (CancelJobExecutionResponse
-> CancelJobExecutionResponse -> Bool)
-> Eq CancelJobExecutionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelJobExecutionResponse -> CancelJobExecutionResponse -> Bool
$c/= :: CancelJobExecutionResponse -> CancelJobExecutionResponse -> Bool
== :: CancelJobExecutionResponse -> CancelJobExecutionResponse -> Bool
$c== :: CancelJobExecutionResponse -> CancelJobExecutionResponse -> Bool
Prelude.Eq, ReadPrec [CancelJobExecutionResponse]
ReadPrec CancelJobExecutionResponse
Int -> ReadS CancelJobExecutionResponse
ReadS [CancelJobExecutionResponse]
(Int -> ReadS CancelJobExecutionResponse)
-> ReadS [CancelJobExecutionResponse]
-> ReadPrec CancelJobExecutionResponse
-> ReadPrec [CancelJobExecutionResponse]
-> Read CancelJobExecutionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelJobExecutionResponse]
$creadListPrec :: ReadPrec [CancelJobExecutionResponse]
readPrec :: ReadPrec CancelJobExecutionResponse
$creadPrec :: ReadPrec CancelJobExecutionResponse
readList :: ReadS [CancelJobExecutionResponse]
$creadList :: ReadS [CancelJobExecutionResponse]
readsPrec :: Int -> ReadS CancelJobExecutionResponse
$creadsPrec :: Int -> ReadS CancelJobExecutionResponse
Prelude.Read, Int -> CancelJobExecutionResponse -> ShowS
[CancelJobExecutionResponse] -> ShowS
CancelJobExecutionResponse -> String
(Int -> CancelJobExecutionResponse -> ShowS)
-> (CancelJobExecutionResponse -> String)
-> ([CancelJobExecutionResponse] -> ShowS)
-> Show CancelJobExecutionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelJobExecutionResponse] -> ShowS
$cshowList :: [CancelJobExecutionResponse] -> ShowS
show :: CancelJobExecutionResponse -> String
$cshow :: CancelJobExecutionResponse -> String
showsPrec :: Int -> CancelJobExecutionResponse -> ShowS
$cshowsPrec :: Int -> CancelJobExecutionResponse -> ShowS
Prelude.Show, (forall x.
CancelJobExecutionResponse -> Rep CancelJobExecutionResponse x)
-> (forall x.
Rep CancelJobExecutionResponse x -> CancelJobExecutionResponse)
-> Generic CancelJobExecutionResponse
forall x.
Rep CancelJobExecutionResponse x -> CancelJobExecutionResponse
forall x.
CancelJobExecutionResponse -> Rep CancelJobExecutionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CancelJobExecutionResponse x -> CancelJobExecutionResponse
$cfrom :: forall x.
CancelJobExecutionResponse -> Rep CancelJobExecutionResponse x
Prelude.Generic)
newCancelJobExecutionResponse ::
CancelJobExecutionResponse
newCancelJobExecutionResponse :: CancelJobExecutionResponse
newCancelJobExecutionResponse =
CancelJobExecutionResponse
CancelJobExecutionResponse'
instance Prelude.NFData CancelJobExecutionResponse