{-# 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.SearchProvisionedProducts
-- 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)
--
-- Gets information about the provisioned products that meet the specified
-- criteria.
module Amazonka.ServiceCatalog.SearchProvisionedProducts
  ( -- * Creating a Request
    SearchProvisionedProducts (..),
    newSearchProvisionedProducts,

    -- * Request Lenses
    searchProvisionedProducts_filters,
    searchProvisionedProducts_sortOrder,
    searchProvisionedProducts_acceptLanguage,
    searchProvisionedProducts_accessLevelFilter,
    searchProvisionedProducts_pageToken,
    searchProvisionedProducts_pageSize,
    searchProvisionedProducts_sortBy,

    -- * Destructuring the Response
    SearchProvisionedProductsResponse (..),
    newSearchProvisionedProductsResponse,

    -- * Response Lenses
    searchProvisionedProductsResponse_nextPageToken,
    searchProvisionedProductsResponse_provisionedProducts,
    searchProvisionedProductsResponse_totalResultsCount,
    searchProvisionedProductsResponse_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:/ 'newSearchProvisionedProducts' smart constructor.
data SearchProvisionedProducts = SearchProvisionedProducts'
  { -- | The search filters.
    --
    -- When the key is @SearchQuery@, the searchable fields are @arn@,
    -- @createdTime@, @id@, @lastRecordId@, @idempotencyToken@, @name@,
    -- @physicalId@, @productId@, @provisioningArtifact@, @type@, @status@,
    -- @tags@, @userArn@, @userArnSession@, @lastProvisioningRecordId@,
    -- @lastSuccessfulProvisioningRecordId@, @productName@, and
    -- @provisioningArtifactName@.
    --
    -- Example: @\"SearchQuery\":[\"status:AVAILABLE\"]@
    SearchProvisionedProducts
-> Maybe (HashMap ProvisionedProductViewFilterBy [Text])
filters :: Prelude.Maybe (Prelude.HashMap ProvisionedProductViewFilterBy [Prelude.Text]),
    -- | The sort order. If no value is specified, the results are not sorted.
    SearchProvisionedProducts -> Maybe SortOrder
sortOrder :: Prelude.Maybe SortOrder,
    -- | The language code.
    --
    -- -   @en@ - English (default)
    --
    -- -   @jp@ - Japanese
    --
    -- -   @zh@ - Chinese
    SearchProvisionedProducts -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
    -- | The access level to use to obtain results. The default is @User@.
    SearchProvisionedProducts -> Maybe AccessLevelFilter
accessLevelFilter :: Prelude.Maybe AccessLevelFilter,
    -- | The page token for the next set of results. To retrieve the first set of
    -- results, use null.
    SearchProvisionedProducts -> Maybe Text
pageToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return with this call.
    SearchProvisionedProducts -> Maybe Natural
pageSize :: Prelude.Maybe Prelude.Natural,
    -- | The sort field. If no value is specified, the results are not sorted.
    -- The valid values are @arn@, @id@, @name@, and @lastRecordId@.
    SearchProvisionedProducts -> Maybe Text
sortBy :: Prelude.Maybe Prelude.Text
  }
  deriving (SearchProvisionedProducts -> SearchProvisionedProducts -> Bool
(SearchProvisionedProducts -> SearchProvisionedProducts -> Bool)
-> (SearchProvisionedProducts -> SearchProvisionedProducts -> Bool)
-> Eq SearchProvisionedProducts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchProvisionedProducts -> SearchProvisionedProducts -> Bool
$c/= :: SearchProvisionedProducts -> SearchProvisionedProducts -> Bool
== :: SearchProvisionedProducts -> SearchProvisionedProducts -> Bool
$c== :: SearchProvisionedProducts -> SearchProvisionedProducts -> Bool
Prelude.Eq, ReadPrec [SearchProvisionedProducts]
ReadPrec SearchProvisionedProducts
Int -> ReadS SearchProvisionedProducts
ReadS [SearchProvisionedProducts]
(Int -> ReadS SearchProvisionedProducts)
-> ReadS [SearchProvisionedProducts]
-> ReadPrec SearchProvisionedProducts
-> ReadPrec [SearchProvisionedProducts]
-> Read SearchProvisionedProducts
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchProvisionedProducts]
$creadListPrec :: ReadPrec [SearchProvisionedProducts]
readPrec :: ReadPrec SearchProvisionedProducts
$creadPrec :: ReadPrec SearchProvisionedProducts
readList :: ReadS [SearchProvisionedProducts]
$creadList :: ReadS [SearchProvisionedProducts]
readsPrec :: Int -> ReadS SearchProvisionedProducts
$creadsPrec :: Int -> ReadS SearchProvisionedProducts
Prelude.Read, Int -> SearchProvisionedProducts -> ShowS
[SearchProvisionedProducts] -> ShowS
SearchProvisionedProducts -> String
(Int -> SearchProvisionedProducts -> ShowS)
-> (SearchProvisionedProducts -> String)
-> ([SearchProvisionedProducts] -> ShowS)
-> Show SearchProvisionedProducts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchProvisionedProducts] -> ShowS
$cshowList :: [SearchProvisionedProducts] -> ShowS
show :: SearchProvisionedProducts -> String
$cshow :: SearchProvisionedProducts -> String
showsPrec :: Int -> SearchProvisionedProducts -> ShowS
$cshowsPrec :: Int -> SearchProvisionedProducts -> ShowS
Prelude.Show, (forall x.
 SearchProvisionedProducts -> Rep SearchProvisionedProducts x)
-> (forall x.
    Rep SearchProvisionedProducts x -> SearchProvisionedProducts)
-> Generic SearchProvisionedProducts
forall x.
Rep SearchProvisionedProducts x -> SearchProvisionedProducts
forall x.
SearchProvisionedProducts -> Rep SearchProvisionedProducts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SearchProvisionedProducts x -> SearchProvisionedProducts
$cfrom :: forall x.
SearchProvisionedProducts -> Rep SearchProvisionedProducts x
Prelude.Generic)

-- |
-- Create a value of 'SearchProvisionedProducts' 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:
--
-- 'filters', 'searchProvisionedProducts_filters' - The search filters.
--
-- When the key is @SearchQuery@, the searchable fields are @arn@,
-- @createdTime@, @id@, @lastRecordId@, @idempotencyToken@, @name@,
-- @physicalId@, @productId@, @provisioningArtifact@, @type@, @status@,
-- @tags@, @userArn@, @userArnSession@, @lastProvisioningRecordId@,
-- @lastSuccessfulProvisioningRecordId@, @productName@, and
-- @provisioningArtifactName@.
--
-- Example: @\"SearchQuery\":[\"status:AVAILABLE\"]@
--
-- 'sortOrder', 'searchProvisionedProducts_sortOrder' - The sort order. If no value is specified, the results are not sorted.
--
-- 'acceptLanguage', 'searchProvisionedProducts_acceptLanguage' - The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
--
-- 'accessLevelFilter', 'searchProvisionedProducts_accessLevelFilter' - The access level to use to obtain results. The default is @User@.
--
-- 'pageToken', 'searchProvisionedProducts_pageToken' - The page token for the next set of results. To retrieve the first set of
-- results, use null.
--
-- 'pageSize', 'searchProvisionedProducts_pageSize' - The maximum number of items to return with this call.
--
-- 'sortBy', 'searchProvisionedProducts_sortBy' - The sort field. If no value is specified, the results are not sorted.
-- The valid values are @arn@, @id@, @name@, and @lastRecordId@.
newSearchProvisionedProducts ::
  SearchProvisionedProducts
newSearchProvisionedProducts :: SearchProvisionedProducts
newSearchProvisionedProducts =
  SearchProvisionedProducts' :: Maybe (HashMap ProvisionedProductViewFilterBy [Text])
