{-# 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.NetworkManager.GetDevices
-- 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)
--
-- Gets information about one or more of your devices in a global network.
--
-- This operation returns paginated results.
module Amazonka.NetworkManager.GetDevices
  ( -- * Creating a Request
    GetDevices (..),
    newGetDevices,

    -- * Request Lenses
    getDevices_deviceIds,
    getDevices_nextToken,
    getDevices_siteId,
    getDevices_maxResults,
    getDevices_globalNetworkId,

    -- * Destructuring the Response
    GetDevicesResponse (..),
    newGetDevicesResponse,

    -- * Response Lenses
    getDevicesResponse_nextToken,
    getDevicesResponse_devices,
    getDevicesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.NetworkManager.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetDevices' smart constructor.
data GetDevices = GetDevices'
  { -- | One or more device IDs. The maximum is 10.
    GetDevices -> Maybe [Text]
deviceIds :: Prelude.Maybe [Prelude.Text],
    -- | The token for the next page of results.
    GetDevices -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The ID of the site.
    GetDevices -> Maybe Text
siteId :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return.
    GetDevices -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ID of the global network.
    GetDevices -> Text
globalNetworkId :: Prelude.Text
  }
  deriving (GetDevices -> GetDevices -> Bool
(GetDevices -> GetDevices -> Bool)
-> (GetDevices -> GetDevices -> Bool) -> Eq GetDevices
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDevices -> GetDevices -> Bool
$c/= :: GetDevices -> GetDevices -> Bool
== :: GetDevices -> GetDevices -> Bool
$c== :: GetDevices -> GetDevices -> Bool
Prelude.Eq, ReadPrec [GetDevices]
ReadPrec GetDevices
Int -> ReadS GetDevices
ReadS [GetDevices]
(Int -> ReadS GetDevices)
-> ReadS [GetDevices]
-> ReadPrec GetDevices
-> ReadPrec [GetDevices]
-> Read GetDevices
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDevices]
$creadListPrec :: ReadPrec [GetDevices]
readPrec :: ReadPrec GetDevices
$creadPrec :: ReadPrec GetDevices
readList :: ReadS [GetDevices]
$creadList :: ReadS [GetDevices]
readsPrec :: Int -> ReadS GetDevices
$creadsPrec :: Int -> ReadS GetDevices
Prelude.Read, Int -> GetDevices -> ShowS
[GetDevices] -> ShowS
GetDevices -> String
(Int -> GetDevices -> ShowS)
-> (GetDevices -> String)
-> ([GetDevices] -> ShowS)
-> Show GetDevices
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDevices] -> ShowS
$cshowList :: [GetDevices] -> ShowS
show :: GetDevices -> String
$cshow :: GetDevices -> String
showsPrec :: Int -> GetDevices -> ShowS
$cshowsPrec :: Int -> GetDevices -> ShowS
Prelude.Show, (forall x. GetDevices -> Rep GetDevices x)
-> (forall x. Rep GetDevices x -> GetDevices) -> Generic GetDevices
forall x. Rep GetDevices x -> GetDevices
forall x. GetDevices -> Rep GetDevices x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDevices x -> GetDevices
$cfrom :: forall x. GetDevices -> Rep GetDevices x
Prelude.Generic)

-- |
-- Create a value of 'GetDevices' 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:
--
-- 'deviceIds', 'getDevices_deviceIds' - One or more device IDs. The maximum is 10.
--
-- 'nextToken', 'getDevices_nextToken' - The token for the next page of results.
--
-- 'siteId', 'getDevices_siteId' - The ID of the site.
--
-- 'maxResults', 'getDevices_maxResults' - The maximum number of results to return.
--
-- 'globalNetworkId', 'getDevices_globalNetworkId' - The ID of the global network.
newGetDevices ::
  -- | 'globalNetworkId'
  Prelude.Text ->
  GetDevices
newGetDevices :: Text -> GetDevices
newGetDevices Text
pGlobalNetworkId_ =
  GetDevices' :: Maybe [Text]
