{-# 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.ListProvisionedProductPlans
-- 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 plans for the specified provisioned product or all plans to
-- which the user has access.
--
-- This operation returns paginated results.
module Amazonka.ServiceCatalog.ListProvisionedProductPlans
  ( -- * Creating a Request
    ListProvisionedProductPlans (..),
    newListProvisionedProductPlans,

    -- * Request Lenses
    listProvisionedProductPlans_provisionProductId,
    listProvisionedProductPlans_acceptLanguage,
    listProvisionedProductPlans_accessLevelFilter,
    listProvisionedProductPlans_pageToken,
    listProvisionedProductPlans_pageSize,

    -- * Destructuring the Response
    ListProvisionedProductPlansResponse (..),
    newListProvisionedProductPlansResponse,

    -- * Response Lenses
    listProvisionedProductPlansResponse_nextPageToken,
    listProvisionedProductPlansResponse_provisionedProductPlans,
    listProvisionedProductPlansResponse_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:/ 'newListProvisionedProductPlans' smart constructor.
data ListProvisionedProductPlans = ListProvisionedProductPlans'
  { -- | The product identifier.
    ListProvisionedProductPlans -> Maybe Text
provisionProductId :: Prelude.Maybe Prelude.Text,
    -- | The language code.
    --
    -- -   @en@ - English (default)
    --
    -- -   @jp@ - Japanese
    --
    -- -   @zh@ - Chinese
    ListProvisionedProductPlans -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
    -- | The access level to use to obtain results. The default is @User@.
    ListProvisionedProductPlans -> Maybe AccessLevelFilter
accessLevelFilter :: Prelude.Maybe AccessLevelFilter,
    -- | The page token for the next set of results. To retrieve the first set of
    -- results, use null.
    ListProvisionedProductPlans -> Maybe Text
pageToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return with this call.
    ListProvisionedProductPlans -> Maybe Natural
pageSize :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListProvisionedProductPlans -> ListProvisionedProductPlans -> Bool
(ListProvisionedProductPlans
 -> ListProvisionedProductPlans -> Bool)
-> (ListProvisionedProductPlans
    -> ListProvisionedProductPlans -> Bool)
-> Eq ListProvisionedProductPlans
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProvisionedProductPlans -> ListProvisionedProductPlans -> Bool
$c/= :: ListProvisionedProductPlans -> ListProvisionedProductPlans -> Bool
== :: ListProvisionedProductPlans -> ListProvisionedProductPlans -> Bool
$c== :: ListProvisionedProductPlans -> ListProvisionedProductPlans -> Bool
Prelude.Eq, ReadPrec [ListProvisionedProductPlans]
ReadPrec ListProvisionedProductPlans
Int -> ReadS ListProvisionedProductPlans
ReadS [ListProvisionedProductPlans]
(Int -> ReadS ListProvisionedProductPlans)
-> ReadS [ListProvisionedProductPlans]
-> ReadPrec ListProvisionedProductPlans
-> ReadPrec [ListProvisionedProductPlans]
-> Read ListProvisionedProductPlans
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProvisionedProductPlans]
$creadListPrec :: ReadPrec [ListProvisionedProductPlans]
readPrec :: ReadPrec ListProvisionedProductPlans
$creadPrec :: ReadPrec ListProvisionedProductPlans
readList :: ReadS [ListProvisionedProductPlans]
$creadList :: ReadS [ListProvisionedProductPlans]
readsPrec :: Int -> ReadS ListProvisionedProductPlans
$creadsPrec :: Int -> ReadS ListProvisionedProductPlans
Prelude.Read, Int -> ListProvisionedProductPlans -> ShowS
[ListProvisionedProductPlans] -> ShowS
ListProvisionedProductPlans -> String
(Int -> ListProvisionedProductPlans -> ShowS)
-> (ListProvisionedProductPlans -> String)
-> ([ListProvisionedProductPlans] -> ShowS)
-> Show ListProvisionedProductPlans
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProvisionedProductPlans] -> ShowS
$cshowList :: [ListProvisionedProductPlans] -> ShowS
show :: ListProvisionedProductPlans -> String
$cshow :: ListProvisionedProductPlans -> String
showsPrec :: Int -> ListProvisionedProductPlans -> ShowS
$cshowsPrec :: Int -> ListProvisionedProductPlans -> ShowS
Prelude.Show, (forall x.
 ListProvisionedProductPlans -> Rep ListProvisionedProductPlans x)
-> (forall x.
    Rep ListProvisionedProductPlans x -> ListProvisionedProductPlans)
-> Generic ListProvisionedProductPlans
forall x.
Rep ListProvisionedProductPlans x -> ListProvisionedProductPlans
forall x.
ListProvisionedProductPlans -> Rep ListProvisionedProductPlans x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListProvisionedProductPlans x -> ListProvisionedProductPlans
$cfrom :: forall x.
ListProvisionedProductPlans -> Rep ListProvisionedProductPlans x
Prelude.Generic)

