{-# 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.AlexaBusiness.SearchDevices
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Searches devices and lists the ones that meet a set of filter criteria.
--
-- This operation returns paginated results.
module Amazonka.AlexaBusiness.SearchDevices
  ( -- * Creating a Request
    SearchDevices (..),
    newSearchDevices,

    -- * Request Lenses
    searchDevices_filters,
    searchDevices_maxResults,
    searchDevices_nextToken,
    searchDevices_sortCriteria,

    -- * Destructuring the Response
    SearchDevicesResponse (..),
    newSearchDevicesResponse,

    -- * Response Lenses
    searchDevicesResponse_devices,
    searchDevicesResponse_nextToken,
    searchDevicesResponse_totalCount,
    searchDevicesResponse_httpStatus,
  )
where

import Amazonka.AlexaBusiness.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newSearchDevices' smart constructor.
data SearchDevices = SearchDevices'
  { -- | The filters to use to list a specified set of devices. Supported filter
    -- keys are DeviceName, DeviceStatus, DeviceStatusDetailCode, RoomName,
    -- DeviceType, DeviceSerialNumber, UnassociatedOnly, ConnectionStatus
    -- (ONLINE and OFFLINE), NetworkProfileName, NetworkProfileArn, Feature,
    -- and FailureCode.
    SearchDevices -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | The maximum number of results to include in the response. If more
    -- results exist than the specified @MaxResults@ value, a token is included
    -- in the response so that the remaining results can be retrieved.
    SearchDevices -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | An optional token returned from a prior request. Use this token for
    -- pagination of results from this action. If this parameter is specified,
    -- the response includes only results beyond the token, up to the value
    -- specified by @MaxResults@.
    SearchDevices -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The sort order to use in listing the specified set of devices. Supported
    -- sort keys are DeviceName, DeviceStatus, RoomName, DeviceType,
    -- DeviceSerialNumber, ConnectionStatus, NetworkProfileName,
    -- NetworkProfileArn, Feature, and FailureCode.
    SearchDevices -> Maybe [Sort]
sortCriteria :: Prelude.Maybe [Sort]
  }
  deriving (SearchDevices -> SearchDevices -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchDevices -> SearchDevices -> Bool
$c/= :: SearchDevices -> SearchDevices -> Bool
== :: SearchDevices -> SearchDevices -> Bool
$c== :: SearchDevices -> SearchDevices -> Bool
Prelude.Eq, ReadPrec [SearchDevices]
ReadPrec SearchDevices
Int -> ReadS SearchDevices
ReadS [SearchDevices]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchDevices]
$creadListPrec :: ReadPrec [SearchDevices]
readPrec :: ReadPrec SearchDevices
$creadPrec :: ReadPrec SearchDevices
readList :: ReadS [SearchDevices]
$creadList :: ReadS [SearchDevices]
readsPrec :: Int -> ReadS SearchDevices
$creadsPrec :: Int -> ReadS SearchDevices
Prelude.Read, Int -> SearchDevices -> ShowS
[SearchDevices] -> ShowS
SearchDevices -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchDevices] -> ShowS
$cshowList :: [SearchDevices] -> ShowS
show :: SearchDevices -> String
$cshow :: SearchDevices -> String
showsPrec :: Int -> SearchDevices -> ShowS
$cshowsPrec :: Int -> SearchDevices -> ShowS
Prelude.Show, forall x. Rep SearchDevices x -> SearchDevices
forall x. SearchDevices -> Rep SearchDevices x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchDevices x -> SearchDevices
$cfrom :: forall x. SearchDevices -> Rep SearchDevices x
Prelude.Generic)

-- |
-- Create a value of 'SearchDevices' 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:
--
-- 'filters', 'searchDevices_filters' - The filters to use to list a specified set of devices. Supported filter
-- keys are DeviceName, DeviceStatus, DeviceStatusDetailCode, RoomName,
-- DeviceType, DeviceSerialNumber, UnassociatedOnly, ConnectionStatus
-- (ONLINE and OFFLINE), NetworkProfileName, NetworkProfileArn, Feature,
-- and FailureCode.
--
-- 'maxResults', 'searchDevices_maxResults' - The maximum number of results to include in the response. If more
-- results exist than the specified @MaxResults@ value, a token is included
-- in the response so that the remaining results can be retrieved.
--
-- 'nextToken', 'searchDevices_nextToken' - An optional token returned from a prior request. Use this token for
-- pagination of results from this action. If this parameter is specified,
-- the response includes only results beyond the token, up to the value
-- specified by @MaxResults@.
--
-- 'sortCriteria', 'searchDevices_sortCriteria' - The sort order to use in listing the specified set of devices. Supported
-- sort keys are DeviceName, DeviceStatus, RoomName, DeviceType,
-- DeviceSerialNumber, ConnectionStatus, NetworkProfileName,
-- NetworkProfileArn, Feature, and FailureCode.
newSearchDevices ::
  SearchDevices
newSearchDevices :: SearchDevices
newSearchDevices =
  SearchDevices'
    { $sel:filters:SearchDevices' :: Maybe [Filter]
filters = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:SearchDevices' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:SearchDevices' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:sortCriteria:SearchDevices' :: Maybe [Sort]
sortCriteria = forall a. Maybe a
Prelude.Nothing
    }

-- | The filters to use to list a specified set of devices. Supported filter
-- keys are DeviceName, DeviceStatus, DeviceStatusDetailCode, RoomName,
-- DeviceType, DeviceSerialNumber, UnassociatedOnly, ConnectionStatus
-- (ONLINE and OFFLINE), NetworkProfileName, NetworkProfileArn, Feature,
-- and FailureCode.
searchDevices_filters :: Lens.Lens' SearchDevices (Prelude.Maybe [Filter])
searchDevices_filters :: Lens' SearchDevices (Maybe [Filter])
searchDevices_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchDevices' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:SearchDevices' :: SearchDevices -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: SearchDevices
s@SearchDevices' {} Maybe [Filter]
a -> SearchDevices
s {$sel:filters:SearchDevices' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: SearchDevices) 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

-- | The maximum number of results to include in the response. If more
-- results exist than the specified @MaxResults@ value, a token is included
-- in the response so that the remaining results can be retrieved.
searchDevices_maxResults :: Lens.Lens' SearchDevices (Prelude.Maybe Prelude.Natural)
searchDevices_maxResults :: Lens' SearchDevices (Maybe Natural)
searchDevices_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchDevices' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:SearchDevices' :: SearchDevices -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: SearchDevices
s@SearchDevices' {} Maybe Natural
a -> SearchDevices
s {$sel:maxResults:SearchDevices' :: Maybe Natural
maxResults = Maybe Natural
a} :: SearchDevices)

-- | An optional token returned from a prior request. Use this token for
-- pagination of results from this action. If this parameter is specified,
-- the response includes only results beyond the token, up to the value
-- specified by @MaxResults@.
searchDevices_nextToken :: Lens.Lens' SearchDevices (Prelude.Maybe Prelude.Text)
searchDevices_nextToken :: Lens' SearchDevices (Maybe Text)
searchDevices_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchDevices' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchDevices' :: SearchDevices -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchDevices
s@SearchDevices' {} Maybe Text
a -> SearchDevices
s {$sel:nextToken:SearchDevices' :: Maybe Text
nextToken = Maybe Text
a} :: SearchDevices)

-- | The sort order to use in listing the specified set of devices. Supported
-- sort keys are DeviceName, DeviceStatus, RoomName, DeviceType,
-- DeviceSerialNumber, ConnectionStatus, NetworkProfileName,
-- NetworkProfileArn, Feature, and FailureCode.
searchDevices_sortCriteria :: Lens.Lens' SearchDevices (Prelude.Maybe [Sort])
searchDevices_sortCriteria :: Lens' SearchDevices (Maybe [Sort])
searchDevices_sortCriteria = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchDevices' {Maybe [Sort]
sortCriteria :: Maybe [Sort]
$sel:sortCriteria:SearchDevices' :: SearchDevices -> Maybe [Sort]
sortCriteria} -> Maybe [Sort]
sortCriteria) (\s :: SearchDevices
s@SearchDevices' {} Maybe [Sort]
a -> SearchDevices
s {$sel:sortCriteria:SearchDevices' :: Maybe [Sort]
sortCriteria = Maybe [Sort]
a} :: SearchDevices) 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

instance Core.AWSPager SearchDevices where
  page :: SearchDevices -> AWSResponse SearchDevices -> Maybe SearchDevices
page SearchDevices
rq AWSResponse SearchDevices
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse SearchDevices
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' SearchDevicesResponse (Maybe Text)
searchDevicesResponse_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 SearchDevices
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' SearchDevicesResponse (Maybe [DeviceData])
searchDevicesResponse_devices
            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.$ SearchDevices
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' SearchDevices (Maybe Text)
searchDevices_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse SearchDevices
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' SearchDevicesResponse (Maybe Text)
searchDevicesResponse_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 SearchDevices where
  type
    AWSResponse SearchDevices =
      SearchDevicesResponse
  request :: (Service -> Service) -> SearchDevices -> Request SearchDevices
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 SearchDevices
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SearchDevices)))
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 [DeviceData]
-> Maybe Text -> Maybe Int -> Int -> SearchDevicesResponse
SearchDevicesResponse'
            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
"Devices" 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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"TotalCount")
            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 SearchDevices where
  hashWithSalt :: Int -> SearchDevices -> Int
hashWithSalt Int
_salt SearchDevices' {Maybe Natural
Maybe [Filter]
Maybe [Sort]
Maybe Text
sortCriteria :: Maybe [Sort]
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
$sel:sortCriteria:SearchDevices' :: SearchDevices -> Maybe [Sort]
$sel:nextToken:SearchDevices' :: SearchDevices -> Maybe Text
$sel:maxResults:SearchDevices' :: SearchDevices -> Maybe Natural
$sel:filters:SearchDevices' :: SearchDevices -> Maybe [Filter]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Filter]
filters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Sort]
sortCriteria

instance Prelude.NFData SearchDevices where
  rnf :: SearchDevices -> ()
rnf SearchDevices' {Maybe Natural
Maybe [Filter]
Maybe [Sort]
Maybe Text
sortCriteria :: Maybe [Sort]
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
$sel:sortCriteria:SearchDevices' :: SearchDevices -> Maybe [Sort]
$sel:nextToken:SearchDevices' :: SearchDevices -> Maybe Text
$sel:maxResults:SearchDevices' :: SearchDevices -> Maybe Natural
$sel:filters:SearchDevices' :: SearchDevices -> Maybe [Filter]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Filter]
filters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      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 Maybe [Sort]
sortCriteria

instance Data.ToHeaders SearchDevices where
  toHeaders :: SearchDevices -> 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
"AlexaForBusiness.SearchDevices" ::
                          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 SearchDevices where
  toJSON :: SearchDevices -> Value
toJSON SearchDevices' {Maybe Natural
Maybe [Filter]
Maybe [Sort]
Maybe Text
sortCriteria :: Maybe [Sort]
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
$sel:sortCriteria:SearchDevices' :: SearchDevices -> Maybe [Sort]
$sel:nextToken:SearchDevices' :: SearchDevices -> Maybe Text
$sel:maxResults:SearchDevices' :: SearchDevices -> Maybe Natural
$sel:filters:SearchDevices' :: SearchDevices -> Maybe [Filter]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Filters" 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 [Filter]
filters,
            (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 Natural
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,
            (Key
"SortCriteria" 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 [Sort]
sortCriteria
          ]
      )

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

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

-- | /See:/ 'newSearchDevicesResponse' smart constructor.
data SearchDevicesResponse = SearchDevicesResponse'
  { -- | The devices that meet the specified set of filter criteria, in sort
    -- order.
    SearchDevicesResponse -> Maybe [DeviceData]
devices :: Prelude.Maybe [DeviceData],
    -- | The token returned to indicate that there is more data available.
    SearchDevicesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The total number of devices returned.
    SearchDevicesResponse -> Maybe Int
totalCount :: Prelude.Maybe Prelude.Int,
    -- | The response's http status code.
    SearchDevicesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (SearchDevicesResponse -> SearchDevicesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchDevicesResponse -> SearchDevicesResponse -> Bool
$c/= :: SearchDevicesResponse -> SearchDevicesResponse -> Bool
== :: SearchDevicesResponse -> SearchDevicesResponse -> Bool
$c== :: SearchDevicesResponse -> SearchDevicesResponse -> Bool
Prelude.Eq, ReadPrec [SearchDevicesResponse]
ReadPrec SearchDevicesResponse
Int -> ReadS SearchDevicesResponse
ReadS [SearchDevicesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchDevicesResponse]
$creadListPrec :: ReadPrec [SearchDevicesResponse]
readPrec :: ReadPrec SearchDevicesResponse
$creadPrec :: ReadPrec SearchDevicesResponse
readList :: ReadS [SearchDevicesResponse]
$creadList :: ReadS [SearchDevicesResponse]
readsPrec :: Int -> ReadS SearchDevicesResponse
$creadsPrec :: Int -> ReadS SearchDevicesResponse
Prelude.Read, Int -> SearchDevicesResponse -> ShowS
[SearchDevicesResponse] -> ShowS
SearchDevicesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchDevicesResponse] -> ShowS
$cshowList :: [SearchDevicesResponse] -> ShowS
show :: SearchDevicesResponse -> String
$cshow :: SearchDevicesResponse -> String
showsPrec :: Int -> SearchDevicesResponse -> ShowS
$cshowsPrec :: Int -> SearchDevicesResponse -> ShowS
Prelude.Show, forall x. Rep SearchDevicesResponse x -> SearchDevicesResponse
forall x. SearchDevicesResponse -> Rep SearchDevicesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchDevicesResponse x -> SearchDevicesResponse
$cfrom :: forall x. SearchDevicesResponse -> Rep SearchDevicesResponse x
Prelude.Generic)

-- |
-- Create a value of 'SearchDevicesResponse' 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:
--
-- 'devices', 'searchDevicesResponse_devices' - The devices that meet the specified set of filter criteria, in sort
-- order.
--
-- 'nextToken', 'searchDevicesResponse_nextToken' - The token returned to indicate that there is more data available.
--
-- 'totalCount', 'searchDevicesResponse_totalCount' - The total number of devices returned.
--
-- 'httpStatus', 'searchDevicesResponse_httpStatus' - The response's http status code.
newSearchDevicesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SearchDevicesResponse
newSearchDevicesResponse :: Int -> SearchDevicesResponse
newSearchDevicesResponse Int
pHttpStatus_ =
  SearchDevicesResponse'
    { $sel:devices:SearchDevicesResponse' :: Maybe [DeviceData]
devices = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:SearchDevicesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:totalCount:SearchDevicesResponse' :: Maybe Int
totalCount = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SearchDevicesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The devices that meet the specified set of filter criteria, in sort
-- order.
searchDevicesResponse_devices :: Lens.Lens' SearchDevicesResponse (Prelude.Maybe [DeviceData])
searchDevicesResponse_devices :: Lens' SearchDevicesResponse (Maybe [DeviceData])
searchDevicesResponse_devices = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchDevicesResponse' {Maybe [DeviceData]
devices :: Maybe [DeviceData]
$sel:devices:SearchDevicesResponse' :: SearchDevicesResponse -> Maybe [DeviceData]
devices} -> Maybe [DeviceData]
devices) (\s :: SearchDevicesResponse
s@SearchDevicesResponse' {} Maybe [DeviceData]
a -> SearchDevicesResponse
s {$sel:devices:SearchDevicesResponse' :: Maybe [DeviceData]
devices = Maybe [DeviceData]
a} :: SearchDevicesResponse) 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

-- | The token returned to indicate that there is more data available.
searchDevicesResponse_nextToken :: Lens.Lens' SearchDevicesResponse (Prelude.Maybe Prelude.Text)
searchDevicesResponse_nextToken :: Lens' SearchDevicesResponse (Maybe Text)
searchDevicesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchDevicesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchDevicesResponse' :: SearchDevicesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchDevicesResponse
s@SearchDevicesResponse' {} Maybe Text
a -> SearchDevicesResponse
s {$sel:nextToken:SearchDevicesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: SearchDevicesResponse)

-- | The total number of devices returned.
searchDevicesResponse_totalCount :: Lens.Lens' SearchDevicesResponse (Prelude.Maybe Prelude.Int)
searchDevicesResponse_totalCount :: Lens' SearchDevicesResponse (Maybe Int)
searchDevicesResponse_totalCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchDevicesResponse' {Maybe Int
totalCount :: Maybe Int
$sel:totalCount:SearchDevicesResponse' :: SearchDevicesResponse -> Maybe Int
totalCount} -> Maybe Int
totalCount) (\s :: SearchDevicesResponse
s@SearchDevicesResponse' {} Maybe Int
a -> SearchDevicesResponse
s {$sel:totalCount:SearchDevicesResponse' :: Maybe Int
totalCount = Maybe Int
a} :: SearchDevicesResponse)

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

instance Prelude.NFData SearchDevicesResponse where
  rnf :: SearchDevicesResponse -> ()
rnf SearchDevicesResponse' {Int
Maybe Int
Maybe [DeviceData]
Maybe Text
httpStatus :: Int
totalCount :: Maybe Int
nextToken :: Maybe Text
devices :: Maybe [DeviceData]
$sel:httpStatus:SearchDevicesResponse' :: SearchDevicesResponse -> Int
$sel:totalCount:SearchDevicesResponse' :: SearchDevicesResponse -> Maybe Int
$sel:nextToken:SearchDevicesResponse' :: SearchDevicesResponse -> Maybe Text
$sel:devices:SearchDevicesResponse' :: SearchDevicesResponse -> Maybe [DeviceData]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [DeviceData]
devices
      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 Maybe Int
totalCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus