{-# 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.StopRun
(
StopRun (..),
newStopRun,
stopRun_arn,
StopRunResponse (..),
newStopRunResponse,
stopRunResponse_run,
stopRunResponse_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 StopRun = StopRun'
{
StopRun -> Text
arn :: Prelude.Text
}
deriving (StopRun -> StopRun -> Bool
(StopRun -> StopRun -> Bool)
-> (StopRun -> StopRun -> Bool) -> Eq StopRun
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopRun -> StopRun -> Bool
$c/= :: StopRun -> StopRun -> Bool
== :: StopRun -> StopRun -> Bool
$c== :: StopRun -> StopRun -> Bool
Prelude.Eq, ReadPrec [StopRun]
ReadPrec StopRun
Int -> ReadS StopRun
ReadS [StopRun]
(Int -> ReadS StopRun)
-> ReadS [StopRun]
-> ReadPrec StopRun
-> ReadPrec [StopRun]
-> Read StopRun
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopRun]
$creadListPrec :: ReadPrec [StopRun]
readPrec :: ReadPrec StopRun
$creadPrec :: ReadPrec StopRun
readList :: ReadS [StopRun]
$creadList :: ReadS [StopRun]
readsPrec :: Int -> ReadS StopRun
$creadsPrec :: Int -> ReadS StopRun
Prelude.Read, Int -> StopRun -> ShowS
[StopRun] -> ShowS
StopRun -> String
(Int -> StopRun -> ShowS)
-> (StopRun -> String) -> ([StopRun] -> ShowS) -> Show StopRun
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopRun] -> ShowS
$cshowList :: [StopRun] -> ShowS
show :: StopRun -> String
$cshow :: StopRun -> String
showsPrec :: Int -> StopRun -> ShowS
$cshowsPrec :: Int -> StopRun -> ShowS
Prelude.Show, (forall x. StopRun -> Rep StopRun x)
-> (forall x. Rep StopRun x -> StopRun) -> Generic StopRun
forall x. Rep StopRun x -> StopRun
forall x. StopRun -> Rep StopRun x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopRun x -> StopRun
$cfrom :: forall x. StopRun -> Rep StopRun x
Prelude.Generic)
newStopRun ::
Prelude.Text ->
StopRun
newStopRun :: Text -> StopRun
newStopRun Text
pArn_ = StopRun' :: Text -> StopRun
StopRun' {$sel:arn:StopRun' :: Text
arn = Text
pArn_}
stopRun_arn :: Lens.Lens' StopRun Prelude.Text
stopRun_arn :: (Text -> f Text) -> StopRun -> f StopRun
stopRun_arn = (StopRun -> Text)
-> (StopRun -> Text -> StopRun) -> Lens StopRun StopRun Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopRun' {Text
arn :: Text
$sel:arn:StopRun' :: StopRun -> Text
arn} -> Text
arn) (\s :: StopRun
s@StopRun' {} Text
a -> StopRun
s {$sel:arn:StopRun' :: Text
arn = Text
a} :: StopRun)
instance Core.AWSRequest StopRun where
type AWSResponse StopRun = StopRunResponse
request :: StopRun -> Request StopRun
request = Service -> StopRun -> Request StopRun
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StopRun
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopRun)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StopRun))
-> Logger
-> Service
-> Proxy StopRun
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopRun)))
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 Run -> Int -> StopRunResponse
StopRunResponse'
(Maybe Run -> Int -> StopRunResponse)
-> Either String (Maybe Run)
-> Either String (Int -> StopRunResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Run)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"run")
Either String (Int -> StopRunResponse)
-> Either String Int -> Either String StopRunResponse
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 StopRun
instance Prelude.NFData StopRun
instance Core.ToHeaders StopRun where
toHeaders :: StopRun -> ResponseHeaders
toHeaders =
ResponseHeaders -> StopRun -> 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.StopRun" ::
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 StopRun where
toJSON :: StopRun -> Value
toJSON StopRun' {Text
arn :: Text
$sel:arn:StopRun' :: StopRun -> 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 StopRun where
toPath :: StopRun -> ByteString
toPath = ByteString -> StopRun -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery StopRun where
toQuery :: StopRun -> QueryString
toQuery = QueryString -> StopRun -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StopRunResponse = StopRunResponse'
{
StopRunResponse -> Maybe Run
run :: Prelude.Maybe Run,
StopRunResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StopRunResponse -> StopRunResponse -> Bool
(StopRunResponse -> StopRunResponse -> Bool)
-> (StopRunResponse -> StopRunResponse -> Bool)
-> Eq StopRunResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopRunResponse -> StopRunResponse -> Bool
$c/= :: StopRunResponse -> StopRunResponse -> Bool
== :: StopRunResponse -> StopRunResponse -> Bool
$c== :: StopRunResponse -> StopRunResponse -> Bool
Prelude.Eq, ReadPrec [StopRunResponse]
ReadPrec StopRunResponse
Int -> ReadS StopRunResponse
ReadS [StopRunResponse]
(Int -> ReadS StopRunResponse)
-> ReadS [StopRunResponse]
-> ReadPrec StopRunResponse
-> ReadPrec [StopRunResponse]
-> Read StopRunResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopRunResponse]
$creadListPrec :: ReadPrec [StopRunResponse]
readPrec :: ReadPrec StopRunResponse
$creadPrec :: ReadPrec StopRunResponse
readList :: ReadS [StopRunResponse]
$creadList :: ReadS [StopRunResponse]
readsPrec :: Int -> ReadS StopRunResponse
$creadsPrec :: Int -> ReadS StopRunResponse
Prelude.Read, Int -> StopRunResponse -> ShowS
[StopRunResponse] -> ShowS
StopRunResponse -> String
(Int -> StopRunResponse -> ShowS)
-> (StopRunResponse -> String)
-> ([StopRunResponse] -> ShowS)
-> Show StopRunResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopRunResponse] -> ShowS
$cshowList :: [StopRunResponse] -> ShowS
show :: StopRunResponse -> String
$cshow :: StopRunResponse -> String
showsPrec :: Int -> StopRunResponse -> ShowS
$cshowsPrec :: Int -> StopRunResponse -> ShowS
Prelude.Show, (forall x. StopRunResponse -> Rep StopRunResponse x)
-> (forall x. Rep StopRunResponse x -> StopRunResponse)
-> Generic StopRunResponse
forall x. Rep StopRunResponse x -> StopRunResponse
forall x. StopRunResponse -> Rep StopRunResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopRunResponse x -> StopRunResponse
$cfrom :: forall x. StopRunResponse -> Rep StopRunResponse x
Prelude.Generic)
newStopRunResponse ::
Prelude.Int ->
StopRunResponse
newStopRunResponse :: Int -> StopRunResponse
newStopRunResponse Int
pHttpStatus_ =
StopRunResponse' :: Maybe Run -> Int -> StopRunResponse
StopRunResponse'
{ $sel:run:StopRunResponse' :: Maybe Run
run = Maybe Run
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StopRunResponse' :: Int
httpStatus = Int
pHttpStatus_
}
stopRunResponse_run :: Lens.Lens' StopRunResponse (Prelude.Maybe Run)
stopRunResponse_run :: (Maybe Run -> f (Maybe Run))
-> StopRunResponse -> f StopRunResponse
stopRunResponse_run = (StopRunResponse -> Maybe Run)
-> (StopRunResponse -> Maybe Run -> StopRunResponse)
-> Lens StopRunResponse StopRunResponse (Maybe Run) (Maybe Run)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopRunResponse' {Maybe Run
run :: Maybe Run
$sel:run:StopRunResponse' :: StopRunResponse -> Maybe Run
run} -> Maybe Run
run) (\s :: StopRunResponse
s@StopRunResponse' {} Maybe Run
a -> StopRunResponse
s {$sel:run:StopRunResponse' :: Maybe Run
run = Maybe Run
a} :: StopRunResponse)
stopRunResponse_httpStatus :: Lens.Lens' StopRunResponse Prelude.Int
stopRunResponse_httpStatus :: (Int -> f Int) -> StopRunResponse -> f StopRunResponse
stopRunResponse_httpStatus = (StopRunResponse -> Int)
-> (StopRunResponse -> Int -> StopRunResponse)
-> Lens StopRunResponse StopRunResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopRunResponse' {Int
httpStatus :: Int
$sel:httpStatus:StopRunResponse' :: StopRunResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StopRunResponse
s@StopRunResponse' {} Int
a -> StopRunResponse
s {$sel:httpStatus:StopRunResponse' :: Int
httpStatus = Int
a} :: StopRunResponse)
instance Prelude.NFData StopRunResponse