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