{-# 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.IoT.ListThings
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists your things. Use the __attributeName__ and __attributeValue__
-- parameters to filter your things. For example, calling @ListThings@ with
-- attributeName=Color and attributeValue=Red retrieves all things in the
-- registry that contain an attribute __Color__ with the value __Red__. For
-- more information, see
-- <https://docs.aws.amazon.com/iot/latest/developerguide/thing-registry.html#list-things List Things>
-- from the /Amazon Web Services IoT Core Developer Guide/.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions ListThings>
-- action.
--
-- You will not be charged for calling this API if an @Access denied@ error
-- is returned. You will also not be charged if no attributes or pagination
-- token was provided in request and no pagination token and no results
-- were returned.
--
-- This operation returns paginated results.
module Amazonka.IoT.ListThings
  ( -- * Creating a Request
    ListThings (..),
    newListThings,

    -- * Request Lenses
    listThings_attributeName,
    listThings_attributeValue,
    listThings_maxResults,
    listThings_nextToken,
    listThings_thingTypeName,
    listThings_usePrefixAttributeValue,

    -- * Destructuring the Response
    ListThingsResponse (..),
    newListThingsResponse,

    -- * Response Lenses
    listThingsResponse_nextToken,
    listThingsResponse_things,
    listThingsResponse_httpStatus,
  )
where

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

-- | The input for the ListThings operation.
--
-- /See:/ 'newListThings' smart constructor.
data ListThings = ListThings'
  { -- | The attribute name used to search for things.
    ListThings -> Maybe Text
attributeName :: Prelude.Maybe Prelude.Text,
    -- | The attribute value used to search for things.
    ListThings -> Maybe Text
attributeValue :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return in this operation.
    ListThings -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | To retrieve the next set of results, the @nextToken@ value from a
    -- previous response; otherwise __null__ to receive the first set of
    -- results.
    ListThings -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The name of the thing type used to search for things.
    ListThings -> Maybe Text
thingTypeName :: Prelude.Maybe Prelude.Text,
    -- | When @true@, the action returns the thing resources with attribute
    -- values that start with the @attributeValue@ provided.
    --
    -- When @false@, or not present, the action returns only the thing
    -- resources with attribute values that match the entire @attributeValue@
    -- provided.
    ListThings -> Maybe Bool
usePrefixAttributeValue :: Prelude.Maybe Prelude.Bool
  }
  deriving (ListThings -> ListThings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListThings -> ListThings -> Bool
$c/= :: ListThings -> ListThings -> Bool
== :: ListThings -> ListThings -> Bool
$c== :: ListThings -> ListThings -> Bool
Prelude.Eq, ReadPrec [ListThings]
ReadPrec ListThings
Int -> ReadS ListThings
ReadS [ListThings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListThings]
$creadListPrec :: ReadPrec [ListThings]
readPrec :: ReadPrec ListThings
$creadPrec :: ReadPrec ListThings
readList :: ReadS [ListThings]
$creadList :: ReadS [ListThings]
readsPrec :: Int -> ReadS ListThings
$creadsPrec :: Int -> ReadS ListThings
Prelude.Read, Int -> ListThings -> ShowS
[ListThings] -> ShowS
ListThings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListThings] -> ShowS
$cshowList :: [ListThings] -> ShowS
show :: ListThings -> String
$cshow :: ListThings -> String
showsPrec :: Int -> ListThings -> ShowS
$cshowsPrec :: Int -> ListThings -> ShowS
Prelude.Show, forall x. Rep ListThings x -> ListThings
forall x. ListThings -> Rep ListThings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListThings x -> ListThings
$cfrom :: forall x. ListThings -> Rep ListThings x
Prelude.Generic)

-- |
-- Create a value of 'ListThings' 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:
--
-- 'attributeName', 'listThings_attributeName' - The attribute name used to search for things.
--
-- 'attributeValue', 'listThings_attributeValue' - The attribute value used to search for things.
--
-- 'maxResults', 'listThings_maxResults' - The maximum number of results to return in this operation.
--
-- 'nextToken', 'listThings_nextToken' - To retrieve the next set of results, the @nextToken@ value from a
-- previous response; otherwise __null__ to receive the first set of
-- results.
--
-- 'thingTypeName', 'listThings_thingTypeName' - The name of the thing type used to search for things.
--
-- 'usePrefixAttributeValue', 'listThings_usePrefixAttributeValue' - When @true@, the action returns the thing resources with attribute
-- values that start with the @attributeValue@ provided.
--
-- When @false@, or not present, the action returns only the thing
-- resources with attribute values that match the entire @attributeValue@
-- provided.
newListThings ::
  ListThings
newListThings :: ListThings
newListThings =
  ListThings'
    { $sel:attributeName:ListThings' :: Maybe Text
attributeName = forall a. Maybe a
Prelude.Nothing,
      $sel:attributeValue:ListThings' :: Maybe Text
attributeValue = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListThings' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListThings' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:thingTypeName:ListThings' :: Maybe Text
thingTypeName = forall a. Maybe a
Prelude.Nothing,
      $sel:usePrefixAttributeValue:ListThings' :: Maybe Bool
usePrefixAttributeValue = forall a. Maybe a
Prelude.Nothing
    }

-- | The attribute name used to search for things.
listThings_attributeName :: Lens.Lens' ListThings (Prelude.Maybe Prelude.Text)
listThings_attributeName :: Lens' ListThings (Maybe Text)
listThings_attributeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThings' {Maybe Text
attributeName :: Maybe Text
$sel:attributeName:ListThings' :: ListThings -> Maybe Text
attributeName} -> Maybe Text
attributeName) (\s :: ListThings
s@ListThings' {} Maybe Text
a -> ListThings
s {$sel:attributeName:ListThings' :: Maybe Text
attributeName = Maybe Text
a} :: ListThings)

-- | The attribute value used to search for things.
listThings_attributeValue :: Lens.Lens' ListThings (Prelude.Maybe Prelude.Text)
listThings_attributeValue :: Lens' ListThings (Maybe Text)
listThings_attributeValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThings' {Maybe Text
attributeValue :: Maybe Text
$sel:attributeValue:ListThings' :: ListThings -> Maybe Text
attributeValue} -> Maybe Text
attributeValue) (\s :: ListThings
s@ListThings' {} Maybe Text
a -> ListThings
s {$sel:attributeValue:ListThings' :: Maybe Text
attributeValue = Maybe Text
a} :: ListThings)

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

-- | To retrieve the next set of results, the @nextToken@ value from a
-- previous response; otherwise __null__ to receive the first set of
-- results.
listThings_nextToken :: Lens.Lens' ListThings (Prelude.Maybe Prelude.Text)
listThings_nextToken :: Lens' ListThings (Maybe Text)
listThings_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThings' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListThings' :: ListThings -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListThings
s@ListThings' {} Maybe Text
a -> ListThings
s {$sel:nextToken:ListThings' :: Maybe Text
nextToken = Maybe Text
a} :: ListThings)

-- | The name of the thing type used to search for things.
listThings_thingTypeName :: Lens.Lens' ListThings (Prelude.Maybe Prelude.Text)
listThings_thingTypeName :: Lens' ListThings (Maybe Text)
listThings_thingTypeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThings' {Maybe Text
thingTypeName :: Maybe Text
$sel:thingTypeName:ListThings' :: ListThings -> Maybe Text
thingTypeName} -> Maybe Text
thingTypeName) (\s :: ListThings
s@ListThings' {} Maybe Text
a -> ListThings
s {$sel:thingTypeName:ListThings' :: Maybe Text
thingTypeName = Maybe Text
a} :: ListThings)

-- | When @true@, the action returns the thing resources with attribute
-- values that start with the @attributeValue@ provided.
--
-- When @false@, or not present, the action returns only the thing
-- resources with attribute values that match the entire @attributeValue@
-- provided.
listThings_usePrefixAttributeValue :: Lens.Lens' ListThings (Prelude.Maybe Prelude.Bool)
listThings_usePrefixAttributeValue :: Lens' ListThings (Maybe Bool)
listThings_usePrefixAttributeValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThings' {Maybe Bool
usePrefixAttributeValue :: Maybe Bool
$sel:usePrefixAttributeValue:ListThings' :: ListThings -> Maybe Bool
usePrefixAttributeValue} -> Maybe Bool
usePrefixAttributeValue) (\s :: ListThings
s@ListThings' {} Maybe Bool
a -> ListThings
s {$sel:usePrefixAttributeValue:ListThings' :: Maybe Bool
usePrefixAttributeValue = Maybe Bool
a} :: ListThings)

instance Core.AWSPager ListThings where
  page :: ListThings -> AWSResponse ListThings -> Maybe ListThings
page ListThings
rq AWSResponse ListThings
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListThings
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListThingsResponse (Maybe Text)
listThingsResponse_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 ListThings
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListThingsResponse (Maybe [ThingAttribute])
listThingsResponse_things
            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.$ ListThings
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListThings (Maybe Text)
listThings_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListThings
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListThingsResponse (Maybe Text)
listThingsResponse_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 ListThings where
  type AWSResponse ListThings = ListThingsResponse
  request :: (Service -> Service) -> ListThings -> Request ListThings
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListThings
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListThings)))
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 Text -> Maybe [ThingAttribute] -> Int -> ListThingsResponse
ListThingsResponse'
            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
"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
"things" 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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListThings where
  hashWithSalt :: Int -> ListThings -> Int
hashWithSalt Int
_salt ListThings' {Maybe Bool
Maybe Natural
Maybe Text
usePrefixAttributeValue :: Maybe Bool
thingTypeName :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
attributeValue :: Maybe Text
attributeName :: Maybe Text
$sel:usePrefixAttributeValue:ListThings' :: ListThings -> Maybe Bool
$sel:thingTypeName:ListThings' :: ListThings -> Maybe Text
$sel:nextToken:ListThings' :: ListThings -> Maybe Text
$sel:maxResults:ListThings' :: ListThings -> Maybe Natural
$sel:attributeValue:ListThings' :: ListThings -> Maybe Text
$sel:attributeName:ListThings' :: ListThings -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
attributeName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
attributeValue
      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 Text
thingTypeName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
usePrefixAttributeValue

instance Prelude.NFData ListThings where
  rnf :: ListThings -> ()
rnf ListThings' {Maybe Bool
Maybe Natural
Maybe Text
usePrefixAttributeValue :: Maybe Bool
thingTypeName :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
attributeValue :: Maybe Text
attributeName :: Maybe Text
$sel:usePrefixAttributeValue:ListThings' :: ListThings -> Maybe Bool
$sel:thingTypeName:ListThings' :: ListThings -> Maybe Text
$sel:nextToken:ListThings' :: ListThings -> Maybe Text
$sel:maxResults:ListThings' :: ListThings -> Maybe Natural
$sel:attributeValue:ListThings' :: ListThings -> Maybe Text
$sel:attributeName:ListThings' :: ListThings -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
attributeName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
attributeValue
      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 Text
thingTypeName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
usePrefixAttributeValue

instance Data.ToHeaders ListThings where
  toHeaders :: ListThings -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToQuery ListThings where
  toQuery :: ListThings -> QueryString
toQuery ListThings' {Maybe Bool
Maybe Natural
Maybe Text
usePrefixAttributeValue :: Maybe Bool
thingTypeName :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
attributeValue :: Maybe Text
attributeName :: Maybe Text
$sel:usePrefixAttributeValue:ListThings' :: ListThings -> Maybe Bool
$sel:thingTypeName:ListThings' :: ListThings -> Maybe Text
$sel:nextToken:ListThings' :: ListThings -> Maybe Text
$sel:maxResults:ListThings' :: ListThings -> Maybe Natural
$sel:attributeValue:ListThings' :: ListThings -> Maybe Text
$sel:attributeName:ListThings' :: ListThings -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"attributeName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
attributeName,
        ByteString
"attributeValue" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
attributeValue,
        ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
        ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken,
        ByteString
"thingTypeName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
thingTypeName,
        ByteString
"usePrefixAttributeValue"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
usePrefixAttributeValue
      ]

-- | The output from the ListThings operation.
--
-- /See:/ 'newListThingsResponse' smart constructor.
data ListThingsResponse = ListThingsResponse'
  { -- | The token to use to get the next set of results. Will not be returned if
    -- operation has returned all results.
    ListThingsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The things.
    ListThingsResponse -> Maybe [ThingAttribute]
things :: Prelude.Maybe [ThingAttribute],
    -- | The response's http status code.
    ListThingsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListThingsResponse -> ListThingsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListThingsResponse -> ListThingsResponse -> Bool
$c/= :: ListThingsResponse -> ListThingsResponse -> Bool
== :: ListThingsResponse -> ListThingsResponse -> Bool
$c== :: ListThingsResponse -> ListThingsResponse -> Bool
Prelude.Eq, ReadPrec [ListThingsResponse]
ReadPrec ListThingsResponse
Int -> ReadS ListThingsResponse
ReadS [ListThingsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListThingsResponse]
$creadListPrec :: ReadPrec [ListThingsResponse]
readPrec :: ReadPrec ListThingsResponse
$creadPrec :: ReadPrec ListThingsResponse
readList :: ReadS [ListThingsResponse]
$creadList :: ReadS [ListThingsResponse]
readsPrec :: Int -> ReadS ListThingsResponse
$creadsPrec :: Int -> ReadS ListThingsResponse
Prelude.Read, Int -> ListThingsResponse -> ShowS
[ListThingsResponse] -> ShowS
ListThingsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListThingsResponse] -> ShowS
$cshowList :: [ListThingsResponse] -> ShowS
show :: ListThingsResponse -> String
$cshow :: ListThingsResponse -> String
showsPrec :: Int -> ListThingsResponse -> ShowS
$cshowsPrec :: Int -> ListThingsResponse -> ShowS
Prelude.Show, forall x. Rep ListThingsResponse x -> ListThingsResponse
forall x. ListThingsResponse -> Rep ListThingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListThingsResponse x -> ListThingsResponse
$cfrom :: forall x. ListThingsResponse -> Rep ListThingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListThingsResponse' 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', 'listThingsResponse_nextToken' - The token to use to get the next set of results. Will not be returned if
-- operation has returned all results.
--
-- 'things', 'listThingsResponse_things' - The things.
--
-- 'httpStatus', 'listThingsResponse_httpStatus' - The response's http status code.
newListThingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListThingsResponse
newListThingsResponse :: Int -> ListThingsResponse
newListThingsResponse Int
pHttpStatus_ =
  ListThingsResponse'
    { $sel:nextToken:ListThingsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:things:ListThingsResponse' :: Maybe [ThingAttribute]
things = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListThingsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token to use to get the next set of results. Will not be returned if
-- operation has returned all results.
listThingsResponse_nextToken :: Lens.Lens' ListThingsResponse (Prelude.Maybe Prelude.Text)
listThingsResponse_nextToken :: Lens' ListThingsResponse (Maybe Text)
listThingsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListThingsResponse' :: ListThingsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListThingsResponse
s@ListThingsResponse' {} Maybe Text
a -> ListThingsResponse
s {$sel:nextToken:ListThingsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListThingsResponse)

-- | The things.
listThingsResponse_things :: Lens.Lens' ListThingsResponse (Prelude.Maybe [ThingAttribute])
listThingsResponse_things :: Lens' ListThingsResponse (Maybe [ThingAttribute])
listThingsResponse_things = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingsResponse' {Maybe [ThingAttribute]
things :: Maybe [ThingAttribute]
$sel:things:ListThingsResponse' :: ListThingsResponse -> Maybe [ThingAttribute]
things} -> Maybe [ThingAttribute]
things) (\s :: ListThingsResponse
s@ListThingsResponse' {} Maybe [ThingAttribute]
a -> ListThingsResponse
s {$sel:things:ListThingsResponse' :: Maybe [ThingAttribute]
things = Maybe [ThingAttribute]
a} :: ListThingsResponse) 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 response's http status code.
listThingsResponse_httpStatus :: Lens.Lens' ListThingsResponse Prelude.Int
listThingsResponse_httpStatus :: Lens' ListThingsResponse Int
listThingsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListThingsResponse' :: ListThingsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListThingsResponse
s@ListThingsResponse' {} Int
a -> ListThingsResponse
s {$sel:httpStatus:ListThingsResponse' :: Int
httpStatus = Int
a} :: ListThingsResponse)

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