-> Maybe SortOrder
-> Maybe Text
-> Maybe AccessLevelFilter
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> SearchProvisionedProducts
SearchProvisionedProducts'
    { $sel:filters:SearchProvisionedProducts' :: Maybe (HashMap ProvisionedProductViewFilterBy [Text])
filters =
        Maybe (HashMap ProvisionedProductViewFilterBy [Text])
forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:SearchProvisionedProducts' :: Maybe SortOrder
sortOrder = Maybe SortOrder
forall a. Maybe a
Prelude.Nothing,
      $sel:acceptLanguage:SearchProvisionedProducts' :: Maybe Text
acceptLanguage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:accessLevelFilter:SearchProvisionedProducts' :: Maybe AccessLevelFilter
accessLevelFilter = Maybe AccessLevelFilter
forall a. Maybe a
Prelude.Nothing,
      $sel:pageToken:SearchProvisionedProducts' :: Maybe Text
pageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:pageSize:SearchProvisionedProducts' :: Maybe Natural
pageSize = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:SearchProvisionedProducts' :: Maybe Text
sortBy = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The search filters.
--
-- When the key is @SearchQuery@, the searchable fields are @arn@,
-- @createdTime@, @id@, @lastRecordId@, @idempotencyToken@, @name@,
-- @physicalId@, @productId@, @provisioningArtifact@, @type@, @status@,
-- @tags@, @userArn@, @userArnSession@, @lastProvisioningRecordId@,
-- @lastSuccessfulProvisioningRecordId@, @productName@, and
-- @provisioningArtifactName@.
--
-- Example: @\"SearchQuery\":[\"status:AVAILABLE\"]@
searchProvisionedProducts_filters :: Lens.Lens' SearchProvisionedProducts (Prelude.Maybe (Prelude.HashMap ProvisionedProductViewFilterBy [Prelude.Text]))
searchProvisionedProducts_filters :: (Maybe (HashMap ProvisionedProductViewFilterBy [Text])
 -> f (Maybe (HashMap ProvisionedProductViewFilterBy [Text])))
-> SearchProvisionedProducts -> f SearchProvisionedProducts
searchProvisionedProducts_filters = (SearchProvisionedProducts
 -> Maybe (HashMap ProvisionedProductViewFilterBy [Text]))
-> (SearchProvisionedProducts
    -> Maybe (HashMap ProvisionedProductViewFilterBy [Text])
    -> SearchProvisionedProducts)
-> Lens
     SearchProvisionedProducts
     SearchProvisionedProducts
     (Maybe (HashMap ProvisionedProductViewFilterBy [Text]))
     (Maybe (HashMap ProvisionedProductViewFilterBy [Text]))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchProvisionedProducts' {Maybe (HashMap ProvisionedProductViewFilterBy [Text])
filters :: Maybe (HashMap ProvisionedProductViewFilterBy [Text])
$sel:filters:SearchProvisionedProducts' :: SearchProvisionedProducts
-> Maybe (HashMap ProvisionedProductViewFilterBy [Text])
filters} -> Maybe (HashMap ProvisionedProductViewFilterBy [Text])
filters) (\s :: SearchProvisionedProducts
s@SearchProvisionedProducts' {} Maybe (HashMap ProvisionedProductViewFilterBy [Text])
a -> SearchProvisionedProducts
s {$sel:filters:SearchProvisionedProducts' :: Maybe (HashMap ProvisionedProductViewFilterBy [Text])
filters = Maybe (HashMap ProvisionedProductViewFilterBy [Text])
a} :: SearchProvisionedProducts) ((Maybe (HashMap ProvisionedProductViewFilterBy [Text])
  -> f (Maybe (HashMap ProvisionedProductViewFilterBy [Text])))
 -> SearchProvisionedProducts -> f SearchProvisionedProducts)
-> ((Maybe (HashMap ProvisionedProductViewFilterBy [Text])
     -> f (Maybe (HashMap ProvisionedProductViewFilterBy [Text])))
    -> Maybe (HashMap ProvisionedProductViewFilterBy [Text])
    -> f (Maybe (HashMap ProvisionedProductViewFilterBy [Text])))
-> (Maybe (HashMap ProvisionedProductViewFilterBy [Text])
    -> f (Maybe (HashMap ProvisionedProductViewFilterBy [Text])))
-> SearchProvisionedProducts
-> f SearchProvisionedProducts
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap ProvisionedProductViewFilterBy [Text])
  (HashMap ProvisionedProductViewFilterBy [Text])
  (HashMap ProvisionedProductViewFilterBy [Text])
  (HashMap ProvisionedProductViewFilterBy [Text])
-> Iso
     (Maybe (HashMap ProvisionedProductViewFilterBy [Text]))
     (Maybe (HashMap ProvisionedProductViewFilterBy [Text]))
     (Maybe (HashMap ProvisionedProductViewFilterBy [Text]))
     (Maybe (HashMap ProvisionedProductViewFilterBy [Text]))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap ProvisionedProductViewFilterBy [Text])
  (HashMap ProvisionedProductViewFilterBy [Text])
  (HashMap ProvisionedProductViewFilterBy [Text])
  (HashMap ProvisionedProductViewFilterBy [Text])
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The sort order. If no value is specified, the results are not sorted.
searchProvisionedProducts_sortOrder :: Lens.Lens' SearchProvisionedProducts (Prelude.Maybe SortOrder)
searchProvisionedProducts_sortOrder :: (Maybe SortOrder -> f (Maybe SortOrder))
-> SearchProvisionedProducts -> f SearchProvisionedProducts
searchProvisionedProducts_sortOrder = (SearchProvisionedProducts -> Maybe SortOrder)
-> (SearchProvisionedProducts
    -> Maybe SortOrder -> SearchProvisionedProducts)
-> Lens
     SearchProvisionedProducts
     SearchProvisionedProducts
     (Maybe SortOrder)
     (Maybe SortOrder)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchProvisionedProducts' {Maybe SortOrder
sortOrder :: Maybe SortOrder
$sel:sortOrder:SearchProvisionedProducts' :: SearchProvisionedProducts -> Maybe SortOrder
sortOrder} -> Maybe SortOrder
sortOrder) (\s :: SearchProvisionedProducts
s@SearchProvisionedProducts' {} Maybe SortOrder
a -> SearchProvisionedProducts
s {$sel:sortOrder:SearchProvisionedProducts' :: Maybe SortOrder
sortOrder = Maybe SortOrder
a} :: SearchProvisionedProducts)

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

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

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

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

-- | The sort field. If no value is specified, the results are not sorted.
-- The valid values are @arn@, @id@, @name@, and @lastRecordId@.
searchProvisionedProducts_sortBy :: Lens.Lens' SearchProvisionedProducts (Prelude.Maybe Prelude.Text)
searchProvisionedProducts_sortBy :: (Maybe Text -> f (Maybe Text))
-> SearchProvisionedProducts -> f SearchProvisionedProducts
searchProvisionedProducts_sortBy = (SearchProvisionedProducts -> Maybe Text)
-> (SearchProvisionedProducts
    -> Maybe Text -> SearchProvisionedProducts)
-> Lens
     SearchProvisionedProducts
     SearchProvisionedProducts
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchProvisionedProducts' {Maybe Text
sortBy :: Maybe Text
$sel:sortBy:SearchProvisionedProducts' :: SearchProvisionedProducts -> Maybe Text
sortBy} -> Maybe Text
sortBy) (\s :: SearchProvisionedProducts
s@SearchProvisionedProducts' {} Maybe Text
a -> SearchProvisionedProducts
s {$sel:sortBy:SearchProvisionedProducts' :: Maybe Text
sortBy = Maybe Text
a} :: SearchProvisionedProducts)

instance Core.AWSRequest SearchProvisionedProducts where
  type
    AWSResponse SearchProvisionedProducts =
      SearchProvisionedProductsResponse
  request :: SearchProvisionedProducts -> Request SearchProvisionedProducts
request = Service
-> SearchProvisionedProducts -> Request SearchProvisionedProducts
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy SearchProvisionedProducts
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse SearchProvisionedProducts)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse SearchProvisionedProducts))
-> Logger
-> Service
-> Proxy SearchProvisionedProducts
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse SearchProvisionedProducts)))
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 [ProvisionedProductAttribute]
-> Maybe Int
-> Int
-> SearchProvisionedProductsResponse
SearchProvisionedProductsResponse'
            (Maybe Text
 -> Maybe [ProvisionedProductAttribute]
 -> Maybe Int
 -> Int
 -> SearchProvisionedProductsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [ProvisionedProductAttribute]
      -> Maybe Int -> Int -> SearchProvisionedProductsResponse)
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 [ProvisionedProductAttribute]
   -> Maybe Int -> Int -> SearchProvisionedProductsResponse)
