{-# 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.ListPrincipalThings
-- 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 things associated with the specified principal. 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 ListPrincipalThings>
-- action.
--
-- This operation returns paginated results.
module Amazonka.IoT.ListPrincipalThings
  ( -- * Creating a Request
    ListPrincipalThings (..),
    newListPrincipalThings,

    -- * Request Lenses
    listPrincipalThings_nextToken,
    listPrincipalThings_maxResults,
    listPrincipalThings_principal,

    -- * Destructuring the Response
    ListPrincipalThingsResponse (..),
    newListPrincipalThingsResponse,

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

-- |
-- Create a value of 'ListPrincipalThings' 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', 'listPrincipalThings_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', 'listPrincipalThings_maxResults' - The maximum number of results to return in this operation.
--
-- 'principal', 'listPrincipalThings_principal' - The principal.
newListPrincipalThings ::
  -- | 'principal'
  Prelude.Text ->
  ListPrincipalThings
newListPrincipalThings :: Text -> ListPrincipalThings
newListPrincipalThings Text
pPrincipal_ =
  ListPrincipalThings' :: Maybe Text -> Maybe Natural -> Text -> ListPrincipalThings
ListPrincipalThings'
    { $sel:nextToken:ListPrincipalThings' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListPrincipalThings' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:principal:ListPrincipalThings' :: Text
principal = Text
pPrincipal_
    }

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

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

-- | The principal.
listPrincipalThings_principal :: Lens.Lens' ListPrincipalThings Prelude.Text
listPrincipalThings_principal :: (Text -> f Text) -> ListPrincipalThings -> f ListPrincipalThings
listPrincipalThings_principal = (ListPrincipalThings -> Text)
-> (ListPrincipalThings -> Text -> ListPrincipalThings)
-> Lens ListPrincipalThings ListPrincipalThings Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPrincipalThings' {Text
principal :: Text
$sel:principal:ListPrincipalThings' :: ListPrincipalThings -> Text
principal} -> Text
principal) (\s :: ListPrincipalThings
s@ListPrincipalThings' {} Text
a -> ListPrincipalThings
s {$sel:principal:ListPrincipalThings' :: Text
principal = Text
a} :: ListPrincipalThings)

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

instance Prelude.NFData ListPrincipalThings

instance Core.ToHeaders ListPrincipalThings where
  toHeaders :: ListPrincipalThings -> ResponseHeaders
toHeaders ListPrincipalThings' {Maybe Natural
Maybe Text
Text
principal :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:principal:ListPrincipalThings' :: ListPrincipalThings -> Text
$sel:maxResults:ListPrincipalThings' :: ListPrincipalThings -> Maybe Natural
$sel:nextToken:ListPrincipalThings' :: ListPrincipalThings -> Maybe Text
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [HeaderName
"x-amzn-principal" HeaderName -> Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Text
principal]

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

instance Core.ToQuery ListPrincipalThings where
  toQuery :: ListPrincipalThings -> QueryString
toQuery ListPrincipalThings' {Maybe Natural
Maybe Text
Text
principal :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:principal:ListPrincipalThings' :: ListPrincipalThings -> Text
$sel:maxResults:ListPrincipalThings' :: ListPrincipalThings -> Maybe Natural
$sel:nextToken:ListPrincipalThings' :: ListPrincipalThings -> 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 ListPrincipalThings operation.
--
-- /See:/ 'newListPrincipalThingsResponse' smart constructor.
data ListPrincipalThingsResponse = ListPrincipalThingsResponse'
  { -- | The token to use to get the next set of results, or __null__ if there
    -- are no additional results.
    ListPrincipalThingsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The things.
    ListPrincipalThingsResponse -> Maybe [Text]
things :: Prelude.Maybe [Prelude.Text],
    -- | The response's http status code.
    ListPrincipalThingsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListPrincipalThingsResponse -> ListPrincipalThingsResponse -> Bool
(ListPrincipalThingsResponse
 -> ListPrincipalThingsResponse -> Bool)
-> (ListPrincipalThingsResponse
    -> ListPrincipalThingsResponse -> Bool)
-> Eq ListPrincipalThingsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPrincipalThingsResponse -> ListPrincipalThingsResponse -> Bool
$c/= :: ListPrincipalThingsResponse -> ListPrincipalThingsResponse -> Bool
== :: ListPrincipalThingsResponse -> ListPrincipalThingsResponse -> Bool
$c== :: ListPrincipalThingsResponse -> ListPrincipalThingsResponse -> Bool
Prelude.Eq, ReadPrec [ListPrincipalThingsResponse]
ReadPrec ListPrincipalThingsResponse
Int -> ReadS ListPrincipalThingsResponse
ReadS [ListPrincipalThingsResponse]
(Int -> ReadS ListPrincipalThingsResponse)
-> ReadS [ListPrincipalThingsResponse]
-> ReadPrec ListPrincipalThingsResponse
-> ReadPrec [ListPrincipalThingsResponse]
-> Read ListPrincipalThingsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPrincipalThingsResponse]
$creadListPrec :: ReadPrec [ListPrincipalThingsResponse]
readPrec :: ReadPrec ListPrincipalThingsResponse
$creadPrec :: ReadPrec ListPrincipalThingsResponse
readList :: ReadS [ListPrincipalThingsResponse]
$creadList :: ReadS [ListPrincipalThingsResponse]
readsPrec :: Int -> ReadS ListPrincipalThingsResponse
$creadsPrec :: Int -> ReadS ListPrincipalThingsResponse
Prelude.Read, Int -> ListPrincipalThingsResponse -> ShowS
[ListPrincipalThingsResponse] -> ShowS
ListPrincipalThingsResponse -> String
(Int -> ListPrincipalThingsResponse -> ShowS)
-> (ListPrincipalThingsResponse -> String)
-> ([ListPrincipalThingsResponse] -> ShowS)
-> Show ListPrincipalThingsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPrincipalThingsResponse] -> ShowS
$cshowList :: [ListPrincipalThingsResponse] -> ShowS
show :: ListPrincipalThingsResponse -> String
$cshow :: ListPrincipalThingsResponse -> String
showsPrec :: Int -> ListPrincipalThingsResponse -> ShowS
$cshowsPrec :: Int -> ListPrincipalThingsResponse -> ShowS
Prelude.Show, (forall x.
 ListPrincipalThingsResponse -> Rep ListPrincipalThingsResponse x)
-> (forall x.
    Rep ListPrincipalThingsResponse x -> ListPrincipalThingsResponse)
-> Generic ListPrincipalThingsResponse
forall x.
Rep ListPrincipalThingsResponse x -> ListPrincipalThingsResponse
forall x.
ListPrincipalThingsResponse -> Rep ListPrincipalThingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPrincipalThingsResponse x -> ListPrincipalThingsResponse
$cfrom :: forall x.
ListPrincipalThingsResponse -> Rep ListPrincipalThingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListPrincipalThingsResponse' 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', 'listPrincipalThingsResponse_nextToken' - The token to use to get the next set of results, or __null__ if there
-- are no additional results.
--
-- 'things', 'listPrincipalThingsResponse_things' - The things.
--
-- 'httpStatus', 'listPrincipalThingsResponse_httpStatus' - The response's http status code.
newListPrincipalThingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListPrincipalThingsResponse
newListPrincipalThingsResponse :: Int -> ListPrincipalThingsResponse
newListPrincipalThingsResponse Int
pHttpStatus_ =
  ListPrincipalThingsResponse' :: Maybe Text -> Maybe [Text] -> Int -> ListPrincipalThingsResponse
ListPrincipalThingsResponse'
    { $sel:nextToken:ListPrincipalThingsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:things:ListPrincipalThingsResponse' :: Maybe [Text]
things = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListPrincipalThingsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token to use to get the next set of results, or __null__ if there
-- are no additional results.
listPrincipalThingsResponse_nextToken :: Lens.Lens' ListPrincipalThingsResponse (Prelude.Maybe Prelude.Text)
listPrincipalThingsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListPrincipalThingsResponse -> f ListPrincipalThingsResponse
listPrincipalThingsResponse_nextToken = (ListPrincipalThingsResponse -> Maybe Text)
-> (ListPrincipalThingsResponse
    -> Maybe Text -> ListPrincipalThingsResponse)
-> Lens' ListPrincipalThingsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPrincipalThingsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPrincipalThingsResponse' :: ListPrincipalThingsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPrincipalThingsResponse
s@ListPrincipalThingsResponse' {} Maybe Text
a -> ListPrincipalThingsResponse
s {$sel:nextToken:ListPrincipalThingsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListPrincipalThingsResponse)

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

instance Prelude.NFData ListPrincipalThingsResponse