-> Maybe Text -> Maybe Text -> Maybe Natural -> Text -> GetDevices
GetDevices'
    { $sel:deviceIds:GetDevices' :: Maybe [Text]
deviceIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetDevices' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:siteId:GetDevices' :: Maybe Text
siteId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetDevices' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:globalNetworkId:GetDevices' :: Text
globalNetworkId = Text
pGlobalNetworkId_
    }

-- | One or more device IDs. The maximum is 10.
getDevices_deviceIds :: Lens.Lens' GetDevices (Prelude.Maybe [Prelude.Text])
getDevices_deviceIds :: (Maybe [Text] -> f (Maybe [Text])) -> GetDevices -> f GetDevices
getDevices_deviceIds = (GetDevices -> Maybe [Text])
-> (GetDevices -> Maybe [Text] -> GetDevices)
-> Lens GetDevices GetDevices (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDevices' {Maybe [Text]
deviceIds :: Maybe [Text]
$sel:deviceIds:GetDevices' :: GetDevices -> Maybe [Text]
deviceIds} -> Maybe [Text]
deviceIds) (\s :: GetDevices
s@GetDevices' {} Maybe [Text]
a -> GetDevices
s {$sel:deviceIds:GetDevices' :: Maybe [Text]
deviceIds = Maybe [Text]
a} :: GetDevices) ((Maybe [Text] -> f (Maybe [Text])) -> GetDevices -> f GetDevices)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GetDevices
-> f GetDevices
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token for the next page of results.
getDevices_nextToken :: Lens.Lens' GetDevices (Prelude.Maybe Prelude.Text)
getDevices_nextToken :: (Maybe Text -> f (Maybe Text)) -> GetDevices -> f GetDevices
getDevices_nextToken = (GetDevices -> Maybe Text)
-> (GetDevices -> Maybe Text -> GetDevices)
-> Lens GetDevices GetDevices (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDevices' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetDevices' :: GetDevices -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetDevices
s@GetDevices' {} Maybe Text
a -> GetDevices
s {$sel:nextToken:GetDevices' :: Maybe Text
nextToken = Maybe Text
a} :: GetDevices)

-- | The ID of the site.
getDevices_siteId :: Lens.Lens' GetDevices (Prelude.Maybe Prelude.Text)
getDevices_siteId :: (Maybe Text -> f (Maybe Text)) -> GetDevices -> f GetDevices
getDevices_siteId = (GetDevices -> Maybe Text)
-> (GetDevices -> Maybe Text -> GetDevices)
-> Lens GetDevices GetDevices (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDevices' {Maybe Text
siteId :: Maybe Text
$sel:siteId:GetDevices' :: GetDevices -> Maybe Text
siteId} -> Maybe Text
siteId) (\s :: GetDevices
s@GetDevices' {} Maybe Text
a -> GetDevices
s {$sel:siteId:GetDevices' :: Maybe Text
siteId = Maybe Text
a} :: GetDevices)

-- | The maximum number of results to return.
getDevices_maxResults :: Lens.Lens' GetDevices (Prelude.Maybe Prelude.Natural)
getDevices_maxResults :: (Maybe Natural -> f (Maybe Natural)) -> GetDevices -> f GetDevices
getDevices_maxResults = (GetDevices -> Maybe Natural)
-> (GetDevices -> Maybe Natural -> GetDevices)
-> Lens GetDevices GetDevices (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDevices' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetDevices' :: GetDevices -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetDevices
s@GetDevices' {} Maybe Natural
a -> GetDevices
s {$sel:maxResults:GetDevices' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetDevices)

-- | The ID of the global network.
getDevices_globalNetworkId :: Lens.Lens' GetDevices Prelude.Text
getDevices_globalNetworkId :: (Text -> f Text) -> GetDevices -> f GetDevices
getDevices_globalNetworkId = (GetDevices -> Text)
-> (GetDevices -> Text -> GetDevices)
-> Lens GetDevices GetDevices Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDevices' {Text
globalNetworkId :: Text
$sel:globalNetworkId:GetDevices' :: GetDevices -> Text
globalNetworkId} -> Text
globalNetworkId) (\s :: GetDevices
s@GetDevices' {} Text
a -> GetDevices
s {$sel:globalNetworkId:GetDevices' :: Text
globalNetworkId = Text
a} :: GetDevices)

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

instance Prelude.NFData GetDevices

instance Core.ToHeaders GetDevices where
  toHeaders :: GetDevices -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetDevices -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath GetDevices where
  toPath :: GetDevices -> ByteString
toPath GetDevices' {Maybe Natural
Maybe [Text]
Maybe Text
Text
globalNetworkId :: Text
maxResults :: Maybe Natural
siteId :: Maybe Text
nextToken :: Maybe Text
deviceIds :: Maybe [Text]
$sel:globalNetworkId:GetDevices' :: GetDevices -> Text
$sel:maxResults:GetDevices' :: GetDevices -> Maybe Natural
$sel:siteId:GetDevices' :: GetDevices -> Maybe Text
$sel:nextToken:GetDevices' :: GetDevices -> Maybe Text
$sel:deviceIds:GetDevices' :: GetDevices -> Maybe [Text]
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/global-networks/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
globalNetworkId,
        ByteString
"/devices"
      ]

instance Core.ToQuery GetDevices where
  toQuery :: GetDevices -> QueryString
toQuery GetDevices' {Maybe Natural
Maybe [Text]
Maybe Text
Text
globalNetworkId :: Text
maxResults :: Maybe Natural
siteId :: Maybe Text
nextToken :: Maybe Text
deviceIds :: Maybe [Text]
$sel:globalNetworkId:GetDevices' :: GetDevices -> Text
$sel:maxResults:GetDevices' :: GetDevices -> Maybe Natural
$sel:siteId:GetDevices' :: GetDevices -> Maybe Text
$sel:nextToken:GetDevices' :: GetDevices -> Maybe Text
$sel:deviceIds:GetDevices' :: GetDevices -> Maybe [Text]
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"deviceIds"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
deviceIds),
        ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"siteId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
siteId,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

-- | /See:/ 'newGetDevicesResponse' smart constructor.
data GetDevicesResponse = GetDevicesResponse'
  { -- | The token for the next page of results.
    GetDevicesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The devices.
    GetDevicesResponse -> Maybe [Device]
devices :: Prelude.Maybe [Device],
    -- | The response's http status code.
    GetDevicesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetDevicesResponse -> GetDevicesResponse -> Bool
(GetDevicesResponse -> GetDevicesResponse -> Bool)
-> (GetDevicesResponse -> GetDevicesResponse -> Bool)
-> Eq GetDevicesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDevicesResponse -> GetDevicesResponse -> Bool
$c/= :: GetDevicesResponse -> GetDevicesResponse -> Bool
== :: GetDevicesResponse -> GetDevicesResponse -> Bool
$c== :: GetDevicesResponse -> GetDevicesResponse -> Bool
Prelude.Eq, Int -> GetDevicesResponse -> ShowS
[GetDevicesResponse] -> ShowS
GetDevicesResponse -> String
(Int -> GetDevicesResponse -> ShowS)
-> (GetDevicesResponse -> String)
-> ([GetDevicesResponse] -> ShowS)
-> Show GetDevicesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDevicesResponse] -> ShowS
$cshowList :: [GetDevicesResponse] -> ShowS
show :: GetDevicesResponse -> String
$cshow :: GetDevicesResponse -> String
showsPrec :: Int -> GetDevicesResponse -> ShowS
$cshowsPrec :: Int -> GetDevicesResponse -> ShowS
Prelude.Show, (forall x. GetDevicesResponse -> Rep GetDevicesResponse x)
-> (forall x. Rep GetDevicesResponse x -> GetDevicesResponse)
-> Generic GetDevicesResponse
forall x. Rep GetDevicesResponse x -> GetDevicesResponse
forall x. GetDevicesResponse -> Rep GetDevicesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDevicesResponse x -> GetDevicesResponse
$cfrom :: forall x. GetDevicesResponse -> Rep GetDevicesResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetDevicesResponse' 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', 'getDevicesResponse_nextToken' - The token for the next page of results.
--
-- 'devices', 'getDevicesResponse_devices' - The devices.
--
-- 'httpStatus', 'getDevicesResponse_httpStatus' - The response's http status code.
newGetDevicesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetDevicesResponse
newGetDevicesResponse :: Int -> GetDevicesResponse
newGetDevicesResponse Int
pHttpStatus_ =
  GetDevicesResponse' :: Maybe Text -> Maybe [Device] -> Int -> GetDevicesResponse
