{-# 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.ListConstraintsForPortfolio
-- 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 constraints for the specified portfolio and product.
--
-- This operation returns paginated results.
module Amazonka.ServiceCatalog.ListConstraintsForPortfolio
  ( -- * Creating a Request
    ListConstraintsForPortfolio (..),
    newListConstraintsForPortfolio,

    -- * Request Lenses
    listConstraintsForPortfolio_acceptLanguage,
    listConstraintsForPortfolio_pageToken,
    listConstraintsForPortfolio_pageSize,
    listConstraintsForPortfolio_productId,
    listConstraintsForPortfolio_portfolioId,

    -- * Destructuring the Response
    ListConstraintsForPortfolioResponse (..),
    newListConstraintsForPortfolioResponse,

    -- * Response Lenses
    listConstraintsForPortfolioResponse_nextPageToken,
    listConstraintsForPortfolioResponse_constraintDetails,
    listConstraintsForPortfolioResponse_httpStatus,
  )
where

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

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

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

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

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

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

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

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

instance Core.AWSPager ListConstraintsForPortfolio where
  page :: ListConstraintsForPortfolio
-> AWSResponse ListConstraintsForPortfolio
-> Maybe ListConstraintsForPortfolio
page ListConstraintsForPortfolio
rq AWSResponse ListConstraintsForPortfolio
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListConstraintsForPortfolio
ListConstraintsForPortfolioResponse
rs
            ListConstraintsForPortfolioResponse
-> Getting (First Text) ListConstraintsForPortfolioResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListConstraintsForPortfolioResponse
-> Const (First Text) ListConstraintsForPortfolioResponse
Lens' ListConstraintsForPortfolioResponse (Maybe Text)
listConstraintsForPortfolioResponse_nextPageToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListConstraintsForPortfolioResponse
 -> Const (First Text) ListConstraintsForPortfolioResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListConstraintsForPortfolioResponse 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 ListConstraintsForPortfolio
forall a. Maybe a
Prelude.Nothing
    | Maybe [ConstraintDetail] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListConstraintsForPortfolio
ListConstraintsForPortfolioResponse
rs
            ListConstraintsForPortfolioResponse
-> Getting
     (First [ConstraintDetail])
     ListConstraintsForPortfolioResponse
     [ConstraintDetail]
-> Maybe [ConstraintDetail]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ConstraintDetail]
 -> Const (First [ConstraintDetail]) (Maybe [ConstraintDetail]))
-> ListConstraintsForPortfolioResponse
-> Const
     (First [ConstraintDetail]) ListConstraintsForPortfolioResponse
Lens'
  ListConstraintsForPortfolioResponse (Maybe [ConstraintDetail])
listConstraintsForPortfolioResponse_constraintDetails
              ((Maybe [ConstraintDetail]
  -> Const (First [ConstraintDetail]) (Maybe [ConstraintDetail]))
 -> ListConstraintsForPortfolioResponse
 -> Const
      (First [ConstraintDetail]) ListConstraintsForPortfolioResponse)
-> (([ConstraintDetail]
     -> Const (First [ConstraintDetail]) [ConstraintDetail])
    -> Maybe [ConstraintDetail]
    -> Const (First [ConstraintDetail]) (Maybe [ConstraintDetail]))
-> Getting
     (First [ConstraintDetail])
     ListConstraintsForPortfolioResponse
     [ConstraintDetail]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ConstraintDetail]
 -> Const (First [ConstraintDetail]) [ConstraintDetail])
-> Maybe [ConstraintDetail]
-> Const (First [ConstraintDetail]) (Maybe [ConstraintDetail])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListConstraintsForPortfolio
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListConstraintsForPortfolio -> Maybe ListConstraintsForPortfolio
forall a. a -> Maybe a
Prelude.Just (ListConstraintsForPortfolio -> Maybe ListConstraintsForPortfolio)
-> ListConstraintsForPortfolio -> Maybe ListConstraintsForPortfolio
forall a b. (a -> b) -> a -> b
Prelude.$
        ListConstraintsForPortfolio
rq
          ListConstraintsForPortfolio
-> (ListConstraintsForPortfolio -> ListConstraintsForPortfolio)
-> ListConstraintsForPortfolio
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListConstraintsForPortfolio
-> Identity ListConstraintsForPortfolio
Lens
  ListConstraintsForPortfolio
  ListConstraintsForPortfolio
  (Maybe Text)
  (Maybe Text)
listConstraintsForPortfolio_pageToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListConstraintsForPortfolio
 -> Identity ListConstraintsForPortfolio)
-> Maybe Text
-> ListConstraintsForPortfolio
-> ListConstraintsForPortfolio
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListConstraintsForPortfolio
ListConstraintsForPortfolioResponse
rs
          ListConstraintsForPortfolioResponse
-> Getting (First Text) ListConstraintsForPortfolioResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListConstraintsForPortfolioResponse
-> Const (First Text) ListConstraintsForPortfolioResponse
Lens' ListConstraintsForPortfolioResponse (Maybe Text)
listConstraintsForPortfolioResponse_nextPageToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListConstraintsForPortfolioResponse
 -> Const (First Text) ListConstraintsForPortfolioResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListConstraintsForPortfolioResponse 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 ListConstraintsForPortfolio where
  type
    AWSResponse ListConstraintsForPortfolio =
      ListConstraintsForPortfolioResponse
  request :: ListConstraintsForPortfolio -> Request ListConstraintsForPortfolio
request = Service
-> ListConstraintsForPortfolio
-> Request ListConstraintsForPortfolio
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListConstraintsForPortfolio
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListConstraintsForPortfolio)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListConstraintsForPortfolio))
-> Logger
-> Service
-> Proxy ListConstraintsForPortfolio
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListConstraintsForPortfolio)))
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 [ConstraintDetail]
-> Int
-> ListConstraintsForPortfolioResponse
ListConstraintsForPortfolioResponse'
            (Maybe Text
 -> Maybe [ConstraintDetail]
 -> Int
 -> ListConstraintsForPortfolioResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [ConstraintDetail]
      -> Int -> ListConstraintsForPortfolioResponse)
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
"NextPageToken")
            Either
  String
  (Maybe [ConstraintDetail]
   -> Int -> ListConstraintsForPortfolioResponse)
-> Either String (Maybe [ConstraintDetail])
-> Either String (Int -> ListConstraintsForPortfolioResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe (Maybe [ConstraintDetail]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ConstraintDetails"
                            Either String (Maybe (Maybe [ConstraintDetail]))
-> Maybe [ConstraintDetail]
-> Either String (Maybe [ConstraintDetail])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ConstraintDetail]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> ListConstraintsForPortfolioResponse)
-> Either String Int
-> Either String ListConstraintsForPortfolioResponse
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 ListConstraintsForPortfolio

instance Prelude.NFData ListConstraintsForPortfolio

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

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

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

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

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

-- |
-- Create a value of 'ListConstraintsForPortfolioResponse' 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', 'listConstraintsForPortfolioResponse_nextPageToken' - The page token to use to retrieve the next set of results. If there are
-- no additional results, this value is null.
--
-- 'constraintDetails', 'listConstraintsForPortfolioResponse_constraintDetails' - Information about the constraints.
--
-- 'httpStatus', 'listConstraintsForPortfolioResponse_httpStatus' - The response's http status code.
newListConstraintsForPortfolioResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListConstraintsForPortfolioResponse
newListConstraintsForPortfolioResponse :: Int -> ListConstraintsForPortfolioResponse
newListConstraintsForPortfolioResponse Int
pHttpStatus_ =
  ListConstraintsForPortfolioResponse' :: Maybe Text
