{-# 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.ServiceCatalog.ListPrincipalsForPortfolio
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists all @PrincipalARN@s and corresponding @PrincipalType@s associated
-- with the specified portfolio.
--
-- This operation returns paginated results.
module Amazonka.ServiceCatalog.ListPrincipalsForPortfolio
  ( -- * Creating a Request
    ListPrincipalsForPortfolio (..),
    newListPrincipalsForPortfolio,

    -- * Request Lenses
    listPrincipalsForPortfolio_acceptLanguage,
    listPrincipalsForPortfolio_pageSize,
    listPrincipalsForPortfolio_pageToken,
    listPrincipalsForPortfolio_portfolioId,

    -- * Destructuring the Response
    ListPrincipalsForPortfolioResponse (..),
    newListPrincipalsForPortfolioResponse,

    -- * Response Lenses
    listPrincipalsForPortfolioResponse_nextPageToken,
    listPrincipalsForPortfolioResponse_principals,
    listPrincipalsForPortfolioResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.ServiceCatalog.Types

-- | /See:/ 'newListPrincipalsForPortfolio' smart constructor.
data ListPrincipalsForPortfolio = ListPrincipalsForPortfolio'
  { -- | The language code.
    --
    -- -   @en@ - English (default)
    --
    -- -   @jp@ - Japanese
    --
    -- -   @zh@ - Chinese
    ListPrincipalsForPortfolio -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return with this call.
    ListPrincipalsForPortfolio -> Maybe Natural
pageSize :: Prelude.Maybe Prelude.Natural,
    -- | The page token for the next set of results. To retrieve the first set of
    -- results, use null.
    ListPrincipalsForPortfolio -> Maybe Text
pageToken :: Prelude.Maybe Prelude.Text,
    -- | The portfolio identifier.
    ListPrincipalsForPortfolio -> Text
portfolioId :: Prelude.Text
  }
  deriving (ListPrincipalsForPortfolio -> ListPrincipalsForPortfolio -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPrincipalsForPortfolio -> ListPrincipalsForPortfolio -> Bool
$c/= :: ListPrincipalsForPortfolio -> ListPrincipalsForPortfolio -> Bool
== :: ListPrincipalsForPortfolio -> ListPrincipalsForPortfolio -> Bool
$c== :: ListPrincipalsForPortfolio -> ListPrincipalsForPortfolio -> Bool
Prelude.Eq, ReadPrec [ListPrincipalsForPortfolio]
ReadPrec ListPrincipalsForPortfolio
Int -> ReadS ListPrincipalsForPortfolio
ReadS [ListPrincipalsForPortfolio]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPrincipalsForPortfolio]
$creadListPrec :: ReadPrec [ListPrincipalsForPortfolio]
readPrec :: ReadPrec ListPrincipalsForPortfolio
$creadPrec :: ReadPrec ListPrincipalsForPortfolio
readList :: ReadS [ListPrincipalsForPortfolio]
$creadList :: ReadS [ListPrincipalsForPortfolio]
readsPrec :: Int -> ReadS ListPrincipalsForPortfolio
$creadsPrec :: Int -> ReadS ListPrincipalsForPortfolio
Prelude.Read, Int -> ListPrincipalsForPortfolio -> ShowS
[ListPrincipalsForPortfolio] -> ShowS
ListPrincipalsForPortfolio -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPrincipalsForPortfolio] -> ShowS
$cshowList :: [ListPrincipalsForPortfolio] -> ShowS
show :: ListPrincipalsForPortfolio -> String
$cshow :: ListPrincipalsForPortfolio -> String
showsPrec :: Int -> ListPrincipalsForPortfolio -> ShowS
$cshowsPrec :: Int -> ListPrincipalsForPortfolio -> ShowS
Prelude.Show, forall x.
Rep ListPrincipalsForPortfolio x -> ListPrincipalsForPortfolio
forall x.
ListPrincipalsForPortfolio -> Rep ListPrincipalsForPortfolio x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPrincipalsForPortfolio x -> ListPrincipalsForPortfolio
$cfrom :: forall x.
ListPrincipalsForPortfolio -> Rep ListPrincipalsForPortfolio x
Prelude.Generic)

