{-# 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-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)
--
-- 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__.
--
-- 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_usePrefixAttributeValue,
    listThings_attributeValue,
    listThings_thingTypeName,
    listThings_nextToken,
    listThings_attributeName,
    listThings_maxResults,

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

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

import qualified Amazonka.Core as Core
import Amazonka.IoT.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

-- | The input for the ListThings operation.
--
-- /See:/ 'newListThings' smart constructor.
data ListThings = 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 -> Maybe Bool
usePrefixAttributeValue :: Prelude.Maybe Prelude.Bool,
    -- | The attribute value used to search for things.
    ListThings -> Maybe Text
attributeValue :: Prelude.Maybe Prelude.Text,
    -- | The name of the thing type used to search for things.
    ListThings -> Maybe Text
thingTypeName :: Prelude.Maybe Prelude.Text,
    -- | 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 attribute name used to search for things.
    ListThings -> Maybe Text
attributeName :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return in this operation.
    ListThings -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListThings -> ListThings -> Bool
(ListThings -> ListThings -> Bool)
-> (ListThings -> ListThings -> Bool) -> Eq ListThings
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]
(Int -> ReadS ListThings)
-> ReadS [ListThings]
-> ReadPrec ListThings
-> ReadPrec [ListThings]
-> Read 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
(Int -> ListThings -> ShowS)
-> (ListThings -> String)
-> ([ListThings] -> ShowS)
-> Show ListThings
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. ListThings -> Rep ListThings x)
-> (forall x. Rep ListThings x -> ListThings) -> Generic ListThings
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:
--
-- '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.
--
-- 'attributeValue', 'listThings_attributeValue' - The attribute value used to search for things.
--
-- 'thingTypeName', 'listThings_thingTypeName' - The name of the thing type used to search for things.
--
-- '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.
--
-- 'attributeName', 'listThings_attributeName' - The attribute name used to search for things.
--
-- 'maxResults', 'listThings_maxResults' - The maximum number of results to return in this operation.
newListThings ::
  ListThings
newListThings :: ListThings
newListThings =
  ListThings' :: Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> ListThings
ListThings'
    { $sel:usePrefixAttributeValue:ListThings' :: Maybe Bool
usePrefixAttributeValue =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:attributeValue:ListThings' :: Maybe Text
attributeValue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:thingTypeName:ListThings' :: Maybe Text
thingTypeName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListThings' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:attributeName:ListThings' :: Maybe Text
attributeName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListThings' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Bool -> f (Maybe Bool)) -> ListThings -> f ListThings
listThings_usePrefixAttributeValue = (ListThings -> Maybe Bool)
-> (ListThings -> Maybe Bool -> ListThings)
-> Lens ListThings ListThings (Maybe Bool) (Maybe Bool)
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)

-- | The attribute value used to search for things.
listThings_attributeValue :: Lens.Lens' ListThings (Prelude.Maybe Prelude.Text)
listThings_attributeValue :: (Maybe Text -> f (Maybe Text)) -> ListThings -> f ListThings
listThings_attributeValue = (ListThings -> Maybe Text)
-> (ListThings -> Maybe Text -> ListThings)
-> Lens ListThings ListThings (Maybe Text) (Maybe Text)
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 name of the thing type used to search for things.
listThings_thingTypeName :: Lens.Lens' ListThings (Prelude.Maybe Prelude.Text)
listThings_thingTypeName :: (Maybe Text -> f (Maybe Text)) -> ListThings -> f ListThings
listThings_thingTypeName = (ListThings -> Maybe Text)
-> (ListThings -> Maybe Text -> ListThings)
-> Lens ListThings ListThings (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text)) -> ListThings -> f ListThings
listThings_nextToken = (ListThings -> Maybe Text)
-> (ListThings -> Maybe Text -> ListThings)
-> Lens ListThings ListThings (Maybe Text) (Maybe Text)
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 attribute name used to search for things.
listThings_attributeName :: Lens.Lens' ListThings (Prelude.Maybe Prelude.Text)
listThings_attributeName :: (Maybe Text -> f (Maybe Text)) -> ListThings -> f ListThings
listThings_attributeName = (ListThings -> Maybe Text)
-> (ListThings -> Maybe Text -> ListThings)
-> Lens ListThings ListThings (Maybe Text) (Maybe Text)
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 maximum number of results to return in this operation.
listThings_maxResults :: Lens.Lens' ListThings (Prelude.Maybe Prelude.Natural)
listThings_maxResults :: (Maybe Natural -> f (Maybe Natural)) -> ListThings -> f ListThings
listThings_maxResults = (ListThings -> Maybe Natural)
-> (ListThings -> Maybe Natural -> ListThings)
-> Lens ListThings ListThings (Maybe Natural) (Maybe Natural)
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)

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

instance Prelude.NFData ListThings

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

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

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

-- | 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
(ListThingsResponse -> ListThingsResponse -> Bool)
-> (ListThingsResponse -> ListThingsResponse -> Bool)
-> Eq ListThingsResponse
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]
(Int -> ReadS ListThingsResponse)
-> ReadS [ListThingsResponse]
-> ReadPrec ListThingsResponse
-> ReadPrec [ListThingsResponse]
-> Read 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
(Int -> ListThingsResponse -> ShowS)
-> (ListThingsResponse -> String)
-> ([ListThingsResponse] -> ShowS)
-> Show ListThingsResponse
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. ListThingsResponse -> Rep ListThingsResponse x)
-> (forall x. Rep ListThingsResponse x -> ListThingsResponse)
-> Generic ListThingsResponse
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' :: Maybe Text -> Maybe [ThingAttribute] -> Int -> ListThingsResponse
ListThingsResponse'
    { $sel:nextToken:ListThingsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:things:ListThingsResponse' :: Maybe [ThingAttribute]
things = Maybe [ThingAttribute]
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 :: (Maybe Text -> f (Maybe Text))
-> ListThingsResponse -> f ListThingsResponse
listThingsResponse_nextToken = (ListThingsResponse -> Maybe Text)
-> (ListThingsResponse -> Maybe Text -> ListThingsResponse)
-> Lens' ListThingsResponse (Maybe Text)
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 :: (Maybe [ThingAttribute] -> f (Maybe [ThingAttribute]))
-> ListThingsResponse -> f ListThingsResponse
listThingsResponse_things = (ListThingsResponse -> Maybe [ThingAttribute])
-> (ListThingsResponse
    -> Maybe [ThingAttribute] -> ListThingsResponse)
-> Lens' ListThingsResponse (Maybe [ThingAttribute])
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) ((Maybe [ThingAttribute] -> f (Maybe [ThingAttribute]))
 -> ListThingsResponse -> f ListThingsResponse)
-> ((Maybe [ThingAttribute] -> f (Maybe [ThingAttribute]))
    -> Maybe [ThingAttribute] -> f (Maybe [ThingAttribute]))
-> (Maybe [ThingAttribute] -> f (Maybe [ThingAttribute]))
-> ListThingsResponse
-> f ListThingsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ThingAttribute] [ThingAttribute] [ThingAttribute] [ThingAttribute]
-> Iso
     (Maybe [ThingAttribute])
     (Maybe [ThingAttribute])
     (Maybe [ThingAttribute])
     (Maybe [ThingAttribute])
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
  [ThingAttribute] [ThingAttribute] [ThingAttribute] [ThingAttribute]
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 :: (Int -> f Int) -> ListThingsResponse -> f ListThingsResponse
listThingsResponse_httpStatus = (ListThingsResponse -> Int)
-> (ListThingsResponse -> Int -> ListThingsResponse)
-> Lens ListThingsResponse ListThingsResponse Int Int
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