-> Either String (Maybe [ProvisionedProductAttribute])
-> Either
     String (Maybe Int -> Int -> SearchProvisionedProductsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text
-> Either String (Maybe (Maybe [ProvisionedProductAttribute]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ProvisionedProducts"
                            Either String (Maybe (Maybe [ProvisionedProductAttribute]))
-> Maybe [ProvisionedProductAttribute]
-> Either String (Maybe [ProvisionedProductAttribute])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ProvisionedProductAttribute]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either
  String (Maybe Int -> Int -> SearchProvisionedProductsResponse)
-> Either String (Maybe Int)
-> Either String (Int -> SearchProvisionedProductsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Int)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TotalResultsCount")
            Either String (Int -> SearchProvisionedProductsResponse)
-> Either String Int
-> Either String SearchProvisionedProductsResponse
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 SearchProvisionedProducts

instance Prelude.NFData SearchProvisionedProducts

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

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

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

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

-- |
-- Create a value of 'SearchProvisionedProductsResponse' 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', 'searchProvisionedProductsResponse_nextPageToken' - The page token to use to retrieve the next set of results. If there are
-- no additional results, this value is null.
--
-- 'provisionedProducts', 'searchProvisionedProductsResponse_provisionedProducts' - Information about the provisioned products.
--
-- 'totalResultsCount', 'searchProvisionedProductsResponse_totalResultsCount' - The number of provisioned products found.
--
-- 'httpStatus', 'searchProvisionedProductsResponse_httpStatus' - The response's http status code.
newSearchProvisionedProductsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SearchProvisionedProductsResponse
newSearchProvisionedProductsResponse :: Int -> SearchProvisionedProductsResponse
newSearchProvisionedProductsResponse Int
pHttpStatus_ =
  SearchProvisionedProductsResponse' :: Maybe Text
-> Maybe [ProvisionedProductAttribute]
-> Maybe Int
-> Int
-> SearchProvisionedProductsResponse
SearchProvisionedProductsResponse'
    { $sel:nextPageToken:SearchProvisionedProductsResponse' :: Maybe Text
nextPageToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:provisionedProducts:SearchProvisionedProductsResponse' :: Maybe [ProvisionedProductAttribute]
provisionedProducts = Maybe [ProvisionedProductAttribute]
forall a. Maybe a
Prelude.Nothing,
      $sel:totalResultsCount:SearchProvisionedProductsResponse' :: Maybe Int
totalResultsCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SearchProvisionedProductsResponse' :: 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.
searchProvisionedProductsResponse_nextPageToken :: Lens.Lens' SearchProvisionedProductsResponse (Prelude.Maybe Prelude.Text)
searchProvisionedProductsResponse_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> SearchProvisionedProductsResponse
-> f SearchProvisionedProductsResponse
searchProvisionedProductsResponse_nextPageToken = (SearchProvisionedProductsResponse -> Maybe Text)
-> (SearchProvisionedProductsResponse
    -> Maybe Text -> SearchProvisionedProductsResponse)
-> Lens
     SearchProvisionedProductsResponse
     SearchProvisionedProductsResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchProvisionedProductsResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:SearchProvisionedProductsResponse' :: SearchProvisionedProductsResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: SearchProvisionedProductsResponse
s@SearchProvisionedProductsResponse' {} Maybe Text
a -> SearchProvisionedProductsResponse
s {$sel:nextPageToken:SearchProvisionedProductsResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: SearchProvisionedProductsResponse)

-- | Information about the provisioned products.
searchProvisionedProductsResponse_provisionedProducts :: Lens.Lens' SearchProvisionedProductsResponse (Prelude.Maybe [ProvisionedProductAttribute])
searchProvisionedProductsResponse_provisionedProducts :: (Maybe [ProvisionedProductAttribute]
 -> f (Maybe [ProvisionedProductAttribute]))
-> SearchProvisionedProductsResponse
-> f SearchProvisionedProductsResponse
searchProvisionedProductsResponse_provisionedProducts = (SearchProvisionedProductsResponse
 -> Maybe [ProvisionedProductAttribute])
-> (SearchProvisionedProductsResponse
    -> Maybe [ProvisionedProductAttribute]
    -> SearchProvisionedProductsResponse)
-> Lens
     SearchProvisionedProductsResponse
     SearchProvisionedProductsResponse
     (Maybe [ProvisionedProductAttribute])
     (Maybe [ProvisionedProductAttribute])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchProvisionedProductsResponse' {Maybe [ProvisionedProductAttribute]
provisionedProducts :: Maybe [ProvisionedProductAttribute]
$sel:provisionedProducts:SearchProvisionedProductsResponse' :: SearchProvisionedProductsResponse
-> Maybe [ProvisionedProductAttribute]
provisionedProducts} -> Maybe [ProvisionedProductAttribute]
provisionedProducts) (\s :: SearchProvisionedProductsResponse
s@SearchProvisionedProductsResponse' {} Maybe [ProvisionedProductAttribute]
a -> SearchProvisionedProductsResponse
s {$sel:provisionedProducts:SearchProvisionedProductsResponse' :: Maybe [ProvisionedProductAttribute]
provisionedProducts = Maybe [ProvisionedProductAttribute]
a} :: SearchProvisionedProductsResponse) ((Maybe [ProvisionedProductAttribute]
  -> f (Maybe [ProvisionedProductAttribute]))
 -> SearchProvisionedProductsResponse
 -> f SearchProvisionedProductsResponse)
-> ((Maybe [ProvisionedProductAttribute]
     -> f (Maybe [ProvisionedProductAttribute]))
    -> Maybe [ProvisionedProductAttribute]
    -> f (Maybe [ProvisionedProductAttribute]))
-> (Maybe [ProvisionedProductAttribute]
    -> f (Maybe [ProvisionedProductAttribute]))
-> SearchProvisionedProductsResponse
-> f SearchProvisionedProductsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ProvisionedProductAttribute]
  [ProvisionedProductAttribute]
  [ProvisionedProductAttribute]
  [ProvisionedProductAttribute]