GetDevicesResponse'
    { $sel:nextToken:GetDevicesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:devices:GetDevicesResponse' :: Maybe [Device]
devices = Maybe [Device]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetDevicesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token for the next page of results.
getDevicesResponse_nextToken :: Lens.Lens' GetDevicesResponse (Prelude.Maybe Prelude.Text)
getDevicesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetDevicesResponse -> f GetDevicesResponse
getDevicesResponse_nextToken = (GetDevicesResponse -> Maybe Text)
-> (GetDevicesResponse -> Maybe Text -> GetDevicesResponse)
-> Lens' GetDevicesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDevicesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetDevicesResponse' :: GetDevicesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetDevicesResponse
s@GetDevicesResponse' {} Maybe Text
a -> GetDevicesResponse
s {$sel:nextToken:GetDevicesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetDevicesResponse)

-- | The devices.
getDevicesResponse_devices :: Lens.Lens' GetDevicesResponse (Prelude.Maybe [Device])
getDevicesResponse_devices :: (Maybe [Device] -> f (Maybe [Device]))
-> GetDevicesResponse -> f GetDevicesResponse
getDevicesResponse_devices = (GetDevicesResponse -> Maybe [Device])
-> (GetDevicesResponse -> Maybe [Device] -> GetDevicesResponse)
-> Lens' GetDevicesResponse (Maybe [Device])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDevicesResponse' {Maybe [Device]
devices :: Maybe [Device]
$sel:devices:GetDevicesResponse' :: GetDevicesResponse -> Maybe [Device]
devices} -> Maybe [Device]
devices) (\s :: GetDevicesResponse
s@GetDevicesResponse' {} Maybe [Device]
a -> GetDevicesResponse
s {$sel:devices:GetDevicesResponse' :: Maybe [Device]
devices = Maybe [Device]
a} :: GetDevicesResponse) ((Maybe [Device] -> f (Maybe [Device]))
 -> GetDevicesResponse -> f GetDevicesResponse)
-> ((Maybe [Device] -> f (Maybe [Device]))
    -> Maybe [Device] -> f (Maybe [Device]))
-> (Maybe [Device] -> f (Maybe [Device]))
-> GetDevicesResponse
-> f GetDevicesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Device] [Device] [Device] [Device]
-> Iso
     (Maybe [Device]) (Maybe [Device]) (Maybe [Device]) (Maybe [Device])
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 [Device] [Device] [Device] [Device]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
getDevicesResponse_httpStatus :: Lens.Lens' GetDevicesResponse Prelude.Int
getDevicesResponse_httpStatus :: (Int -> f Int) -> GetDevicesResponse -> f GetDevicesResponse
getDevicesResponse_httpStatus = (GetDevicesResponse -> Int)
-> (GetDevicesResponse -> Int -> GetDevicesResponse)
-> Lens GetDevicesResponse GetDevicesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDevicesResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDevicesResponse' :: GetDevicesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDevicesResponse
s@GetDevicesResponse' {} Int
a -> GetDevicesResponse
s {$sel:httpStatus:GetDevicesResponse' :: Int
httpStatus = Int
a} :: GetDevicesResponse)

instance Prelude.NFData GetDevicesResponse