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