{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.DeviceFarm.ListDeviceInstances
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns information about the private device instances associated with
-- one or more AWS accounts.
--
-- This operation returns paginated results.
module Amazonka.DeviceFarm.ListDeviceInstances
  ( -- * Creating a Request
    ListDeviceInstances (..),
    newListDeviceInstances,

    -- * Request Lenses
    listDeviceInstances_nextToken,
    listDeviceInstances_maxResults,

    -- * Destructuring the Response
    ListDeviceInstancesResponse (..),
    newListDeviceInstancesResponse,

    -- * Response Lenses
    listDeviceInstancesResponse_nextToken,
    listDeviceInstancesResponse_deviceInstances,
    listDeviceInstancesResponse_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

-- | /See:/ 'newListDeviceInstances' smart constructor.
data ListDeviceInstances = ListDeviceInstances'
  { -- | An identifier that was returned from the previous call to this
    -- operation, which can be used to return the next set of items in the
    -- list.
    ListDeviceInstances -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An integer that specifies the maximum number of items you want to return
    -- in the API response.
    ListDeviceInstances -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int
  }
  deriving (ListDeviceInstances -> ListDeviceInstances -> Bool
(ListDeviceInstances -> ListDeviceInstances -> Bool)
-> (ListDeviceInstances -> ListDeviceInstances -> Bool)
-> Eq ListDeviceInstances
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]
(Int -> ReadS ListDeviceInstances)
-> ReadS [ListDeviceInstances]
-> ReadPrec ListDeviceInstances
-> ReadPrec [ListDeviceInstances]
-> Read 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
(Int -> ListDeviceInstances -> ShowS)
-> (ListDeviceInstances -> String)
-> ([ListDeviceInstances] -> ShowS)
-> Show ListDeviceInstances
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. ListDeviceInstances -> Rep ListDeviceInstances x)
-> (forall x. Rep ListDeviceInstances x -> ListDeviceInstances)
-> Generic ListDeviceInstances
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)

-- |
-- Create a value of 'ListDeviceInstances' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'listDeviceInstances_nextToken' - An identifier that was returned from the previous call to this
-- operation, which can be used to return the next set of items in the
-- list.
--
-- 'maxResults', 'listDeviceInstances_maxResults' - An integer that specifies the maximum number of items you want to return
-- in the API response.
newListDeviceInstances ::
  ListDeviceInstances
newListDeviceInstances :: ListDeviceInstances
newListDeviceInstances =
  ListDeviceInstances' :: Maybe Text -> Maybe Int -> ListDeviceInstances
ListDeviceInstances'
    { $sel:nextToken:ListDeviceInstances' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListDeviceInstances' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | An identifier that was returned from the previous call to this
-- operation, which can be used to return the next set of items in the
-- list.
listDeviceInstances_nextToken :: Lens.Lens' ListDeviceInstances (Prelude.Maybe Prelude.Text)
listDeviceInstances_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListDeviceInstances -> f ListDeviceInstances
listDeviceInstances_nextToken = (ListDeviceInstances -> Maybe Text)
-> (ListDeviceInstances -> Maybe Text -> ListDeviceInstances)
-> Lens
     ListDeviceInstances ListDeviceInstances (Maybe Text) (Maybe Text)
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)

-- | An integer that specifies the maximum number of items you want to return
-- in the API response.
listDeviceInstances_maxResults :: Lens.Lens' ListDeviceInstances (Prelude.Maybe Prelude.Int)
listDeviceInstances_maxResults :: (Maybe Int -> f (Maybe Int))
-> ListDeviceInstances -> f ListDeviceInstances
listDeviceInstances_maxResults = (ListDeviceInstances -> Maybe Int)
-> (ListDeviceInstances -> Maybe Int -> ListDeviceInstances)
-> Lens
     ListDeviceInstances ListDeviceInstances (Maybe Int) (Maybe Int)
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)

instance Core.AWSPager ListDeviceInstances where
  page :: ListDeviceInstances
-> AWSResponse ListDeviceInstances -> Maybe ListDeviceInstances
page ListDeviceInstances
rq AWSResponse ListDeviceInstances
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListDeviceInstances
ListDeviceInstancesResponse
rs
            ListDeviceInstancesResponse
-> Getting (First Text) ListDeviceInstancesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListDeviceInstancesResponse
-> Const (First Text) ListDeviceInstancesResponse
Lens' ListDeviceInstancesResponse (Maybe Text)
listDeviceInstancesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListDeviceInstancesResponse
 -> Const (First Text) ListDeviceInstancesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListDeviceInstancesResponse 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 ListDeviceInstances
forall a. Maybe a
Prelude.Nothing
    | Maybe [DeviceInstance] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListDeviceInstances
ListDeviceInstancesResponse
rs
            ListDeviceInstancesResponse
-> Getting
     (First [DeviceInstance])
     ListDeviceInstancesResponse
     [DeviceInstance]
-> Maybe [DeviceInstance]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [DeviceInstance]
 -> Const (First [DeviceInstance]) (Maybe [DeviceInstance]))
-> ListDeviceInstancesResponse
-> Const (First [DeviceInstance]) ListDeviceInstancesResponse
Lens' ListDeviceInstancesResponse (Maybe [DeviceInstance])
listDeviceInstancesResponse_deviceInstances
              ((Maybe [DeviceInstance]
  -> Const (First [DeviceInstance]) (Maybe [DeviceInstance]))
 -> ListDeviceInstancesResponse
 -> Const (First [DeviceInstance]) ListDeviceInstancesResponse)
-> (([DeviceInstance]
     -> Const (First [DeviceInstance]) [DeviceInstance])
    -> Maybe [DeviceInstance]
    -> Const (First [DeviceInstance]) (Maybe [DeviceInstance]))
-> Getting
     (First [DeviceInstance])
     ListDeviceInstancesResponse
     [DeviceInstance]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([DeviceInstance]
 -> Const (First [DeviceInstance]) [DeviceInstance])
-> Maybe [DeviceInstance]
-> Const (First [DeviceInstance]) (Maybe [DeviceInstance])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListDeviceInstances
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListDeviceInstances -> Maybe ListDeviceInstances
forall a. a -> Maybe a
Prelude.Just (ListDeviceInstances -> Maybe ListDeviceInstances)
-> ListDeviceInstances -> Maybe ListDeviceInstances
forall a b. (a -> b) -> a -> b
Prelude.$
        ListDeviceInstances
rq
          ListDeviceInstances
-> (ListDeviceInstances -> ListDeviceInstances)
-> ListDeviceInstances
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListDeviceInstances -> Identity ListDeviceInstances
Lens
  ListDeviceInstances ListDeviceInstances (Maybe Text) (Maybe Text)
listDeviceInstances_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListDeviceInstances -> Identity ListDeviceInstances)
-> Maybe Text -> ListDeviceInstances -> ListDeviceInstances
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListDeviceInstances
ListDeviceInstancesResponse
rs
          ListDeviceInstancesResponse
-> Getting (First Text) ListDeviceInstancesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListDeviceInstancesResponse
-> Const (First Text) ListDeviceInstancesResponse
Lens' ListDeviceInstancesResponse (Maybe Text)
listDeviceInstancesResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListDeviceInstancesResponse
 -> Const (First Text) ListDeviceInstancesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListDeviceInstancesResponse 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 ListDeviceInstances where
  type
    AWSResponse ListDeviceInstances =
      ListDeviceInstancesResponse
  request :: ListDeviceInstances -> Request ListDeviceInstances
request = Service -> ListDeviceInstances -> Request ListDeviceInstances
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListDeviceInstances
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListDeviceInstances)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListDeviceInstances))
-> Logger
-> Service
-> Proxy ListDeviceInstances
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListDeviceInstances)))
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 [DeviceInstance] -> Int -> ListDeviceInstancesResponse
ListDeviceInstancesResponse'
            (Maybe Text
 -> Maybe [DeviceInstance] -> Int -> ListDeviceInstancesResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [DeviceInstance] -> Int -> ListDeviceInstancesResponse)
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 [DeviceInstance] -> Int -> ListDeviceInstancesResponse)
-> Either String (Maybe [DeviceInstance])
-> Either String (Int -> ListDeviceInstancesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe (Maybe [DeviceInstance]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"deviceInstances"
                            Either String (Maybe (Maybe [DeviceInstance]))
-> Maybe [DeviceInstance] -> Either String (Maybe [DeviceInstance])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [DeviceInstance]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> ListDeviceInstancesResponse)
-> Either String Int -> Either String ListDeviceInstancesResponse
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 ListDeviceInstances

instance Prelude.NFData ListDeviceInstances

instance Core.ToHeaders ListDeviceInstances where
  toHeaders :: ListDeviceInstances -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListDeviceInstances -> 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.ListDeviceInstances" ::
                          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 ListDeviceInstances where
  toJSON :: ListDeviceInstances -> Value
toJSON ListDeviceInstances' {Maybe Int
Maybe Text
maxResults :: Maybe Int
nextToken :: Maybe Text
$sel:maxResults:ListDeviceInstances' :: ListDeviceInstances -> Maybe Int
$sel:nextToken:ListDeviceInstances' :: ListDeviceInstances -> 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,
            (Text
"maxResults" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults
          ]
      )

instance Core.ToPath ListDeviceInstances where
  toPath :: ListDeviceInstances -> ByteString
toPath = ByteString -> ListDeviceInstances -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery ListDeviceInstances where
  toQuery :: ListDeviceInstances -> QueryString
toQuery = QueryString -> ListDeviceInstances -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newListDeviceInstancesResponse' smart constructor.
data ListDeviceInstancesResponse = ListDeviceInstancesResponse'
  { -- | An identifier that can be used in the next call to this operation to
    -- return the next set of items in the list.
    ListDeviceInstancesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An object that contains information about your device instances.
    ListDeviceInstancesResponse -> Maybe [DeviceInstance]
deviceInstances :: Prelude.Maybe [DeviceInstance],
    -- | The response's http status code.
    ListDeviceInstancesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListDeviceInstancesResponse -> ListDeviceInstancesResponse -> Bool
(ListDeviceInstancesResponse
 -> ListDeviceInstancesResponse -> Bool)
-> (ListDeviceInstancesResponse
    -> ListDeviceInstancesResponse -> Bool)
-> Eq ListDeviceInstancesResponse
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]
(Int -> ReadS ListDeviceInstancesResponse)
-> ReadS [ListDeviceInstancesResponse]
-> ReadPrec ListDeviceInstancesResponse
-> ReadPrec [ListDeviceInstancesResponse]
-> Read 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
(Int -> ListDeviceInstancesResponse -> ShowS)
-> (ListDeviceInstancesResponse -> String)
-> ([ListDeviceInstancesResponse] -> ShowS)
-> Show ListDeviceInstancesResponse
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.
 ListDeviceInstancesResponse -> Rep ListDeviceInstancesResponse x)
-> (forall x.
    Rep ListDeviceInstancesResponse x -> ListDeviceInstancesResponse)
-> Generic ListDeviceInstancesResponse
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)

-- |
-- Create a value of 'ListDeviceInstancesResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'listDeviceInstancesResponse_nextToken' - An identifier that can be used in the next call to this operation to
-- return the next set of items in the list.
--
-- 'deviceInstances', 'listDeviceInstancesResponse_deviceInstances' - An object that contains information about your device instances.
--
-- 'httpStatus', 'listDeviceInstancesResponse_httpStatus' - The response's http status code.
newListDeviceInstancesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListDeviceInstancesResponse
newListDeviceInstancesResponse :: Int -> ListDeviceInstancesResponse
newListDeviceInstancesResponse Int
pHttpStatus_ =
  ListDeviceInstancesResponse' :: Maybe Text
-> Maybe [DeviceInstance] -> Int -> ListDeviceInstancesResponse
ListDeviceInstancesResponse'
    { $sel:nextToken:ListDeviceInstancesResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deviceInstances:ListDeviceInstancesResponse' :: Maybe [DeviceInstance]
deviceInstances = Maybe [DeviceInstance]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListDeviceInstancesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An identifier that can be used in the next call to this operation to
-- return the next set of items in the list.
listDeviceInstancesResponse_nextToken :: Lens.Lens' ListDeviceInstancesResponse (Prelude.Maybe Prelude.Text)
listDeviceInstancesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListDeviceInstancesResponse -> f ListDeviceInstancesResponse
listDeviceInstancesResponse_nextToken = (ListDeviceInstancesResponse -> Maybe Text)
-> (ListDeviceInstancesResponse
    -> Maybe Text -> ListDeviceInstancesResponse)
-> Lens' ListDeviceInstancesResponse (Maybe Text)
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)

-- | An object that contains information about your device instances.
listDeviceInstancesResponse_deviceInstances :: Lens.Lens' ListDeviceInstancesResponse (Prelude.Maybe [DeviceInstance])
listDeviceInstancesResponse_deviceInstances :: (Maybe [DeviceInstance] -> f (Maybe [DeviceInstance]))
-> ListDeviceInstancesResponse -> f ListDeviceInstancesResponse
listDeviceInstancesResponse_deviceInstances = (ListDeviceInstancesResponse -> Maybe [DeviceInstance])
-> (ListDeviceInstancesResponse
    -> Maybe [DeviceInstance] -> ListDeviceInstancesResponse)
-> Lens' ListDeviceInstancesResponse (Maybe [DeviceInstance])
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) ((Maybe [DeviceInstance] -> f (Maybe [DeviceInstance]))
 -> ListDeviceInstancesResponse -> f ListDeviceInstancesResponse)
-> ((Maybe [DeviceInstance] -> f (Maybe [DeviceInstance]))
    -> Maybe [DeviceInstance] -> f (Maybe [DeviceInstance]))
-> (Maybe [DeviceInstance] -> f (Maybe [DeviceInstance]))
-> ListDeviceInstancesResponse
-> f ListDeviceInstancesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DeviceInstance] [DeviceInstance] [DeviceInstance] [DeviceInstance]
-> Iso
     (Maybe [DeviceInstance])
     (Maybe [DeviceInstance])
     (Maybe [DeviceInstance])
     (Maybe [DeviceInstance])
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
  [DeviceInstance] [DeviceInstance] [DeviceInstance] [DeviceInstance]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
listDeviceInstancesResponse_httpStatus :: Lens.Lens' ListDeviceInstancesResponse Prelude.Int
listDeviceInstancesResponse_httpStatus :: (Int -> f Int)
-> ListDeviceInstancesResponse -> f ListDeviceInstancesResponse
listDeviceInstancesResponse_httpStatus = (ListDeviceInstancesResponse -> Int)
-> (ListDeviceInstancesResponse
    -> Int -> ListDeviceInstancesResponse)
-> Lens
     ListDeviceInstancesResponse ListDeviceInstancesResponse Int Int
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