{-# 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.ListThingPrincipals
-- 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 the principals associated with the specified thing. A principal
-- can be X.509 certificates, IAM users, groups, and roles, Amazon Cognito
-- identities or federated identities.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions ListThingPrincipals>
-- action.
--
-- This operation returns paginated results.
module Amazonka.IoT.ListThingPrincipals
  ( -- * Creating a Request
    ListThingPrincipals (..),
    newListThingPrincipals,

    -- * Request Lenses
    listThingPrincipals_nextToken,
    listThingPrincipals_maxResults,
    listThingPrincipals_thingName,

    -- * Destructuring the Response
    ListThingPrincipalsResponse (..),
    newListThingPrincipalsResponse,

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

-- |
-- Create a value of 'ListThingPrincipals' 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', 'listThingPrincipals_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', 'listThingPrincipals_maxResults' - The maximum number of results to return in this operation.
--
-- 'thingName', 'listThingPrincipals_thingName' - The name of the thing.
newListThingPrincipals ::
  -- | 'thingName'
  Prelude.Text ->
  ListThingPrincipals
newListThingPrincipals :: Text -> ListThingPrincipals
newListThingPrincipals Text
pThingName_ =
  ListThingPrincipals' :: Maybe Text -> Maybe Natural -> Text -> ListThingPrincipals
ListThingPrincipals'
    { $sel:nextToken:ListThingPrincipals' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListThingPrincipals' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:thingName:ListThingPrincipals' :: 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.
listThingPrincipals_nextToken :: Lens.Lens' ListThingPrincipals (Prelude.Maybe Prelude.Text)
listThingPrincipals_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListThingPrincipals -> f ListThingPrincipals
listThingPrincipals_nextToken = (ListThingPrincipals -> Maybe Text)
-> (ListThingPrincipals -> Maybe Text -> ListThingPrincipals)
-> Lens
     ListThingPrincipals ListThingPrincipals (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingPrincipals' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListThingPrincipals' :: ListThingPrincipals -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListThingPrincipals
s@ListThingPrincipals' {} Maybe Text
a -> ListThingPrincipals
s {$sel:nextToken:ListThingPrincipals' :: Maybe Text
nextToken = Maybe Text
a} :: ListThingPrincipals)

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

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

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

instance Prelude.NFData ListThingPrincipals

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

instance Core.ToPath ListThingPrincipals where
  toPath :: ListThingPrincipals -> ByteString
toPath ListThingPrincipals' {Maybe Natural
Maybe Text
Text
thingName :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:thingName:ListThingPrincipals' :: ListThingPrincipals -> Text
$sel:maxResults:ListThingPrincipals' :: ListThingPrincipals -> Maybe Natural
$sel:nextToken:ListThingPrincipals' :: ListThingPrincipals -> 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
"/principals"]

instance Core.ToQuery ListThingPrincipals where
  toQuery :: ListThingPrincipals -> QueryString
toQuery ListThingPrincipals' {Maybe Natural
Maybe Text
Text
thingName :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:thingName:ListThingPrincipals' :: ListThingPrincipals -> Text
$sel:maxResults:ListThingPrincipals' :: ListThingPrincipals -> Maybe Natural
$sel:nextToken:ListThingPrincipals' :: ListThingPrincipals -> 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
      ]

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

-- |
-- Create a value of 'ListThingPrincipalsResponse' 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:
--
-- 'principals', 'listThingPrincipalsResponse_principals' - The principals associated with the thing.
--
-- 'nextToken', 'listThingPrincipalsResponse_nextToken' - The token to use to get the next set of results, or __null__ if there
-- are no additional results.
--
-- 'httpStatus', 'listThingPrincipalsResponse_httpStatus' - The response's http status code.
newListThingPrincipalsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListThingPrincipalsResponse
newListThingPrincipalsResponse :: Int -> ListThingPrincipalsResponse
newListThingPrincipalsResponse Int
pHttpStatus_ =
  ListThingPrincipalsResponse' :: Maybe [Text] -> Maybe Text -> Int -> ListThingPrincipalsResponse
ListThingPrincipalsResponse'
    { $sel:principals:ListThingPrincipalsResponse' :: Maybe [Text]
principals =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListThingPrincipalsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListThingPrincipalsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The principals associated with the thing.
listThingPrincipalsResponse_principals :: Lens.Lens' ListThingPrincipalsResponse (Prelude.Maybe [Prelude.Text])
listThingPrincipalsResponse_principals :: (Maybe [Text] -> f (Maybe [Text]))
-> ListThingPrincipalsResponse -> f ListThingPrincipalsResponse
listThingPrincipalsResponse_principals = (ListThingPrincipalsResponse -> Maybe [Text])
-> (ListThingPrincipalsResponse
    -> Maybe [Text] -> ListThingPrincipalsResponse)
-> Lens' ListThingPrincipalsResponse (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingPrincipalsResponse' {Maybe [Text]
principals :: Maybe [Text]
$sel:principals:ListThingPrincipalsResponse' :: ListThingPrincipalsResponse -> Maybe [Text]
principals} -> Maybe [Text]
principals) (\s :: ListThingPrincipalsResponse
s@ListThingPrincipalsResponse' {} Maybe [Text]
a -> ListThingPrincipalsResponse
s {$sel:principals:ListThingPrincipalsResponse' :: Maybe [Text]
principals = Maybe [Text]
a} :: ListThingPrincipalsResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> ListThingPrincipalsResponse -> f ListThingPrincipalsResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ListThingPrincipalsResponse
-> f ListThingPrincipalsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
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.
listThingPrincipalsResponse_nextToken :: Lens.Lens' ListThingPrincipalsResponse (Prelude.Maybe Prelude.Text)
listThingPrincipalsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListThingPrincipalsResponse -> f ListThingPrincipalsResponse
listThingPrincipalsResponse_nextToken = (ListThingPrincipalsResponse -> Maybe Text)
-> (ListThingPrincipalsResponse
    -> Maybe Text -> ListThingPrincipalsResponse)
-> Lens' ListThingPrincipalsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingPrincipalsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListThingPrincipalsResponse' :: ListThingPrincipalsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListThingPrincipalsResponse
s@ListThingPrincipalsResponse' {} Maybe Text
a -> ListThingPrincipalsResponse
s {$sel:nextToken:ListThingPrincipalsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListThingPrincipalsResponse)

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

instance Prelude.NFData ListThingPrincipalsResponse