{-# 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.ListTests
(
ListTests (..),
newListTests,
listTests_nextToken,
listTests_arn,
ListTestsResponse (..),
newListTestsResponse,
listTestsResponse_tests,
listTestsResponse_nextToken,
listTestsResponse_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 ListTests = ListTests'
{
ListTests -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListTests -> Text
arn :: Prelude.Text
}
deriving (ListTests -> ListTests -> Bool
(ListTests -> ListTests -> Bool)
-> (ListTests -> ListTests -> Bool) -> Eq ListTests
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTests -> ListTests -> Bool
$c/= :: ListTests -> ListTests -> Bool
== :: ListTests -> ListTests -> Bool
$c== :: ListTests -> ListTests -> Bool
Prelude.Eq, ReadPrec [ListTests]
ReadPrec ListTests
Int -> ReadS ListTests
ReadS [ListTests]
(Int -> ReadS ListTests)
-> ReadS [ListTests]
-> ReadPrec ListTests
-> ReadPrec [ListTests]
-> Read ListTests
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTests]
$creadListPrec :: ReadPrec [ListTests]
readPrec :: ReadPrec ListTests
$creadPrec :: ReadPrec ListTests
readList :: ReadS [ListTests]
$creadList :: ReadS [ListTests]
readsPrec :: Int -> ReadS ListTests
$creadsPrec :: Int -> ReadS ListTests
Prelude.Read, Int -> ListTests -> ShowS
[ListTests] -> ShowS
ListTests -> String
(Int -> ListTests -> ShowS)
-> (ListTests -> String)
-> ([ListTests] -> ShowS)
-> Show ListTests
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTests] -> ShowS
$cshowList :: [ListTests] -> ShowS
show :: ListTests -> String
$cshow :: ListTests -> String
showsPrec :: Int -> ListTests -> ShowS
$cshowsPrec :: Int -> ListTests -> ShowS
Prelude.Show, (forall x. ListTests -> Rep ListTests x)
-> (forall x. Rep ListTests x -> ListTests) -> Generic ListTests
forall x. Rep ListTests x -> ListTests
forall x. ListTests -> Rep ListTests x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListTests x -> ListTests
$cfrom :: forall x. ListTests -> Rep ListTests x
Prelude.Generic)
newListTests ::
Prelude.Text ->
ListTests
newListTests :: Text -> ListTests
newListTests Text
pArn_ =
ListTests' :: Maybe Text -> Text -> ListTests
ListTests'
{ $sel:nextToken:ListTests' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:arn:ListTests' :: Text
arn = Text
pArn_
}
listTests_nextToken :: Lens.Lens' ListTests (Prelude.Maybe Prelude.Text)
listTests_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListTests -> f ListTests
listTests_nextToken = (ListTests -> Maybe Text)
-> (ListTests -> Maybe Text -> ListTests)
-> Lens ListTests ListTests (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTests' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListTests' :: ListTests -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListTests
s@ListTests' {} Maybe Text
a -> ListTests
s {$sel:nextToken:ListTests' :: Maybe Text
nextToken = Maybe Text
a} :: ListTests)
listTests_arn :: Lens.Lens' ListTests Prelude.Text
listTests_arn :: (Text -> f Text) -> ListTests -> f ListTests
listTests_arn = (ListTests -> Text)
-> (ListTests -> Text -> ListTests)
-> Lens ListTests ListTests Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTests' {Text
arn :: Text
$sel:arn:ListTests' :: ListTests -> Text
arn} -> Text
arn) (\s :: ListTests
s@ListTests' {} Text
a -> ListTests
s {$sel:arn:ListTests' :: Text
arn = Text
a} :: ListTests)
instance Core.AWSPager ListTests where
page :: ListTests -> AWSResponse ListTests -> Maybe ListTests
page ListTests
rq AWSResponse ListTests
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListTests
ListTestsResponse
rs
ListTestsResponse
-> Getting (First Text) ListTestsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListTestsResponse -> Const (First Text) ListTestsResponse
Lens' ListTestsResponse (Maybe Text)
listTestsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListTestsResponse -> Const (First Text) ListTestsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListTestsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListTests
forall a. Maybe a
Prelude.Nothing
| Maybe [Test] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListTests
ListTestsResponse
rs
ListTestsResponse
-> Getting (First [Test]) ListTestsResponse [Test] -> Maybe [Test]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Test] -> Const (First [Test]) (Maybe [Test]))
-> ListTestsResponse -> Const (First [Test]) ListTestsResponse
Lens' ListTestsResponse (Maybe [Test])
listTestsResponse_tests ((Maybe [Test] -> Const (First [Test]) (Maybe [Test]))
-> ListTestsResponse -> Const (First [Test]) ListTestsResponse)
-> (([Test] -> Const (First [Test]) [Test])
-> Maybe [Test] -> Const (First [Test]) (Maybe [Test]))
-> Getting (First [Test]) ListTestsResponse [Test]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Test] -> Const (First [Test]) [Test])
-> Maybe [Test] -> Const (First [Test]) (Maybe [Test])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListTests
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListTests -> Maybe ListTests
forall a. a -> Maybe a
Prelude.Just (ListTests -> Maybe ListTests) -> ListTests -> Maybe ListTests
forall a b. (a -> b) -> a -> b
Prelude.$
ListTests
rq
ListTests -> (ListTests -> ListTests) -> ListTests
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListTests -> Identity ListTests
Lens ListTests ListTests (Maybe Text) (Maybe Text)
listTests_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListTests -> Identity ListTests)
-> Maybe Text -> ListTests -> ListTests
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListTests
ListTestsResponse
rs
ListTestsResponse
-> Getting (First Text) ListTestsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListTestsResponse -> Const (First Text) ListTestsResponse
Lens' ListTestsResponse (Maybe Text)
listTestsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListTestsResponse -> Const (First Text) ListTestsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListTestsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListTests where
type AWSResponse ListTests = ListTestsResponse
request :: ListTests -> Request ListTests
request = Service -> ListTests -> Request ListTests
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListTests
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListTests)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListTests))
-> Logger
-> Service
-> Proxy ListTests
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListTests)))
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] -> Maybe Text -> Int -> ListTestsResponse
ListTestsResponse'
(Maybe [Test] -> Maybe Text -> Int -> ListTestsResponse)
-> Either String (Maybe [Test])
-> Either String (Maybe Text -> Int -> ListTestsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Test]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"tests" Either String (Maybe (Maybe [Test]))
-> Maybe [Test] -> Either String (Maybe [Test])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Test]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> ListTestsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListTestsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
Either String (Int -> ListTestsResponse)
-> Either String Int -> Either String ListTestsResponse
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 ListTests
instance Prelude.NFData ListTests
instance Core.ToHeaders ListTests where
toHeaders :: ListTests -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListTests -> 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.ListTests" ::
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 ListTests where
toJSON :: ListTests -> Value
toJSON ListTests' {Maybe Text
Text
arn :: Text
nextToken :: Maybe Text
$sel:arn:ListTests' :: ListTests -> Text
$sel:nextToken:ListTests' :: ListTests -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"nextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
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 ListTests where
toPath :: ListTests -> ByteString
toPath = ByteString -> ListTests -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListTests where
toQuery :: ListTests -> QueryString
toQuery = QueryString -> ListTests -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListTestsResponse = ListTestsResponse'
{
ListTestsResponse -> Maybe [Test]
tests :: Prelude.Maybe [Test],
ListTestsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListTestsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListTestsResponse -> ListTestsResponse -> Bool
(ListTestsResponse -> ListTestsResponse -> Bool)
-> (ListTestsResponse -> ListTestsResponse -> Bool)
-> Eq ListTestsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTestsResponse -> ListTestsResponse -> Bool
$c/= :: ListTestsResponse -> ListTestsResponse -> Bool
== :: ListTestsResponse -> ListTestsResponse -> Bool
$c== :: ListTestsResponse -> ListTestsResponse -> Bool
Prelude.Eq, ReadPrec [ListTestsResponse]
ReadPrec ListTestsResponse
Int -> ReadS ListTestsResponse
ReadS [ListTestsResponse]
(Int -> ReadS ListTestsResponse)
-> ReadS [ListTestsResponse]
-> ReadPrec ListTestsResponse
-> ReadPrec [ListTestsResponse]
-> Read ListTestsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTestsResponse]
$creadListPrec :: ReadPrec [ListTestsResponse]
readPrec :: ReadPrec ListTestsResponse
$creadPrec :: ReadPrec ListTestsResponse
readList :: ReadS [ListTestsResponse]
$creadList :: ReadS [ListTestsResponse]
readsPrec :: Int -> ReadS ListTestsResponse
$creadsPrec :: Int -> ReadS ListTestsResponse
Prelude.Read, Int -> ListTestsResponse -> ShowS
[ListTestsResponse] -> ShowS
ListTestsResponse -> String
(Int -> ListTestsResponse -> ShowS)
-> (ListTestsResponse -> String)
-> ([ListTestsResponse] -> ShowS)
-> Show ListTestsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTestsResponse] -> ShowS
$cshowList :: [ListTestsResponse] -> ShowS
show :: ListTestsResponse -> String
$cshow :: ListTestsResponse -> String
showsPrec :: Int -> ListTestsResponse -> ShowS
$cshowsPrec :: Int -> ListTestsResponse -> ShowS
Prelude.Show, (forall x. ListTestsResponse -> Rep ListTestsResponse x)
-> (forall x. Rep ListTestsResponse x -> ListTestsResponse)
-> Generic ListTestsResponse
forall x. Rep ListTestsResponse x -> ListTestsResponse
forall x. ListTestsResponse -> Rep ListTestsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListTestsResponse x -> ListTestsResponse
$cfrom :: forall x. ListTestsResponse -> Rep ListTestsResponse x
Prelude.Generic)
newListTestsResponse ::
Prelude.Int ->
ListTestsResponse
newListTestsResponse :: Int -> ListTestsResponse
newListTestsResponse Int
pHttpStatus_ =
ListTestsResponse' :: Maybe [Test] -> Maybe Text -> Int -> ListTestsResponse
ListTestsResponse'
{ $sel:tests:ListTestsResponse' :: Maybe [Test]
tests = Maybe [Test]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListTestsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListTestsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listTestsResponse_tests :: Lens.Lens' ListTestsResponse (Prelude.Maybe [Test])
listTestsResponse_tests :: (Maybe [Test] -> f (Maybe [Test]))
-> ListTestsResponse -> f ListTestsResponse
listTestsResponse_tests = (ListTestsResponse -> Maybe [Test])
-> (ListTestsResponse -> Maybe [Test] -> ListTestsResponse)
-> Lens' ListTestsResponse (Maybe [Test])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTestsResponse' {Maybe [Test]
tests :: Maybe [Test]
$sel:tests:ListTestsResponse' :: ListTestsResponse -> Maybe [Test]
tests} -> Maybe [Test]
tests) (\s :: ListTestsResponse
s@ListTestsResponse' {} Maybe [Test]
a -> ListTestsResponse
s {$sel:tests:ListTestsResponse' :: Maybe [Test]
tests = Maybe [Test]
a} :: ListTestsResponse) ((Maybe [Test] -> f (Maybe [Test]))
-> ListTestsResponse -> f ListTestsResponse)
-> ((Maybe [Test] -> f (Maybe [Test]))
-> Maybe [Test] -> f (Maybe [Test]))
-> (Maybe [Test] -> f (Maybe [Test]))
-> ListTestsResponse
-> f ListTestsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Test] [Test] [Test] [Test]
-> Iso (Maybe [Test]) (Maybe [Test]) (Maybe [Test]) (Maybe [Test])
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 [Test] [Test] [Test] [Test]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listTestsResponse_nextToken :: Lens.Lens' ListTestsResponse (Prelude.Maybe Prelude.Text)
listTestsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListTestsResponse -> f ListTestsResponse
listTestsResponse_nextToken = (ListTestsResponse -> Maybe Text)
-> (ListTestsResponse -> Maybe Text -> ListTestsResponse)
-> Lens' ListTestsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTestsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListTestsResponse' :: ListTestsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListTestsResponse
s@ListTestsResponse' {} Maybe Text
a -> ListTestsResponse
s {$sel:nextToken:ListTestsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListTestsResponse)
listTestsResponse_httpStatus :: Lens.Lens' ListTestsResponse Prelude.Int
listTestsResponse_httpStatus :: (Int -> f Int) -> ListTestsResponse -> f ListTestsResponse
listTestsResponse_httpStatus = (ListTestsResponse -> Int)
-> (ListTestsResponse -> Int -> ListTestsResponse)
-> Lens ListTestsResponse ListTestsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTestsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListTestsResponse' :: ListTestsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListTestsResponse
s@ListTestsResponse' {} Int
a -> ListTestsResponse
s {$sel:httpStatus:ListTestsResponse' :: Int
httpStatus = Int
a} :: ListTestsResponse)
instance Prelude.NFData ListTestsResponse