-- |
-- Create a value of 'ListProvisionedProductPlans' 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:
--
-- 'provisionProductId', 'listProvisionedProductPlans_provisionProductId' - The product identifier.
--
-- 'acceptLanguage', 'listProvisionedProductPlans_acceptLanguage' - The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
--
-- 'accessLevelFilter', 'listProvisionedProductPlans_accessLevelFilter' - The access level to use to obtain results. The default is @User@.
--
-- 'pageToken', 'listProvisionedProductPlans_pageToken' - The page token for the next set of results. To retrieve the first set of
-- results, use null.
--
-- 'pageSize', 'listProvisionedProductPlans_pageSize' - The maximum number of items to return with this call.
newListProvisionedProductPlans ::
  ListProvisionedProductPlans
newListProvisionedProductPlans :: ListProvisionedProductPlans
newListProvisionedProductPlans =
  ListProvisionedProductPlans' :: Maybe Text
-> Maybe Text
-> Maybe AccessLevelFilter
-> Maybe Text
-> Maybe Natural
-> ListProvisionedProductPlans
ListProvisionedProductPlans'
    { $sel:provisionProductId:ListProvisionedProductPlans' :: Maybe Text
provisionProductId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:acceptLanguage:ListProvisionedProductPlans' :: Maybe Text
acceptLanguage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:accessLevelFilter:ListProvisionedProductPlans' :: Maybe AccessLevelFilter
accessLevelFilter = Maybe AccessLevelFilter
forall a. Maybe a
Prelude.Nothing,
      $sel:pageToken:ListProvisionedProductPlans' :: Maybe Text
pageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:pageSize:ListProvisionedProductPlans' :: Maybe Natural
pageSize = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

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

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

-- | The access level to use to obtain results. The default is @User@.
listProvisionedProductPlans_accessLevelFilter :: Lens.Lens' ListProvisionedProductPlans (Prelude.Maybe AccessLevelFilter)
listProvisionedProductPlans_accessLevelFilter :: (Maybe AccessLevelFilter -> f (Maybe AccessLevelFilter))
-> ListProvisionedProductPlans -> f ListProvisionedProductPlans
listProvisionedProductPlans_accessLevelFilter = (ListProvisionedProductPlans -> Maybe AccessLevelFilter)
-> (ListProvisionedProductPlans
    -> Maybe AccessLevelFilter -> ListProvisionedProductPlans)
-> Lens
     ListProvisionedProductPlans
     ListProvisionedProductPlans
     (Maybe AccessLevelFilter)
     (Maybe AccessLevelFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProvisionedProductPlans' {Maybe AccessLevelFilter
accessLevelFilter :: Maybe AccessLevelFilter
$sel:accessLevelFilter:ListProvisionedProductPlans' :: ListProvisionedProductPlans -> Maybe AccessLevelFilter
accessLevelFilter} -> Maybe AccessLevelFilter
accessLevelFilter) (\s :: ListProvisionedProductPlans
s@ListProvisionedProductPlans' {} Maybe AccessLevelFilter
a -> ListProvisionedProductPlans
s {$sel:accessLevelFilter:ListProvisionedProductPlans' :: Maybe AccessLevelFilter
accessLevelFilter = Maybe AccessLevelFilter
a} :: ListProvisionedProductPlans)

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

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

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

instance Prelude.NFData ListProvisionedProductPlans

instance Core.ToHeaders ListProvisionedProductPlans where
  toHeaders :: ListProvisionedProductPlans -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListProvisionedProductPlans -> 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.ListProvisionedProductPlans" ::
                          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 ListProvisionedProductPlans where
  toJSON :: ListProvisionedProductPlans -> Value
toJSON ListProvisionedProductPlans' {Maybe Natural
Maybe Text
Maybe AccessLevelFilter
pageSize :: Maybe Natural
pageToken :: Maybe Text
accessLevelFilter :: Maybe AccessLevelFilter
acceptLanguage :: Maybe Text
provisionProductId :: Maybe Text
$sel:pageSize:ListProvisionedProductPlans' :: ListProvisionedProductPlans -> Maybe Natural
$sel:pageToken:ListProvisionedProductPlans' :: ListProvisionedProductPlans -> Maybe Text
$sel:accessLevelFilter:ListProvisionedProductPlans' :: ListProvisionedProductPlans -> Maybe AccessLevelFilter
$sel:acceptLanguage:ListProvisionedProductPlans' :: ListProvisionedProductPlans -> Maybe Text
$sel:provisionProductId:ListProvisionedProductPlans' :: ListProvisionedProductPlans -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ProvisionProductId" 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
provisionProductId,
            (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
"AccessLevelFilter" Text -> AccessLevelFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AccessLevelFilter -> Pair)
-> Maybe AccessLevelFilter -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AccessLevelFilter
accessLevelFilter,
            (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
          ]
      )

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

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

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

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

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

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

instance
  Prelude.NFData
    ListProvisionedProductPlansResponse