{-# 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.DeviceFarm.StopJob
(
StopJob (..),
newStopJob,
stopJob_arn,
StopJobResponse (..),
newStopJobResponse,
stopJobResponse_job,
stopJobResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DeviceFarm.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 StopJob = StopJob'
{
StopJob -> Text
arn :: 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 ->
StopJob
newStopJob :: Text -> StopJob
newStopJob Text
pArn_ = StopJob' :: Text -> StopJob
StopJob' {$sel:arn:StopJob' :: Text
arn = Text
pArn_}
stopJob_arn :: Lens.Lens' StopJob Prelude.Text
stopJob_arn :: (Text -> f Text) -> StopJob -> f StopJob
stopJob_arn = (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
arn :: Text
$sel:arn:StopJob' :: StopJob -> Text
arn} -> Text
arn) (\s :: StopJob
s@StopJob' {} Text
a -> StopJob
s {$sel:arn:StopJob' :: Text
arn = 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, ToJSON a) => Service -> a -> Request a
Request.postJSON 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 ->
Maybe Job -> Int -> StopJobResponse
StopJobResponse'
(Maybe Job -> Int -> StopJobResponse)
-> Either String (Maybe Job)
-> Either String (Int -> StopJobResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Job)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"job")
Either String (Int -> StopJobResponse)
-> Either String Int -> Either String StopJobResponse
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 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
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"DeviceFarm_20150623.StopJob" ::
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 StopJob where
toJSON :: StopJob -> Value
toJSON StopJob' {Text
arn :: Text
$sel:arn:StopJob' :: StopJob -> 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
"arn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
arn)]
)
instance Core.ToPath StopJob where
toPath :: StopJob -> ByteString
toPath = ByteString -> StopJob -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
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 -> Maybe Job
job :: Prelude.Maybe Job,
StopJobResponse -> Int
httpStatus :: Prelude.Int
}
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 ->
StopJobResponse
newStopJobResponse :: Int -> StopJobResponse
newStopJobResponse Int
pHttpStatus_ =
StopJobResponse' :: Maybe Job -> Int -> StopJobResponse
StopJobResponse'
{ $sel:job:StopJobResponse' :: Maybe Job
job = Maybe Job
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StopJobResponse' :: Int
httpStatus = Int
pHttpStatus_
}
stopJobResponse_job :: Lens.Lens' StopJobResponse (Prelude.Maybe Job)
stopJobResponse_job :: (Maybe Job -> f (Maybe Job))
-> StopJobResponse -> f StopJobResponse
stopJobResponse_job = (StopJobResponse -> Maybe Job)
-> (StopJobResponse -> Maybe Job -> StopJobResponse)
-> Lens StopJobResponse StopJobResponse (Maybe Job) (Maybe Job)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopJobResponse' {Maybe Job
job :: Maybe Job
$sel:job:StopJobResponse' :: StopJobResponse -> Maybe Job
job} -> Maybe Job
job) (\s :: StopJobResponse
s@StopJobResponse' {} Maybe Job
a -> StopJobResponse
s {$sel:job:StopJobResponse' :: Maybe Job
job = Maybe Job
a} :: StopJobResponse)
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)
instance Prelude.NFData StopJobResponse