-> Iso
     (Maybe [ProvisionedProductAttribute])
     (Maybe [ProvisionedProductAttribute])
     (Maybe [ProvisionedProductAttribute])
     (Maybe [ProvisionedProductAttribute])
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
  [ProvisionedProductAttribute]
  [ProvisionedProductAttribute]
  [ProvisionedProductAttribute]
  [ProvisionedProductAttribute]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The number of provisioned products found.
searchProvisionedProductsResponse_totalResultsCount :: Lens.Lens' SearchProvisionedProductsResponse (Prelude.Maybe Prelude.Int)
searchProvisionedProductsResponse_totalResultsCount :: (Maybe Int -> f (Maybe Int))
-> SearchProvisionedProductsResponse
-> f SearchProvisionedProductsResponse
searchProvisionedProductsResponse_totalResultsCount = (SearchProvisionedProductsResponse -> Maybe Int)
-> (SearchProvisionedProductsResponse
    -> Maybe Int -> SearchProvisionedProductsResponse)
-> Lens
     SearchProvisionedProductsResponse
     SearchProvisionedProductsResponse
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchProvisionedProductsResponse' {Maybe Int
totalResultsCount :: Maybe Int
$sel:totalResultsCount:SearchProvisionedProductsResponse' :: SearchProvisionedProductsResponse -> Maybe Int
totalResultsCount} -> Maybe Int
totalResultsCount) (\s :: SearchProvisionedProductsResponse
s@SearchProvisionedProductsResponse' {} Maybe Int
a -> SearchProvisionedProductsResponse
s {$sel:totalResultsCount:SearchProvisionedProductsResponse' :: Maybe Int
totalResultsCount = Maybe Int
a} :: SearchProvisionedProductsResponse)

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

instance
  Prelude.NFData
    SearchProvisionedProductsResponse