{-# 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.ListPortfoliosForProduct
-- 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 portfolios that the specified product is associated with.
--
-- This operation returns paginated results.
module Amazonka.ServiceCatalog.ListPortfoliosForProduct
  ( -- * Creating a Request
    ListPortfoliosForProduct (..),
    newListPortfoliosForProduct,

    -- * Request Lenses
    listPortfoliosForProduct_acceptLanguage,
    listPortfoliosForProduct_pageSize,
    listPortfoliosForProduct_pageToken,
    listPortfoliosForProduct_productId,

    -- * Destructuring the Response
    ListPortfoliosForProductResponse (..),
    newListPortfoliosForProductResponse,

    -- * Response Lenses
    listPortfoliosForProductResponse_nextPageToken,
    listPortfoliosForProductResponse_portfolioDetails,
    listPortfoliosForProductResponse_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:/ 'newListPortfoliosForProduct' smart constructor.
data ListPortfoliosForProduct = ListPortfoliosForProduct'
  { -- | The language code.
    --
    -- -   @en@ - English (default)
    --
    -- -   @jp@ - Japanese
    --
    -- -   @zh@ - Chinese
    ListPortfoliosForProduct -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return with this call.
    ListPortfoliosForProduct -> 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.
    ListPortfoliosForProduct -> Maybe Text
pageToken :: Prelude.Maybe Prelude.Text,
    -- | The product identifier.
    ListPortfoliosForProduct -> Text
productId :: Prelude.Text
  }
  deriving (ListPortfoliosForProduct -> ListPortfoliosForProduct -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPortfoliosForProduct -> ListPortfoliosForProduct -> Bool
$c/= :: ListPortfoliosForProduct -> ListPortfoliosForProduct -> Bool
== :: ListPortfoliosForProduct -> ListPortfoliosForProduct -> Bool
$c== :: ListPortfoliosForProduct -> ListPortfoliosForProduct -> Bool
Prelude.Eq, ReadPrec [ListPortfoliosForProduct]
ReadPrec ListPortfoliosForProduct
Int -> ReadS ListPortfoliosForProduct
ReadS [ListPortfoliosForProduct]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPortfoliosForProduct]
$creadListPrec :: ReadPrec [ListPortfoliosForProduct]
readPrec :: ReadPrec ListPortfoliosForProduct
$creadPrec :: ReadPrec ListPortfoliosForProduct
readList :: ReadS [ListPortfoliosForProduct]
$creadList :: ReadS [ListPortfoliosForProduct]
readsPrec :: Int -> ReadS ListPortfoliosForProduct
$creadsPrec :: Int -> ReadS ListPortfoliosForProduct
Prelude.Read, Int -> ListPortfoliosForProduct -> ShowS
[ListPortfoliosForProduct] -> ShowS
ListPortfoliosForProduct -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPortfoliosForProduct] -> ShowS
$cshowList :: [ListPortfoliosForProduct] -> ShowS
show :: ListPortfoliosForProduct -> String
$cshow :: ListPortfoliosForProduct -> String
showsPrec :: Int -> ListPortfoliosForProduct -> ShowS
$cshowsPrec :: Int -> ListPortfoliosForProduct -> ShowS
Prelude.Show, forall x.
Rep ListPortfoliosForProduct x -> ListPortfoliosForProduct
forall x.
ListPortfoliosForProduct -> Rep ListPortfoliosForProduct x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPortfoliosForProduct x -> ListPortfoliosForProduct
$cfrom :: forall x.
ListPortfoliosForProduct -> Rep ListPortfoliosForProduct x
Prelude.Generic)

-- |
-- Create a value of 'ListPortfoliosForProduct' 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', 'listPortfoliosForProduct_acceptLanguage' - The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
--
-- 'pageSize', 'listPortfoliosForProduct_pageSize' - The maximum number of items to return with this call.
--
-- 'pageToken', 'listPortfoliosForProduct_pageToken' - The page token for the next set of results. To retrieve the first set of
-- results, use null.
--
-- 'productId', 'listPortfoliosForProduct_productId' - The product identifier.
newListPortfoliosForProduct ::
  -- | 'productId'
  Prelude.Text ->
  ListPortfoliosForProduct
newListPortfoliosForProduct :: Text -> ListPortfoliosForProduct
newListPortfoliosForProduct Text
pProductId_ =
  ListPortfoliosForProduct'
    { $sel:acceptLanguage:ListPortfoliosForProduct' :: Maybe Text
acceptLanguage =
        forall a. Maybe a
Prelude.Nothing,
      $sel:pageSize:ListPortfoliosForProduct' :: Maybe Natural
pageSize = forall a. Maybe a
Prelude.Nothing,
      $sel:pageToken:ListPortfoliosForProduct' :: Maybe Text
pageToken = forall a. Maybe a
Prelude.Nothing,
      $sel:productId:ListPortfoliosForProduct' :: Text
productId = Text
pProductId_
    }

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

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

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