-> Maybe [ConstraintDetail]
-> Int
-> ListConstraintsForPortfolioResponse
ListConstraintsForPortfolioResponse'
    { $sel:nextPageToken:ListConstraintsForPortfolioResponse' :: Maybe Text
nextPageToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:constraintDetails:ListConstraintsForPortfolioResponse' :: Maybe [ConstraintDetail]
constraintDetails = Maybe [ConstraintDetail]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListConstraintsForPortfolioResponse' :: 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.
listConstraintsForPortfolioResponse_nextPageToken :: Lens.Lens' ListConstraintsForPortfolioResponse (Prelude.Maybe Prelude.Text)
listConstraintsForPortfolioResponse_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> ListConstraintsForPortfolioResponse
-> f ListConstraintsForPortfolioResponse
listConstraintsForPortfolioResponse_nextPageToken = (ListConstraintsForPortfolioResponse -> Maybe Text)
-> (ListConstraintsForPortfolioResponse
    -> Maybe Text -> ListConstraintsForPortfolioResponse)
-> Lens' ListConstraintsForPortfolioResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConstraintsForPortfolioResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:ListConstraintsForPortfolioResponse' :: ListConstraintsForPortfolioResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: ListConstraintsForPortfolioResponse
s@ListConstraintsForPortfolioResponse' {} Maybe Text
a -> ListConstraintsForPortfolioResponse
s {$sel:nextPageToken:ListConstraintsForPortfolioResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: ListConstraintsForPortfolioResponse)

-- | Information about the constraints.
listConstraintsForPortfolioResponse_constraintDetails :: Lens.Lens' ListConstraintsForPortfolioResponse (Prelude.Maybe [ConstraintDetail])
listConstraintsForPortfolioResponse_constraintDetails :: (Maybe [ConstraintDetail] -> f (Maybe [ConstraintDetail]))
-> ListConstraintsForPortfolioResponse
-> f ListConstraintsForPortfolioResponse
listConstraintsForPortfolioResponse_constraintDetails = (ListConstraintsForPortfolioResponse -> Maybe [ConstraintDetail])
-> (ListConstraintsForPortfolioResponse
    -> Maybe [ConstraintDetail] -> ListConstraintsForPortfolioResponse)
-> Lens'
     ListConstraintsForPortfolioResponse (Maybe [ConstraintDetail])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConstraintsForPortfolioResponse' {Maybe [ConstraintDetail]
constraintDetails :: Maybe [ConstraintDetail]
$sel:constraintDetails:ListConstraintsForPortfolioResponse' :: ListConstraintsForPortfolioResponse -> Maybe [ConstraintDetail]
constraintDetails} -> Maybe [ConstraintDetail]
constraintDetails) (\s :: ListConstraintsForPortfolioResponse
s@ListConstraintsForPortfolioResponse' {} Maybe [ConstraintDetail]
a -> ListConstraintsForPortfolioResponse
s {$sel:constraintDetails:ListConstraintsForPortfolioResponse' :: Maybe [ConstraintDetail]
constraintDetails = Maybe [ConstraintDetail]
a} :: ListConstraintsForPortfolioResponse) ((Maybe [ConstraintDetail] -> f (Maybe [ConstraintDetail]))
 -> ListConstraintsForPortfolioResponse
 -> f ListConstraintsForPortfolioResponse)
-> ((Maybe [ConstraintDetail] -> f (Maybe [ConstraintDetail]))
    -> Maybe [ConstraintDetail] -> f (Maybe [ConstraintDetail]))
-> (Maybe [ConstraintDetail] -> f (Maybe [ConstraintDetail]))
-> ListConstraintsForPortfolioResponse
-> f ListConstraintsForPortfolioResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ConstraintDetail]
  [ConstraintDetail]
  [ConstraintDetail]
  [ConstraintDetail]
-> Iso
     (Maybe [ConstraintDetail])
     (Maybe [ConstraintDetail])
     (Maybe [ConstraintDetail])
     (Maybe [ConstraintDetail])
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
  [ConstraintDetail]
  [ConstraintDetail]
  [ConstraintDetail]
  [ConstraintDetail]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    ListConstraintsForPortfolioResponse