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

    -- * Request Lenses
    listThingGroupsForThing_nextToken,
    listThingGroupsForThing_maxResults,
    listThingGroupsForThing_thingName,

    -- * Destructuring the Response
    ListThingGroupsForThingResponse (..),
    newListThingGroupsForThingResponse,

    -- * Response Lenses
    listThingGroupsForThingResponse_thingGroups,
    listThingGroupsForThingResponse_nextToken,
    listThingGroupsForThingResponse_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:/ 'newListThingGroupsForThing' smart constructor.
data ListThingGroupsForThing = ListThingGroupsForThing'
  { -- | To retrieve the next set of results, the @nextToken@ value from a
    -- previous response; otherwise __null__ to receive the first set of
    -- results.
    ListThingGroupsForThing -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return at one time.
    ListThingGroupsForThing -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The thing name.
    ListThingGroupsForThing -> Text
thingName :: Prelude.Text
  }
  deriving (ListThingGroupsForThing -> ListThingGroupsForThing -> Bool
(ListThingGroupsForThing -> ListThingGroupsForThing -> Bool)
-> (ListThingGroupsForThing -> ListThingGroupsForThing -> Bool)
-> Eq ListThingGroupsForThing
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListThingGroupsForThing -> ListThingGroupsForThing -> Bool
$c/= :: ListThingGroupsForThing -> ListThingGroupsForThing -> Bool
== :: ListThingGroupsForThing -> ListThingGroupsForThing -> Bool
$c== :: ListThingGroupsForThing -> ListThingGroupsForThing -> Bool
Prelude.Eq, ReadPrec [ListThingGroupsForThing]
ReadPrec ListThingGroupsForThing
Int -> ReadS ListThingGroupsForThing
ReadS [ListThingGroupsForThing]
(Int -> ReadS ListThingGroupsForThing)
-> ReadS [ListThingGroupsForThing]
-> ReadPrec ListThingGroupsForThing
-> ReadPrec [ListThingGroupsForThing]
-> Read ListThingGroupsForThing
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListThingGroupsForThing]
$creadListPrec :: ReadPrec [ListThingGroupsForThing]
readPrec :: ReadPrec ListThingGroupsForThing
$creadPrec :: ReadPrec ListThingGroupsForThing
readList :: ReadS [ListThingGroupsForThing]
$creadList :: ReadS [ListThingGroupsForThing]
readsPrec :: Int -> ReadS ListThingGroupsForThing
$creadsPrec :: Int -> ReadS ListThingGroupsForThing
Prelude.Read, Int -> ListThingGroupsForThing -> ShowS
[ListThingGroupsForThing] -> ShowS
ListThingGroupsForThing -> String
(Int -> ListThingGroupsForThing -> ShowS)
-> (ListThingGroupsForThing -> String)
-> ([ListThingGroupsForThing] -> ShowS)
-> Show ListThingGroupsForThing
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListThingGroupsForThing] -> ShowS
$cshowList :: [ListThingGroupsForThing] -> ShowS
show :: ListThingGroupsForThing -> String
$cshow :: ListThingGroupsForThing -> String
showsPrec :: Int -> ListThingGroupsForThing -> ShowS
$cshowsPrec :: Int -> ListThingGroupsForThing -> ShowS
Prelude.Show, (forall x.
 ListThingGroupsForThing -> Rep ListThingGroupsForThing x)
-> (forall x.
    Rep ListThingGroupsForThing x -> ListThingGroupsForThing)
-> Generic ListThingGroupsForThing
forall x. Rep ListThingGroupsForThing x -> ListThingGroupsForThing
forall x. ListThingGroupsForThing -> Rep ListThingGroupsForThing x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListThingGroupsForThing x -> ListThingGroupsForThing
$cfrom :: forall x. ListThingGroupsForThing -> Rep ListThingGroupsForThing x
Prelude.Generic)

-- |
-- Create a value of 'ListThingGroupsForThing' 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', 'listThingGroupsForThing_nextToken' - To retrieve the next set of results, the @nextToken@ value from a
-- previous response; otherwise __null__ to receive the first set of
-- results.
--
-- 'maxResults', 'listThingGroupsForThing_maxResults' - The maximum number of results to return at one time.
--
-- 'thingName', 'listThingGroupsForThing_thingName' - The thing name.
newListThingGroupsForThing ::
  -- | 'thingName'
  Prelude.Text ->
  ListThingGroupsForThing
newListThingGroupsForThing :: Text -> ListThingGroupsForThing
newListThingGroupsForThing Text
pThingName_ =
  ListThingGroupsForThing' :: Maybe Text -> Maybe Natural -> Text -> ListThingGroupsForThing
ListThingGroupsForThing'
    { $sel:nextToken:ListThingGroupsForThing' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListThingGroupsForThing' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:thingName:ListThingGroupsForThing' :: Text
thingName = Text
pThingName_
    }

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

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

-- | The thing name.
listThingGroupsForThing_thingName :: Lens.Lens' ListThingGroupsForThing Prelude.Text
listThingGroupsForThing_thingName :: (Text -> f Text)
-> ListThingGroupsForThing -> f ListThingGroupsForThing
listThingGroupsForThing_thingName = (ListThingGroupsForThing -> Text)
-> (ListThingGroupsForThing -> Text -> ListThingGroupsForThing)
-> Lens ListThingGroupsForThing ListThingGroupsForThing Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingGroupsForThing' {Text
thingName :: Text
$sel:thingName:ListThingGroupsForThing' :: ListThingGroupsForThing -> Text
thingName} -> Text
thingName) (\s :: ListThingGroupsForThing
s@ListThingGroupsForThing' {} Text
a -> ListThingGroupsForThing
s {$sel:thingName:ListThingGroupsForThing' :: Text
thingName = Text
a} :: ListThingGroupsForThing)

instance Core.AWSPager ListThingGroupsForThing where
  page :: ListThingGroupsForThing
-> AWSResponse ListThingGroupsForThing
-> Maybe ListThingGroupsForThing
page ListThingGroupsForThing
rq AWSResponse ListThingGroupsForThing
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListThingGroupsForThing
ListThingGroupsForThingResponse
rs
            ListThingGroupsForThingResponse
-> Getting (First Text) ListThingGroupsForThingResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListThingGroupsForThingResponse
-> Const (First Text) ListThingGroupsForThingResponse
Lens' ListThingGroupsForThingResponse (Maybe Text)
listThingGroupsForThingResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListThingGroupsForThingResponse
 -> Const (First Text) ListThingGroupsForThingResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListThingGroupsForThingResponse 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 ListThingGroupsForThing
forall a. Maybe a
Prelude.Nothing
    | Maybe [GroupNameAndArn] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListThingGroupsForThing
ListThingGroupsForThingResponse
rs
            ListThingGroupsForThingResponse
-> Getting
     (First [GroupNameAndArn])
     ListThingGroupsForThingResponse
     [GroupNameAndArn]
-> Maybe [GroupNameAndArn]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [GroupNameAndArn]
 -> Const (First [GroupNameAndArn]) (Maybe [GroupNameAndArn]))
-> ListThingGroupsForThingResponse
-> Const (First [GroupNameAndArn]) ListThingGroupsForThingResponse
Lens' ListThingGroupsForThingResponse (Maybe [GroupNameAndArn])
listThingGroupsForThingResponse_thingGroups
              ((Maybe [GroupNameAndArn]
  -> Const (First [GroupNameAndArn]) (Maybe [GroupNameAndArn]))
 -> ListThingGroupsForThingResponse
 -> Const (First [GroupNameAndArn]) ListThingGroupsForThingResponse)
-> (([GroupNameAndArn]
     -> Const (First [GroupNameAndArn]) [GroupNameAndArn])
    -> Maybe [GroupNameAndArn]
    -> Const (First [GroupNameAndArn]) (Maybe [GroupNameAndArn]))
-> Getting
     (First [GroupNameAndArn])
     ListThingGroupsForThingResponse
     [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 ListThingGroupsForThing
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListThingGroupsForThing -> Maybe ListThingGroupsForThing
forall a. a -> Maybe a
Prelude.Just (ListThingGroupsForThing -> Maybe ListThingGroupsForThing)
-> ListThingGroupsForThing -> Maybe ListThingGroupsForThing
forall a b. (a -> b) -> a -> b
Prelude.$
        ListThingGroupsForThing
rq
          ListThingGroupsForThing
-> (ListThingGroupsForThing -> ListThingGroupsForThing)
-> ListThingGroupsForThing
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListThingGroupsForThing -> Identity ListThingGroupsForThing
Lens
  ListThingGroupsForThing
  ListThingGroupsForThing
  (Maybe Text)
  (Maybe Text)
listThingGroupsForThing_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListThingGroupsForThing -> Identity ListThingGroupsForThing)
-> Maybe Text -> ListThingGroupsForThing -> ListThingGroupsForThing
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListThingGroupsForThing
ListThingGroupsForThingResponse
rs
          ListThingGroupsForThingResponse
-> Getting (First Text) ListThingGroupsForThingResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListThingGroupsForThingResponse
-> Const (First Text) ListThingGroupsForThingResponse
Lens' ListThingGroupsForThingResponse (Maybe Text)
listThingGroupsForThingResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListThingGroupsForThingResponse
 -> Const (First Text) ListThingGroupsForThingResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListThingGroupsForThingResponse 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 ListThingGroupsForThing where
  type
    AWSResponse ListThingGroupsForThing =
      ListThingGroupsForThingResponse
  request :: ListThingGroupsForThing -> Request ListThingGroupsForThing
request = Service
-> ListThingGroupsForThing -> Request ListThingGroupsForThing
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListThingGroupsForThing
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListThingGroupsForThing)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListThingGroupsForThing))
-> Logger
-> Service
-> Proxy ListThingGroupsForThing
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListThingGroupsForThing)))
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 -> ListThingGroupsForThingResponse
ListThingGroupsForThingResponse'
            (Maybe [GroupNameAndArn]
 -> Maybe Text -> Int -> ListThingGroupsForThingResponse)