-- | The product identifier.
listPortfoliosForProduct_productId :: Lens.Lens' ListPortfoliosForProduct Prelude.Text
listPortfoliosForProduct_productId :: Lens' ListPortfoliosForProduct Text
listPortfoliosForProduct_productId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPortfoliosForProduct' {Text
productId :: Text
$sel:productId:ListPortfoliosForProduct' :: ListPortfoliosForProduct -> Text
productId} -> Text
productId) (\s :: ListPortfoliosForProduct
s@ListPortfoliosForProduct' {} Text
a -> ListPortfoliosForProduct
s {$sel:productId:ListPortfoliosForProduct' :: Text
productId = Text
a} :: ListPortfoliosForProduct)

instance Core.AWSPager ListPortfoliosForProduct where
  page :: ListPortfoliosForProduct
-> AWSResponse ListPortfoliosForProduct
-> Maybe ListPortfoliosForProduct
page ListPortfoliosForProduct
rq AWSResponse ListPortfoliosForProduct
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListPortfoliosForProduct
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPortfoliosForProductResponse (Maybe Text)
listPortfoliosForProductResponse_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 ListPortfoliosForProduct
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPortfoliosForProductResponse (Maybe [PortfolioDetail])
listPortfoliosForProductResponse_portfolioDetails
            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.$ ListPortfoliosForProduct
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListPortfoliosForProduct (Maybe Text)
listPortfoliosForProduct_pageToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListPortfoliosForProduct
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPortfoliosForProductResponse (Maybe Text)
listPortfoliosForProductResponse_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 ListPortfoliosForProduct where
  type
    AWSResponse ListPortfoliosForProduct =
      ListPortfoliosForProductResponse
  request :: (Service -> Service)
-> ListPortfoliosForProduct -> Request ListPortfoliosForProduct
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 ListPortfoliosForProduct
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListPortfoliosForProduct)))
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 [PortfolioDetail]
-> Int
-> ListPortfoliosForProductResponse
ListPortfoliosForProductResponse'
            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
"PortfolioDetails"
                            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 ListPortfoliosForProduct where
  hashWithSalt :: Int -> ListPortfoliosForProduct -> Int
hashWithSalt Int
_salt ListPortfoliosForProduct' {Maybe Natural
Maybe Text
Text
productId :: Text
pageToken :: Maybe Text
pageSize :: Maybe Natural
acceptLanguage :: Maybe Text
$sel:productId:ListPortfoliosForProduct' :: ListPortfoliosForProduct -> Text
$sel:pageToken:ListPortfoliosForProduct' :: ListPortfoliosForProduct -> Maybe Text
$sel:pageSize:ListPortfoliosForProduct' :: ListPortfoliosForProduct -> Maybe Natural
$sel:acceptLanguage:ListPortfoliosForProduct' :: ListPortfoliosForProduct -> 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
productId

instance Prelude.NFData ListPortfoliosForProduct where
  rnf :: ListPortfoliosForProduct -> ()
rnf ListPortfoliosForProduct' {Maybe Natural
Maybe Text
Text
productId :: Text
pageToken :: Maybe Text
pageSize :: Maybe Natural
acceptLanguage :: Maybe Text
$sel:productId:ListPortfoliosForProduct' :: ListPortfoliosForProduct -> Text
$sel:pageToken:ListPortfoliosForProduct' :: ListPortfoliosForProduct -> Maybe Text
$sel:pageSize:ListPortfoliosForProduct' :: ListPortfoliosForProduct -> Maybe Natural
$sel:acceptLanguage:ListPortfoliosForProduct' :: ListPortfoliosForProduct -> 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
productId

instance Data.ToHeaders ListPortfoliosForProduct where
  toHeaders :: ListPortfoliosForProduct -> 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.ListPortfoliosForProduct" ::
                          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 ListPortfoliosForProduct where
  toJSON :: ListPortfoliosForProduct -> Value
toJSON ListPortfoliosForProduct' {Maybe Natural
Maybe Text
Text
productId :: Text
pageToken :: Maybe Text
pageSize :: Maybe Natural
acceptLanguage :: Maybe Text
$sel:productId:ListPortfoliosForProduct' :: ListPortfoliosForProduct -> Text
$sel:pageToken:ListPortfoliosForProduct' :: ListPortfoliosForProduct -> Maybe Text
$sel:pageSize:ListPortfoliosForProduct' :: ListPortfoliosForProduct -> Maybe Natural
$sel:acceptLanguage:ListPortfoliosForProduct' :: ListPortfoliosForProduct -> 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
"ProductId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
productId)
          ]
      )

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

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

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

