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