-> Either String (Maybe [GroupNameAndArn])
-> Either
     String (Maybe Text -> Int -> ListThingGroupsForThingResponse)
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 -> ListThingGroupsForThingResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListThingGroupsForThingResponse)
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 -> ListThingGroupsForThingResponse)
-> Either String Int
-> Either String ListThingGroupsForThingResponse
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 ListThingGroupsForThing

instance Prelude.NFData ListThingGroupsForThing

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

instance Core.ToPath ListThingGroupsForThing where
  toPath :: ListThingGroupsForThing -> ByteString
toPath ListThingGroupsForThing' {Maybe Natural
Maybe Text
Text
thingName :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:thingName:ListThingGroupsForThing' :: ListThingGroupsForThing -> Text
$sel:maxResults:ListThingGroupsForThing' :: ListThingGroupsForThing -> Maybe Natural
$sel:nextToken:ListThingGroupsForThing' :: ListThingGroupsForThing -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/things/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
thingName, ByteString
"/thing-groups"]

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

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

-- |
-- Create a value of 'ListThingGroupsForThingResponse' 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', 'listThingGroupsForThingResponse_thingGroups' - The thing groups.
--
-- 'nextToken', 'listThingGroupsForThingResponse_nextToken' - The token to use to get the next set of results, or __null__ if there
-- are no additional results.
--
-- 'httpStatus', 'listThingGroupsForThingResponse_httpStatus' - The response's http status code.
newListThingGroupsForThingResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListThingGroupsForThingResponse
newListThingGroupsForThingResponse :: Int -> ListThingGroupsForThingResponse
newListThingGroupsForThingResponse Int
pHttpStatus_ =
  ListThingGroupsForThingResponse' :: Maybe [GroupNameAndArn]
-> Maybe Text -> Int -> ListThingGroupsForThingResponse
ListThingGroupsForThingResponse'
    { $sel:thingGroups:ListThingGroupsForThingResponse' :: Maybe [GroupNameAndArn]
thingGroups =
        Maybe [GroupNameAndArn]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListThingGroupsForThingResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListThingGroupsForThingResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The thing groups.
listThingGroupsForThingResponse_thingGroups :: Lens.Lens' ListThingGroupsForThingResponse (Prelude.Maybe [GroupNameAndArn])
listThingGroupsForThingResponse_thingGroups :: (Maybe [GroupNameAndArn] -> f (Maybe [GroupNameAndArn]))
-> ListThingGroupsForThingResponse
-> f ListThingGroupsForThingResponse
listThingGroupsForThingResponse_thingGroups = (ListThingGroupsForThingResponse -> Maybe [GroupNameAndArn])
-> (ListThingGroupsForThingResponse
    -> Maybe [GroupNameAndArn] -> ListThingGroupsForThingResponse)
-> Lens' ListThingGroupsForThingResponse (Maybe [GroupNameAndArn])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingGroupsForThingResponse' {Maybe [GroupNameAndArn]
thingGroups :: Maybe [GroupNameAndArn]
$sel:thingGroups:ListThingGroupsForThingResponse' :: ListThingGroupsForThingResponse -> Maybe [GroupNameAndArn]
thingGroups} -> Maybe [GroupNameAndArn]
thingGroups) (\s :: ListThingGroupsForThingResponse
s@ListThingGroupsForThingResponse' {} Maybe [GroupNameAndArn]
a -> ListThingGroupsForThingResponse
s {$sel:thingGroups:ListThingGroupsForThingResponse' :: Maybe [GroupNameAndArn]
thingGroups = Maybe [GroupNameAndArn]
a} :: ListThingGroupsForThingResponse) ((Maybe [GroupNameAndArn] -> f (Maybe [GroupNameAndArn]))
 -> ListThingGroupsForThingResponse
 -> f ListThingGroupsForThingResponse)
-> ((Maybe [GroupNameAndArn] -> f (Maybe [GroupNameAndArn]))
    -> Maybe [GroupNameAndArn] -> f (Maybe [GroupNameAndArn]))
-> (Maybe [GroupNameAndArn] -> f (Maybe [GroupNameAndArn]))
-> ListThingGroupsForThingResponse
-> f ListThingGroupsForThingResponse
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, or __null__ if there
-- are no additional results.
listThingGroupsForThingResponse_nextToken :: Lens.Lens' ListThingGroupsForThingResponse (Prelude.Maybe Prelude.Text)
listThingGroupsForThingResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListThingGroupsForThingResponse
-> f ListThingGroupsForThingResponse
listThingGroupsForThingResponse_nextToken = (ListThingGroupsForThingResponse -> Maybe Text)
-> (ListThingGroupsForThingResponse
    -> Maybe Text -> ListThingGroupsForThingResponse)
-> Lens' ListThingGroupsForThingResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingGroupsForThingResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListThingGroupsForThingResponse' :: ListThingGroupsForThingResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListThingGroupsForThingResponse
s@ListThingGroupsForThingResponse' {} Maybe Text
a -> ListThingGroupsForThingResponse
s {$sel:nextToken:ListThingGroupsForThingResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListThingGroupsForThingResponse)

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

instance
  Prelude.NFData
    ListThingGroupsForThingResponse