-- |
-- Create a value of 'ListPortfoliosForProductResponse' 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', 'listPortfoliosForProductResponse_nextPageToken' - The page token to use to retrieve the next set of results. If there are
-- no additional results, this value is null.
--
-- 'portfolioDetails', 'listPortfoliosForProductResponse_portfolioDetails' - Information about the portfolios.
--
-- 'httpStatus', 'listPortfoliosForProductResponse_httpStatus' - The response's http status code.
newListPortfoliosForProductResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListPortfoliosForProductResponse
newListPortfoliosForProductResponse :: Int -> ListPortfoliosForProductResponse
newListPortfoliosForProductResponse Int
pHttpStatus_ =
  ListPortfoliosForProductResponse'
    { $sel:nextPageToken:ListPortfoliosForProductResponse' :: Maybe Text
nextPageToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:portfolioDetails:ListPortfoliosForProductResponse' :: Maybe [PortfolioDetail]
portfolioDetails = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListPortfoliosForProductResponse' :: 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.
listPortfoliosForProductResponse_nextPageToken :: Lens.Lens' ListPortfoliosForProductResponse (Prelude.Maybe Prelude.Text)
listPortfoliosForProductResponse_nextPageToken :: Lens' ListPortfoliosForProductResponse (Maybe Text)
listPortfoliosForProductResponse_nextPageToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPortfoliosForProductResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:ListPortfoliosForProductResponse' :: ListPortfoliosForProductResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: ListPortfoliosForProductResponse
s@ListPortfoliosForProductResponse' {} Maybe Text
a -> ListPortfoliosForProductResponse
s {$sel:nextPageToken:ListPortfoliosForProductResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: ListPortfoliosForProductResponse)

-- | Information about the portfolios.
listPortfoliosForProductResponse_portfolioDetails :: Lens.Lens' ListPortfoliosForProductResponse (Prelude.Maybe [PortfolioDetail])
listPortfoliosForProductResponse_portfolioDetails :: Lens' ListPortfoliosForProductResponse (Maybe [PortfolioDetail])
listPortfoliosForProductResponse_portfolioDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPortfoliosForProductResponse' {Maybe [PortfolioDetail]
portfolioDetails :: Maybe [PortfolioDetail]
$sel:portfolioDetails:ListPortfoliosForProductResponse' :: ListPortfoliosForProductResponse -> Maybe [PortfolioDetail]
portfolioDetails} -> Maybe [PortfolioDetail]
portfolioDetails) (\s :: ListPortfoliosForProductResponse
s@ListPortfoliosForProductResponse' {} Maybe [PortfolioDetail]
a -> ListPortfoliosForProductResponse
s {$sel:portfolioDetails:ListPortfoliosForProductResponse' :: Maybe [PortfolioDetail]
portfolioDetails = Maybe [PortfolioDetail]
a} :: ListPortfoliosForProductResponse) 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.
listPortfoliosForProductResponse_httpStatus :: Lens.Lens' ListPortfoliosForProductResponse Prelude.Int
listPortfoliosForProductResponse_httpStatus :: Lens' ListPortfoliosForProductResponse Int
listPortfoliosForProductResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPortfoliosForProductResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListPortfoliosForProductResponse' :: ListPortfoliosForProductResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListPortfoliosForProductResponse
s@ListPortfoliosForProductResponse' {} Int
a -> ListPortfoliosForProductResponse
s {$sel:httpStatus:ListPortfoliosForProductResponse' :: Int
httpStatus = Int
a} :: ListPortfoliosForProductResponse)

instance
  Prelude.NFData
    ListPortfoliosForProductResponse
  where
  rnf :: ListPortfoliosForProductResponse -> ()
rnf ListPortfoliosForProductResponse' {Int
Maybe [PortfolioDetail]
Maybe Text
httpStatus :: Int
portfolioDetails :: Maybe [PortfolioDetail]
nextPageToken :: Maybe Text
$sel:httpStatus:ListPortfoliosForProductResponse' :: ListPortfoliosForProductResponse -> Int
$sel:portfolioDetails:ListPortfoliosForProductResponse' :: ListPortfoliosForProductResponse -> Maybe [PortfolioDetail]
$sel:nextPageToken:ListPortfoliosForProductResponse' :: ListPortfoliosForProductResponse -> 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 [PortfolioDetail]
portfolioDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus