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