-- |
-- Create a value of 'ListPrincipalsForPortfolio' 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:
--
-- 'acceptLanguage', 'listPrincipalsForPortfolio_acceptLanguage' - The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
--
-- 'pageSize', 'listPrincipalsForPortfolio_pageSize' - The maximum number of items to return with this call.
--
-- 'pageToken', 'listPrincipalsForPortfolio_pageToken' - The page token for the next set of results. To retrieve the first set of
-- results, use null.
--
-- 'portfolioId', 'listPrincipalsForPortfolio_portfolioId' - The portfolio identifier.
newListPrincipalsForPortfolio ::
  -- | 'portfolioId'
  Prelude.Text ->
  ListPrincipalsForPortfolio
newListPrincipalsForPortfolio :: Text -> ListPrincipalsForPortfolio
newListPrincipalsForPortfolio Text
pPortfolioId_ =
  ListPrincipalsForPortfolio'
    { $sel:acceptLanguage:ListPrincipalsForPortfolio' :: Maybe Text
acceptLanguage =
        forall a. Maybe a
Prelude.Nothing,
      $sel:pageSize:ListPrincipalsForPortfolio' :: Maybe Natural
pageSize = forall a. Maybe a
Prelude.Nothing,
      $sel:pageToken:ListPrincipalsForPortfolio' :: Maybe Text
pageToken = forall a. Maybe a
Prelude.Nothing,
      $sel:portfolioId:ListPrincipalsForPortfolio' :: Text
portfolioId = Text
pPortfolioId_
    }

-- | The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
listPrincipalsForPortfolio_acceptLanguage :: Lens.Lens' ListPrincipalsForPortfolio (Prelude.Maybe Prelude.Text)
listPrincipalsForPortfolio_acceptLanguage :: Lens' ListPrincipalsForPortfolio (Maybe Text)
listPrincipalsForPortfolio_acceptLanguage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPrincipalsForPortfolio' {Maybe Text
acceptLanguage :: Maybe Text
$sel:acceptLanguage:ListPrincipalsForPortfolio' :: ListPrincipalsForPortfolio -> Maybe Text
acceptLanguage} -> Maybe Text
acceptLanguage) (\s :: ListPrincipalsForPortfolio
s@ListPrincipalsForPortfolio' {} Maybe Text
a -> ListPrincipalsForPortfolio
s {$sel:acceptLanguage:ListPrincipalsForPortfolio' :: Maybe Text
acceptLanguage = Maybe Text
a} :: ListPrincipalsForPortfolio)

-- | The maximum number of items to return with this call.
listPrincipalsForPortfolio_pageSize :: Lens.Lens' ListPrincipalsForPortfolio (Prelude.Maybe Prelude.Natural)
listPrincipalsForPortfolio_pageSize :: Lens' ListPrincipalsForPortfolio (Maybe Natural)
listPrincipalsForPortfolio_pageSize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPrincipalsForPortfolio' {Maybe Natural
pageSize :: Maybe Natural
$sel:pageSize:ListPrincipalsForPortfolio' :: ListPrincipalsForPortfolio -> Maybe Natural
pageSize} -> Maybe Natural
pageSize) (\s :: ListPrincipalsForPortfolio
s@ListPrincipalsForPortfolio' {} Maybe Natural
a -> ListPrincipalsForPortfolio
s {$sel:pageSize:ListPrincipalsForPortfolio' :: Maybe Natural
pageSize = Maybe Natural
a} :: ListPrincipalsForPortfolio)

-- | The page token for the next set of results. To retrieve the first set of
-- results, use null.
listPrincipalsForPortfolio_pageToken :: Lens.Lens' ListPrincipalsForPortfolio (Prelude.Maybe Prelude.Text)
listPrincipalsForPortfolio_pageToken :: Lens' ListPrincipalsForPortfolio (Maybe Text)
listPrincipalsForPortfolio_pageToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPrincipalsForPortfolio' {Maybe Text
pageToken :: Maybe Text
$sel:pageToken:ListPrincipalsForPortfolio' :: ListPrincipalsForPortfolio -> Maybe Text
pageToken} -> Maybe Text
pageToken) (\s :: ListPrincipalsForPortfolio
s@ListPrincipalsForPortfolio' {} Maybe Text
a -> ListPrincipalsForPortfolio
s {$sel:pageToken:ListPrincipalsForPortfolio' :: Maybe Text
pageToken = Maybe Text
a} :: ListPrincipalsForPortfolio)

-- | The portfolio identifier.
listPrincipalsForPortfolio_portfolioId :: Lens.Lens' ListPrincipalsForPortfolio Prelude.Text
listPrincipalsForPortfolio_portfolioId :: Lens' ListPrincipalsForPortfolio Text
listPrincipalsForPortfolio_portfolioId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPrincipalsForPortfolio' {Text
portfolioId :: Text
$sel:portfolioId:ListPrincipalsForPortfolio' :: ListPrincipalsForPortfolio -> Text
portfolioId} -> Text
portfolioId) (\s :: ListPrincipalsForPortfolio
s@ListPrincipalsForPortfolio' {} Text
a -> ListPrincipalsForPortfolio
s {$sel:portfolioId:ListPrincipalsForPortfolio' :: Text
portfolioId = Text
a} :: ListPrincipalsForPortfolio)

instance Core.AWSPager ListPrincipalsForPortfolio where
  page :: ListPrincipalsForPortfolio
-> AWSResponse ListPrincipalsForPortfolio
-> Maybe ListPrincipalsForPortfolio
page ListPrincipalsForPortfolio
rq AWSResponse ListPrincipalsForPortfolio
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListPrincipalsForPortfolio
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPrincipalsForPortfolioResponse (Maybe Text)
listPrincipalsForPortfolioResponse_nextPageToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListPrincipalsForPortfolio
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPrincipalsForPortfolioResponse (Maybe [Principal])
listPrincipalsForPortfolioResponse_principals
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListPrincipalsForPortfolio
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListPrincipalsForPortfolio (Maybe Text)
listPrincipalsForPortfolio_pageToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListPrincipalsForPortfolio
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPrincipalsForPortfolioResponse (Maybe Text)
listPrincipalsForPortfolioResponse_nextPageToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListPrincipalsForPortfolio where
  type
    AWSResponse ListPrincipalsForPortfolio =
      ListPrincipalsForPortfolioResponse
  request :: (Service -> Service)
-> ListPrincipalsForPortfolio -> Request ListPrincipalsForPortfolio
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListPrincipalsForPortfolio
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListPrincipalsForPortfolio)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [Principal] -> Int -> ListPrincipalsForPortfolioResponse
ListPrincipalsForPortfolioResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextPageToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Principals" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListPrincipalsForPortfolio where
  hashWithSalt :: Int -> ListPrincipalsForPortfolio -> Int
hashWithSalt Int
_salt ListPrincipalsForPortfolio' {Maybe Natural
Maybe Text
Text
portfolioId :: Text
pageToken :: Maybe Text
pageSize :: Maybe Natural
acceptLanguage :: Maybe Text
$sel:portfolioId:ListPrincipalsForPortfolio' :: ListPrincipalsForPortfolio -> Text
$sel:pageToken:ListPrincipalsForPortfolio' :: ListPrincipalsForPortfolio -> Maybe Text
$sel:pageSize:ListPrincipalsForPortfolio' :: ListPrincipalsForPortfolio -> Maybe Natural
$sel:acceptLanguage:ListPrincipalsForPortfolio' :: ListPrincipalsForPortfolio -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
acceptLanguage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
pageSize
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
pageToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
portfolioId

instance Prelude.NFData ListPrincipalsForPortfolio where
  rnf :: ListPrincipalsForPortfolio -> ()
rnf ListPrincipalsForPortfolio' {Maybe Natural
Maybe Text
Text
portfolioId :: Text
pageToken :: Maybe Text
pageSize :: Maybe Natural
acceptLanguage :: Maybe Text
$sel:portfolioId:ListPrincipalsForPortfolio' :: ListPrincipalsForPortfolio -> Text
$sel:pageToken:ListPrincipalsForPortfolio' :: ListPrincipalsForPortfolio -> Maybe Text
$sel:pageSize:ListPrincipalsForPortfolio' :: ListPrincipalsForPortfolio -> Maybe Natural
$sel:acceptLanguage:ListPrincipalsForPortfolio' :: ListPrincipalsForPortfolio -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
acceptLanguage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
pageSize
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
pageToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
portfolioId

instance Data.ToHeaders ListPrincipalsForPortfolio where
  toHeaders :: ListPrincipalsForPortfolio -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWS242ServiceCatalogService.ListPrincipalsForPortfolio" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON ListPrincipalsForPortfolio where
  toJSON :: ListPrincipalsForPortfolio -> Value
toJSON ListPrincipalsForPortfolio' {Maybe Natural
Maybe Text
Text
portfolioId :: Text
pageToken :: Maybe Text
pageSize :: Maybe Natural
acceptLanguage :: Maybe Text
$sel:portfolioId:ListPrincipalsForPortfolio' :: ListPrincipalsForPortfolio -> Text
$sel:pageToken:ListPrincipalsForPortfolio' :: ListPrincipalsForPortfolio -> Maybe Text
$sel:pageSize:ListPrincipalsForPortfolio' :: ListPrincipalsForPortfolio -> Maybe Natural
$sel:acceptLanguage:ListPrincipalsForPortfolio' :: ListPrincipalsForPortfolio -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AcceptLanguage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
acceptLanguage,
            (Key
"PageSize" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
pageSize,
            (Key
"PageToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
pageToken,
            forall a. a -> Maybe a
Prelude.Just (Key
"PortfolioId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
portfolioId)
          ]
      )

instance Data.ToPath ListPrincipalsForPortfolio where
  toPath :: ListPrincipalsForPortfolio -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery ListPrincipalsForPortfolio where
  toQuery :: ListPrincipalsForPortfolio -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newListPrincipalsForPortfolioResponse' smart constructor.
