{-# 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.ListDeviceInstances
(
ListDeviceInstances (..),
newListDeviceInstances,
listDeviceInstances_maxResults,
listDeviceInstances_nextToken,
ListDeviceInstancesResponse (..),
newListDeviceInstancesResponse,
listDeviceInstancesResponse_deviceInstances,
listDeviceInstancesResponse_nextToken,
listDeviceInstancesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DeviceFarm.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListDeviceInstances = ListDeviceInstances'
{
ListDeviceInstances -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
ListDeviceInstances -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListDeviceInstances -> ListDeviceInstances -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDeviceInstances -> ListDeviceInstances -> Bool
$c/= :: ListDeviceInstances -> ListDeviceInstances -> Bool
== :: ListDeviceInstances -> ListDeviceInstances -> Bool
$c== :: ListDeviceInstances -> ListDeviceInstances -> Bool
Prelude.Eq, ReadPrec [ListDeviceInstances]
ReadPrec ListDeviceInstances
Int -> ReadS ListDeviceInstances
ReadS [ListDeviceInstances]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDeviceInstances]
$creadListPrec :: ReadPrec [ListDeviceInstances]
readPrec :: ReadPrec ListDeviceInstances
$creadPrec :: ReadPrec ListDeviceInstances
readList :: ReadS [ListDeviceInstances]
$creadList :: ReadS [ListDeviceInstances]
readsPrec :: Int -> ReadS ListDeviceInstances
$creadsPrec :: Int -> ReadS ListDeviceInstances
Prelude.Read, Int -> ListDeviceInstances -> ShowS
[ListDeviceInstances] -> ShowS
ListDeviceInstances -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDeviceInstances] -> ShowS
$cshowList :: [ListDeviceInstances] -> ShowS
show :: ListDeviceInstances -> String
$cshow :: ListDeviceInstances -> String
showsPrec :: Int -> ListDeviceInstances -> ShowS
$cshowsPrec :: Int -> ListDeviceInstances -> ShowS
Prelude.Show, forall x. Rep ListDeviceInstances x -> ListDeviceInstances
forall x. ListDeviceInstances -> Rep ListDeviceInstances x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDeviceInstances x -> ListDeviceInstances
$cfrom :: forall x. ListDeviceInstances -> Rep ListDeviceInstances x
Prelude.Generic)
newListDeviceInstances ::
ListDeviceInstances
newListDeviceInstances :: ListDeviceInstances
newListDeviceInstances =
ListDeviceInstances'
{ $sel:maxResults:ListDeviceInstances' :: Maybe Int
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListDeviceInstances' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listDeviceInstances_maxResults :: Lens.Lens' ListDeviceInstances (Prelude.Maybe Prelude.Int)
listDeviceInstances_maxResults :: Lens' ListDeviceInstances (Maybe Int)
listDeviceInstances_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeviceInstances' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:ListDeviceInstances' :: ListDeviceInstances -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: ListDeviceInstances
s@ListDeviceInstances' {} Maybe Int
a -> ListDeviceInstances
s {$sel:maxResults:ListDeviceInstances' :: Maybe Int
maxResults = Maybe Int
a} :: ListDeviceInstances)
listDeviceInstances_nextToken :: Lens.Lens' ListDeviceInstances (Prelude.Maybe Prelude.Text)
listDeviceInstances_nextToken :: Lens' ListDeviceInstances (Maybe Text)
listDeviceInstances_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeviceInstances' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDeviceInstances' :: ListDeviceInstances -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDeviceInstances
s@ListDeviceInstances' {} Maybe Text
a -> ListDeviceInstances
s {$sel:nextToken:ListDeviceInstances' :: Maybe Text
nextToken = Maybe Text
a} :: ListDeviceInstances)
instance Core.AWSPager ListDeviceInstances where
page :: ListDeviceInstances
-> AWSResponse ListDeviceInstances -> Maybe ListDeviceInstances
page ListDeviceInstances
rq AWSResponse ListDeviceInstances
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListDeviceInstances
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDeviceInstancesResponse (Maybe Text)
listDeviceInstancesResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListDeviceInstances
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDeviceInstancesResponse (Maybe [DeviceInstance])
listDeviceInstancesResponse_deviceInstances
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListDeviceInstances
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListDeviceInstances (Maybe Text)
listDeviceInstances_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListDeviceInstances
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDeviceInstancesResponse (Maybe Text)
listDeviceInstancesResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListDeviceInstances where
type
AWSResponse ListDeviceInstances =
ListDeviceInstancesResponse
request :: (Service -> Service)
-> ListDeviceInstances -> Request ListDeviceInstances
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListDeviceInstances
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListDeviceInstances)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [DeviceInstance]
-> Maybe Text -> Int -> ListDeviceInstancesResponse
ListDeviceInstancesResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"deviceInstances"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListDeviceInstances where
hashWithSalt :: Int -> ListDeviceInstances -> Int
hashWithSalt Int
_salt ListDeviceInstances' {Maybe Int
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Int
$sel:nextToken:ListDeviceInstances' :: ListDeviceInstances -> Maybe Text
$sel:maxResults:ListDeviceInstances' :: ListDeviceInstances -> Maybe Int
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListDeviceInstances where
rnf :: ListDeviceInstances -> ()
rnf ListDeviceInstances' {Maybe Int
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Int
$sel:nextToken:ListDeviceInstances' :: ListDeviceInstances -> Maybe Text
$sel:maxResults:ListDeviceInstances' :: ListDeviceInstances -> Maybe Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
instance Data.ToHeaders ListDeviceInstances where
toHeaders :: ListDeviceInstances -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"DeviceFarm_20150623.ListDeviceInstances" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListDeviceInstances where
toJSON :: ListDeviceInstances -> Value
toJSON ListDeviceInstances' {Maybe Int
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Int
$sel:nextToken:ListDeviceInstances' :: ListDeviceInstances -> Maybe Text
$sel:maxResults:ListDeviceInstances' :: ListDeviceInstances -> Maybe Int
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"maxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults,
(Key
"nextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken
]
)
instance Data.ToPath ListDeviceInstances where
toPath :: ListDeviceInstances -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListDeviceInstances where
toQuery :: ListDeviceInstances -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListDeviceInstancesResponse = ListDeviceInstancesResponse'
{
ListDeviceInstancesResponse -> Maybe [DeviceInstance]
deviceInstances :: Prelude.Maybe [DeviceInstance],
ListDeviceInstancesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListDeviceInstancesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListDeviceInstancesResponse -> ListDeviceInstancesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDeviceInstancesResponse -> ListDeviceInstancesResponse -> Bool
$c/= :: ListDeviceInstancesResponse -> ListDeviceInstancesResponse -> Bool
== :: ListDeviceInstancesResponse -> ListDeviceInstancesResponse -> Bool
$c== :: ListDeviceInstancesResponse -> ListDeviceInstancesResponse -> Bool
Prelude.Eq, ReadPrec [ListDeviceInstancesResponse]
ReadPrec ListDeviceInstancesResponse
Int -> ReadS ListDeviceInstancesResponse
ReadS [ListDeviceInstancesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDeviceInstancesResponse]
$creadListPrec :: ReadPrec [ListDeviceInstancesResponse]
readPrec :: ReadPrec ListDeviceInstancesResponse
$creadPrec :: ReadPrec ListDeviceInstancesResponse
readList :: ReadS [ListDeviceInstancesResponse]
$creadList :: ReadS [ListDeviceInstancesResponse]
readsPrec :: Int -> ReadS ListDeviceInstancesResponse
$creadsPrec :: Int -> ReadS ListDeviceInstancesResponse
Prelude.Read, Int -> ListDeviceInstancesResponse -> ShowS
[ListDeviceInstancesResponse] -> ShowS
ListDeviceInstancesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDeviceInstancesResponse] -> ShowS
$cshowList :: [ListDeviceInstancesResponse] -> ShowS
show :: ListDeviceInstancesResponse -> String
$cshow :: ListDeviceInstancesResponse -> String
showsPrec :: Int -> ListDeviceInstancesResponse -> ShowS
$cshowsPrec :: Int -> ListDeviceInstancesResponse -> ShowS
Prelude.Show, forall x.
Rep ListDeviceInstancesResponse x -> ListDeviceInstancesResponse
forall x.
ListDeviceInstancesResponse -> Rep ListDeviceInstancesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListDeviceInstancesResponse x -> ListDeviceInstancesResponse
$cfrom :: forall x.
ListDeviceInstancesResponse -> Rep ListDeviceInstancesResponse x
Prelude.Generic)
newListDeviceInstancesResponse ::
Prelude.Int ->
ListDeviceInstancesResponse
newListDeviceInstancesResponse :: Int -> ListDeviceInstancesResponse
newListDeviceInstancesResponse Int
pHttpStatus_ =
ListDeviceInstancesResponse'
{ $sel:deviceInstances:ListDeviceInstancesResponse' :: Maybe [DeviceInstance]
deviceInstances =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListDeviceInstancesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListDeviceInstancesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listDeviceInstancesResponse_deviceInstances :: Lens.Lens' ListDeviceInstancesResponse (Prelude.Maybe [DeviceInstance])
listDeviceInstancesResponse_deviceInstances :: Lens' ListDeviceInstancesResponse (Maybe [DeviceInstance])
listDeviceInstancesResponse_deviceInstances = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeviceInstancesResponse' {Maybe [DeviceInstance]
deviceInstances :: Maybe [DeviceInstance]
$sel:deviceInstances:ListDeviceInstancesResponse' :: ListDeviceInstancesResponse -> Maybe [DeviceInstance]
deviceInstances} -> Maybe [DeviceInstance]
deviceInstances) (\s :: ListDeviceInstancesResponse
s@ListDeviceInstancesResponse' {} Maybe [DeviceInstance]
a -> ListDeviceInstancesResponse
s {$sel:deviceInstances:ListDeviceInstancesResponse' :: Maybe [DeviceInstance]
deviceInstances = Maybe [DeviceInstance]
a} :: ListDeviceInstancesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listDeviceInstancesResponse_nextToken :: Lens.Lens' ListDeviceInstancesResponse (Prelude.Maybe Prelude.Text)
listDeviceInstancesResponse_nextToken :: Lens' ListDeviceInstancesResponse (Maybe Text)
listDeviceInstancesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeviceInstancesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDeviceInstancesResponse' :: ListDeviceInstancesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDeviceInstancesResponse
s@ListDeviceInstancesResponse' {} Maybe Text
a -> ListDeviceInstancesResponse
s {$sel:nextToken:ListDeviceInstancesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListDeviceInstancesResponse)
listDeviceInstancesResponse_httpStatus :: Lens.Lens' ListDeviceInstancesResponse Prelude.Int
listDeviceInstancesResponse_httpStatus :: Lens' ListDeviceInstancesResponse Int
listDeviceInstancesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeviceInstancesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListDeviceInstancesResponse' :: ListDeviceInstancesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListDeviceInstancesResponse
s@ListDeviceInstancesResponse' {} Int
a -> ListDeviceInstancesResponse
s {$sel:httpStatus:ListDeviceInstancesResponse' :: Int
httpStatus = Int
a} :: ListDeviceInstancesResponse)
instance Prelude.NFData ListDeviceInstancesResponse where
rnf :: ListDeviceInstancesResponse -> ()
rnf ListDeviceInstancesResponse' {Int
Maybe [DeviceInstance]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
deviceInstances :: Maybe [DeviceInstance]
$sel:httpStatus:ListDeviceInstancesResponse' :: ListDeviceInstancesResponse -> Int
$sel:nextToken:ListDeviceInstancesResponse' :: ListDeviceInstancesResponse -> Maybe Text
$sel:deviceInstances:ListDeviceInstancesResponse' :: ListDeviceInstancesResponse -> Maybe [DeviceInstance]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [DeviceInstance]
deviceInstances
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus