{-# 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.ListThingGroups
-- 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)
--
-- List the thing groups in your account.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions ListThingGroups>
-- action.
--
-- This operation returns paginated results.
module Amazonka.IoT.ListThingGroups
  ( -- * Creating a Request
    ListThingGroups (..),
    newListThingGroups,

    -- * Request Lenses
    listThingGroups_namePrefixFilter,
    listThingGroups_parentGroup,
    listThingGroups_nextToken,
    listThingGroups_recursive,
    listThingGroups_maxResults,

    -- * Destructuring the Response
    ListThingGroupsResponse (..),
    newListThingGroupsResponse,

    -- * Response Lenses
    listThingGroupsResponse_thingGroups,
    listThingGroupsResponse_nextToken,
    listThingGroupsResponse_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

-- | /See:/ 'newListThingGroups' smart constructor.
data ListThingGroups = ListThingGroups'
  { -- | A filter that limits the results to those with the specified name
    -- prefix.
    ListThingGroups -> Maybe Text
namePrefixFilter :: Prelude.Maybe Prelude.Text,
    -- | A filter that limits the results to those with the specified parent
    -- group.
    ListThingGroups -> Maybe Text
parentGroup :: 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.
    ListThingGroups -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | If true, return child groups as well.
    ListThingGroups -> Maybe Bool
recursive :: Prelude.Maybe Prelude.Bool,
    -- | The maximum number of results to return at one time.
    ListThingGroups -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListThingGroups -> ListThingGroups -> Bool
(ListThingGroups -> ListThingGroups -> Bool)
-> (ListThingGroups -> ListThingGroups -> Bool)
-> Eq ListThingGroups
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListThingGroups -> ListThingGroups -> Bool
$c/= :: ListThingGroups -> ListThingGroups -> Bool
== :: ListThingGroups -> ListThingGroups -> Bool
$c== :: ListThingGroups -> ListThingGroups -> Bool
Prelude.Eq, ReadPrec [ListThingGroups]
ReadPrec ListThingGroups
Int -> ReadS ListThingGroups
ReadS [ListThingGroups]
(Int -> ReadS ListThingGroups)
-> ReadS [ListThingGroups]
-> ReadPrec ListThingGroups
-> ReadPrec [ListThingGroups]
-> Read ListThingGroups
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListThingGroups]
$creadListPrec :: ReadPrec [ListThingGroups]
readPrec :: ReadPrec ListThingGroups
$creadPrec :: ReadPrec ListThingGroups
readList :: ReadS [ListThingGroups]
$creadList :: ReadS [ListThingGroups]
readsPrec :: Int -> ReadS ListThingGroups
$creadsPrec :: Int -> ReadS ListThingGroups
Prelude.Read, Int -> ListThingGroups -> ShowS
[ListThingGroups] -> ShowS
ListThingGroups -> String
(Int -> ListThingGroups -> ShowS)
-> (ListThingGroups -> String)
-> ([ListThingGroups] -> ShowS)
-> Show ListThingGroups
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListThingGroups] -> ShowS
$cshowList :: [ListThingGroups] -> ShowS
show :: ListThingGroups -> String
$cshow :: ListThingGroups -> String
showsPrec :: Int -> ListThingGroups -> ShowS
$cshowsPrec :: Int -> ListThingGroups -> ShowS
Prelude.Show, (forall x. ListThingGroups -> Rep ListThingGroups x)
-> (forall x. Rep ListThingGroups x -> ListThingGroups)
-> Generic ListThingGroups
forall x. Rep ListThingGroups x -> ListThingGroups
forall x. ListThingGroups -> Rep ListThingGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListThingGroups x -> ListThingGroups
$cfrom :: forall x. ListThingGroups -> Rep ListThingGroups x
Prelude.Generic)

-- |
-- Create a value of 'ListThingGroups' 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:
--
-- 'namePrefixFilter', 'listThingGroups_namePrefixFilter' - A filter that limits the results to those with the specified name
-- prefix.
--
-- 'parentGroup', 'listThingGroups_parentGroup' - A filter that limits the results to those with the specified parent
-- group.
--
-- 'nextToken', 'listThingGroups_nextToken' - To retrieve the next set of results, the @nextToken@ value from a
-- previous response; otherwise __null__ to receive the first set of
-- results.
--
-- 'recursive', 'listThingGroups_recursive' - If true, return child groups as well.
--
-- 'maxResults', 'listThingGroups_maxResults' - The maximum number of results to return at one time.
newListThingGroups ::
  ListThingGroups
newListThingGroups :: ListThingGroups
newListThingGroups =
  ListThingGroups' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Natural
-> ListThingGroups
ListThingGroups'
    { $sel:namePrefixFilter:ListThingGroups' :: Maybe Text
namePrefixFilter =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:parentGroup:ListThingGroups' :: Maybe Text
parentGroup = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListThingGroups' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:recursive:ListThingGroups' :: Maybe Bool
recursive = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListThingGroups' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | A filter that limits the results to those with the specified name
-- prefix.
listThingGroups_namePrefixFilter :: Lens.Lens' ListThingGroups (Prelude.Maybe Prelude.Text)
listThingGroups_namePrefixFilter :: (Maybe Text -> f (Maybe Text))
-> ListThingGroups -> f ListThingGroups
listThingGroups_namePrefixFilter = (ListThingGroups -> Maybe Text)
-> (ListThingGroups -> Maybe Text -> ListThingGroups)
-> Lens ListThingGroups ListThingGroups (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingGroups' {Maybe Text
namePrefixFilter :: Maybe Text
$sel:namePrefixFilter:ListThingGroups' :: ListThingGroups -> Maybe Text
namePrefixFilter} -> Maybe Text
namePrefixFilter) (\s :: ListThingGroups
s@ListThingGroups' {} Maybe Text
a -> ListThingGroups
s {$sel:namePrefixFilter:ListThingGroups' :: Maybe Text
namePrefixFilter = Maybe Text
a} :: ListThingGroups)

-- | A filter that limits the results to those with the specified parent
-- group.
listThingGroups_parentGroup :: Lens.Lens' ListThingGroups (Prelude.Maybe Prelude.Text)
listThingGroups_parentGroup :: (Maybe Text -> f (Maybe Text))
-> ListThingGroups -> f ListThingGroups
listThingGroups_parentGroup = (ListThingGroups -> Maybe Text)
-> (ListThingGroups -> Maybe Text -> ListThingGroups)
-> Lens ListThingGroups ListThingGroups (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingGroups' {Maybe Text
parentGroup :: Maybe Text
$sel:parentGroup:ListThingGroups' :: ListThingGroups -> Maybe Text
parentGroup} -> Maybe Text
parentGroup) (\s :: ListThingGroups
s@ListThingGroups' {} Maybe Text
a -> ListThingGroups
s {$sel:parentGroup:ListThingGroups' :: Maybe Text
parentGroup = Maybe Text
a} :: ListThingGroups)

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

-- | If true, return child groups as well.
listThingGroups_recursive :: Lens.Lens' ListThingGroups (Prelude.Maybe Prelude.Bool)
listThingGroups_recursive :: (Maybe Bool -> f (Maybe Bool))
-> ListThingGroups -> f ListThingGroups
listThingGroups_recursive = (ListThingGroups -> Maybe Bool)
-> (ListThingGroups -> Maybe Bool -> ListThingGroups)
-> Lens ListThingGroups ListThingGroups (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingGroups' {Maybe Bool
recursive :: Maybe Bool
$sel:recursive:ListThingGroups' :: ListThingGroups -> Maybe Bool
recursive} -> Maybe Bool
recursive) (\s :: ListThingGroups
s@ListThingGroups' {} Maybe Bool
a -> ListThingGroups
s {$sel:recursive:ListThingGroups' :: Maybe Bool
recursive = Maybe Bool
a} :: ListThingGroups)

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

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

instance Prelude.NFData ListThingGroups

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

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

instance Core.ToQuery ListThingGroups where
  toQuery :: ListThingGroups -> QueryString
toQuery ListThingGroups' {Maybe Bool
Maybe Natural
Maybe Text
maxResults :: Maybe Natural
recursive :: Maybe Bool
nextToken :: Maybe Text
parentGroup :: Maybe Text
namePrefixFilter :: Maybe Text
$sel:maxResults:ListThingGroups' :: ListThingGroups -> Maybe Natural
$sel:recursive:ListThingGroups' :: ListThingGroups -> Maybe Bool
$sel:nextToken:ListThingGroups' :: ListThingGroups -> Maybe Text
$sel:parentGroup:ListThingGroups' :: ListThingGroups -> Maybe Text
$sel:namePrefixFilter:ListThingGroups' :: ListThingGroups -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"namePrefixFilter" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
namePrefixFilter,
        ByteString
"parentGroup" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
parentGroup,
        ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"recursive" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
recursive,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

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

-- |
-- Create a value of 'ListThingGroupsResponse' 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:
--
-- 'thingGroups', 'listThingGroupsResponse_thingGroups' - The thing groups.
--
-- 'nextToken', 'listThingGroupsResponse_nextToken' - The token to use to get the next set of results. Will not be returned if
-- operation has returned all results.
--
-- 'httpStatus', 'listThingGroupsResponse_httpStatus' - The response's http status code.
newListThingGroupsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListThingGroupsResponse
newListThingGroupsResponse :: Int -> ListThingGroupsResponse
newListThingGroupsResponse Int
pHttpStatus_ =
  ListThingGroupsResponse' :: Maybe [GroupNameAndArn]
-> Maybe Text -> Int -> ListThingGroupsResponse
ListThingGroupsResponse'
    { $sel:thingGroups:ListThingGroupsResponse' :: Maybe [GroupNameAndArn]
thingGroups =
        Maybe [GroupNameAndArn]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListThingGroupsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListThingGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The thing groups.
listThingGroupsResponse_thingGroups :: Lens.Lens' ListThingGroupsResponse (Prelude.Maybe [GroupNameAndArn])
listThingGroupsResponse_thingGroups :: (Maybe [GroupNameAndArn] -> f (Maybe [GroupNameAndArn]))
-> ListThingGroupsResponse -> f ListThingGroupsResponse
listThingGroupsResponse_thingGroups = (ListThingGroupsResponse -> Maybe [GroupNameAndArn])
-> (ListThingGroupsResponse
    -> Maybe [GroupNameAndArn] -> ListThingGroupsResponse)
-> Lens' ListThingGroupsResponse (Maybe [GroupNameAndArn])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingGroupsResponse' {Maybe [GroupNameAndArn]
thingGroups :: Maybe [GroupNameAndArn]
$sel:thingGroups:ListThingGroupsResponse' :: ListThingGroupsResponse -> Maybe [GroupNameAndArn]
thingGroups} -> Maybe [GroupNameAndArn]
thingGroups) (\s :: ListThingGroupsResponse
s@ListThingGroupsResponse' {} Maybe [GroupNameAndArn]
a -> ListThingGroupsResponse
s {$sel:thingGroups:ListThingGroupsResponse' :: Maybe [GroupNameAndArn]
thingGroups = Maybe [GroupNameAndArn]
a} :: ListThingGroupsResponse) ((Maybe [GroupNameAndArn] -> f (Maybe [GroupNameAndArn]))
 -> ListThingGroupsResponse -> f ListThingGroupsResponse)
-> ((Maybe [GroupNameAndArn] -> f (Maybe [GroupNameAndArn]))
    -> Maybe [GroupNameAndArn] -> f (Maybe [GroupNameAndArn]))
-> (Maybe [GroupNameAndArn] -> f (Maybe [GroupNameAndArn]))
-> ListThingGroupsResponse
-> f ListThingGroupsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [GroupNameAndArn]
  [GroupNameAndArn]
  [GroupNameAndArn]
  [GroupNameAndArn]
-> Iso
     (Maybe [GroupNameAndArn])
     (Maybe [GroupNameAndArn])
     (Maybe [GroupNameAndArn])
     (Maybe [GroupNameAndArn])
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
  [GroupNameAndArn]
  [GroupNameAndArn]
  [GroupNameAndArn]
  [GroupNameAndArn]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance Prelude.NFData ListThingGroupsResponse