data ListPrincipalsForPortfolioResponse = ListPrincipalsForPortfolioResponse'
  { -- | The page token to use to retrieve the next set of results. If there are
    -- no additional results, this value is null.
    ListPrincipalsForPortfolioResponse -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | The @PrincipalARN@s and corresponding @PrincipalType@s associated with
    -- the portfolio.
    ListPrincipalsForPortfolioResponse -> Maybe [Principal]
principals :: Prelude.Maybe [Principal],
    -- | The response's http status code.
    ListPrincipalsForPortfolioResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListPrincipalsForPortfolioResponse
-> ListPrincipalsForPortfolioResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPrincipalsForPortfolioResponse
-> ListPrincipalsForPortfolioResponse -> Bool
$c/= :: ListPrincipalsForPortfolioResponse
-> ListPrincipalsForPortfolioResponse -> Bool
== :: ListPrincipalsForPortfolioResponse
-> ListPrincipalsForPortfolioResponse -> Bool
$c== :: ListPrincipalsForPortfolioResponse
-> ListPrincipalsForPortfolioResponse -> Bool
Prelude.Eq, ReadPrec [ListPrincipalsForPortfolioResponse]
ReadPrec ListPrincipalsForPortfolioResponse
Int -> ReadS ListPrincipalsForPortfolioResponse
ReadS [ListPrincipalsForPortfolioResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPrincipalsForPortfolioResponse]
$creadListPrec :: ReadPrec [ListPrincipalsForPortfolioResponse]
readPrec :: ReadPrec ListPrincipalsForPortfolioResponse
$creadPrec :: ReadPrec ListPrincipalsForPortfolioResponse
readList :: ReadS [ListPrincipalsForPortfolioResponse]
$creadList :: ReadS [ListPrincipalsForPortfolioResponse]
readsPrec :: Int -> ReadS ListPrincipalsForPortfolioResponse
$creadsPrec :: Int -> ReadS ListPrincipalsForPortfolioResponse
Prelude.Read, Int -> ListPrincipalsForPortfolioResponse -> ShowS
[ListPrincipalsForPortfolioResponse] -> ShowS
ListPrincipalsForPortfolioResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPrincipalsForPortfolioResponse] -> ShowS
$cshowList :: [ListPrincipalsForPortfolioResponse] -> ShowS
show :: ListPrincipalsForPortfolioResponse -> String
$cshow :: ListPrincipalsForPortfolioResponse -> String
showsPrec :: Int -> ListPrincipalsForPortfolioResponse -> ShowS
$cshowsPrec :: Int -> ListPrincipalsForPortfolioResponse -> ShowS
Prelude.Show, forall x.
Rep ListPrincipalsForPortfolioResponse x
-> ListPrincipalsForPortfolioResponse
forall x.
ListPrincipalsForPortfolioResponse
-> Rep ListPrincipalsForPortfolioResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPrincipalsForPortfolioResponse x
-> ListPrincipalsForPortfolioResponse
$cfrom :: forall x.
ListPrincipalsForPortfolioResponse
-> Rep ListPrincipalsForPortfolioResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListPrincipalsForPortfolioResponse' 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:
--
-- 'nextPageToken', 'listPrincipalsForPortfolioResponse_nextPageToken' - The page token to use to retrieve the next set of results. If there are
-- no additional results, this value is null.
--
-- 'principals', 'listPrincipalsForPortfolioResponse_principals' - The @PrincipalARN@s and corresponding @PrincipalType@s associated with
-- the portfolio.
--
-- 'httpStatus', 'listPrincipalsForPortfolioResponse_httpStatus' - The response's http status code.
newListPrincipalsForPortfolioResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListPrincipalsForPortfolioResponse
newListPrincipalsForPortfolioResponse :: Int -> ListPrincipalsForPortfolioResponse
newListPrincipalsForPortfolioResponse Int
pHttpStatus_ =
  ListPrincipalsForPortfolioResponse'
    { $sel:nextPageToken:ListPrincipalsForPortfolioResponse' :: Maybe Text
nextPageToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:principals:ListPrincipalsForPortfolioResponse' :: Maybe [Principal]
principals = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListPrincipalsForPortfolioResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The page token to use to retrieve the next set of results. If there are
-- no additional results, this value is null.
listPrincipalsForPortfolioResponse_nextPageToken :: Lens.Lens' ListPrincipalsForPortfolioResponse (Prelude.Maybe Prelude.Text)
listPrincipalsForPortfolioResponse_nextPageToken :: Lens' ListPrincipalsForPortfolioResponse (Maybe Text)
listPrincipalsForPortfolioResponse_nextPageToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPrincipalsForPortfolioResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:ListPrincipalsForPortfolioResponse' :: ListPrincipalsForPortfolioResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: ListPrincipalsForPortfolioResponse
s@ListPrincipalsForPortfolioResponse' {} Maybe Text
a -> ListPrincipalsForPortfolioResponse
s {$sel:nextPageToken:ListPrincipalsForPortfolioResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: ListPrincipalsForPortfolioResponse)

-- | The @PrincipalARN@s and corresponding @PrincipalType@s associated with
-- the portfolio.
listPrincipalsForPortfolioResponse_principals :: Lens.Lens' ListPrincipalsForPortfolioResponse (Prelude.Maybe [Principal])
listPrincipalsForPortfolioResponse_principals :: Lens' ListPrincipalsForPortfolioResponse (Maybe [Principal])
listPrincipalsForPortfolioResponse_principals = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPrincipalsForPortfolioResponse' {Maybe [Principal]
principals :: Maybe [Principal]
$sel:principals:ListPrincipalsForPortfolioResponse' :: ListPrincipalsForPortfolioResponse -> Maybe [Principal]
principals} -> Maybe [Principal]
principals) (\s :: ListPrincipalsForPortfolioResponse
s@ListPrincipalsForPortfolioResponse' {} Maybe [Principal]
a -> ListPrincipalsForPortfolioResponse
s {$sel:principals:ListPrincipalsForPortfolioResponse' :: Maybe [Principal]
principals = Maybe [Principal]
a} :: ListPrincipalsForPortfolioResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    ListPrincipalsForPortfolioResponse
  where
  rnf :: ListPrincipalsForPortfolioResponse -> ()
rnf ListPrincipalsForPortfolioResponse' {Int
Maybe [Principal]
Maybe Text
httpStatus :: Int
principals :: Maybe [Principal]
nextPageToken :: Maybe Text
$sel:httpStatus:ListPrincipalsForPortfolioResponse' :: ListPrincipalsForPortfolioResponse -> Int
$sel:principals:ListPrincipalsForPortfolioResponse' :: ListPrincipalsForPortfolioResponse -> Maybe [Principal]
$sel:nextPageToken:ListPrincipalsForPortfolioResponse' :: ListPrincipalsForPortfolioResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextPageToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Principal]
principals
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus