{-# 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.ListAcceptedPortfolioShares
-- 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 all portfolios for which sharing was accepted by this account.
--
-- This operation returns paginated results.
module Amazonka.ServiceCatalog.ListAcceptedPortfolioShares
  ( -- * Creating a Request
    ListAcceptedPortfolioShares (..),
    newListAcceptedPortfolioShares,

    -- * Request Lenses
    listAcceptedPortfolioShares_portfolioShareType,
    listAcceptedPortfolioShares_acceptLanguage,
    listAcceptedPortfolioShares_pageToken,
    listAcceptedPortfolioShares_pageSize,

    -- * Destructuring the Response
    ListAcceptedPortfolioSharesResponse (..),
    newListAcceptedPortfolioSharesResponse,

    -- * Response Lenses
    listAcceptedPortfolioSharesResponse_nextPageToken,
    listAcceptedPortfolioSharesResponse_portfolioDetails,
    listAcceptedPortfolioSharesResponse_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:/ 'newListAcceptedPortfolioShares' smart constructor.
data ListAcceptedPortfolioShares = ListAcceptedPortfolioShares'
  { -- | The type of shared portfolios to list. The default is to list imported
    -- portfolios.
    --
    -- -   @AWS_ORGANIZATIONS@ - List portfolios shared by the management
    --     account of your organization
    --
    -- -   @AWS_SERVICECATALOG@ - List default portfolios
    --
    -- -   @IMPORTED@ - List imported portfolios
    ListAcceptedPortfolioShares -> Maybe PortfolioShareType
portfolioShareType :: Prelude.Maybe PortfolioShareType,
    -- | The language code.
    --
    -- -   @en@ - English (default)
    --
    -- -   @jp@ - Japanese
    --
    -- -   @zh@ - Chinese
    ListAcceptedPortfolioShares -> 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.
    ListAcceptedPortfolioShares -> Maybe Text
pageToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return with this call.
    ListAcceptedPortfolioShares -> Maybe Natural
pageSize :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListAcceptedPortfolioShares -> ListAcceptedPortfolioShares -> Bool
(ListAcceptedPortfolioShares
 -> ListAcceptedPortfolioShares -> Bool)
-> (ListAcceptedPortfolioShares
    -> ListAcceptedPortfolioShares -> Bool)
-> Eq ListAcceptedPortfolioShares
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAcceptedPortfolioShares -> ListAcceptedPortfolioShares -> Bool
$c/= :: ListAcceptedPortfolioShares -> ListAcceptedPortfolioShares -> Bool
== :: ListAcceptedPortfolioShares -> ListAcceptedPortfolioShares -> Bool
$c== :: ListAcceptedPortfolioShares -> ListAcceptedPortfolioShares -> Bool
Prelude.Eq, ReadPrec [ListAcceptedPortfolioShares]
ReadPrec ListAcceptedPortfolioShares
Int -> ReadS ListAcceptedPortfolioShares
ReadS [ListAcceptedPortfolioShares]
(Int -> ReadS ListAcceptedPortfolioShares)
-> ReadS [ListAcceptedPortfolioShares]
-> ReadPrec ListAcceptedPortfolioShares
-> ReadPrec [ListAcceptedPortfolioShares]
-> Read ListAcceptedPortfolioShares
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAcceptedPortfolioShares]
$creadListPrec :: ReadPrec [ListAcceptedPortfolioShares]
readPrec :: ReadPrec ListAcceptedPortfolioShares
$creadPrec :: ReadPrec ListAcceptedPortfolioShares
readList :: ReadS [ListAcceptedPortfolioShares]
$creadList :: ReadS [ListAcceptedPortfolioShares]
readsPrec :: Int -> ReadS ListAcceptedPortfolioShares
$creadsPrec :: Int -> ReadS ListAcceptedPortfolioShares
Prelude.Read, Int -> ListAcceptedPortfolioShares -> ShowS
[ListAcceptedPortfolioShares] -> ShowS
ListAcceptedPortfolioShares -> String
(Int -> ListAcceptedPortfolioShares -> ShowS)
-> (ListAcceptedPortfolioShares -> String)
-> ([ListAcceptedPortfolioShares] -> ShowS)
-> Show ListAcceptedPortfolioShares
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAcceptedPortfolioShares] -> ShowS
$cshowList :: [ListAcceptedPortfolioShares] -> ShowS
show :: ListAcceptedPortfolioShares -> String
$cshow :: ListAcceptedPortfolioShares -> String
showsPrec :: Int -> ListAcceptedPortfolioShares -> ShowS
$cshowsPrec :: Int -> ListAcceptedPortfolioShares -> ShowS
Prelude.Show, (forall x.
 ListAcceptedPortfolioShares -> Rep ListAcceptedPortfolioShares x)
-> (forall x.
    Rep ListAcceptedPortfolioShares x -> ListAcceptedPortfolioShares)
-> Generic ListAcceptedPortfolioShares
forall x.
Rep ListAcceptedPortfolioShares x -> ListAcceptedPortfolioShares
forall x.
ListAcceptedPortfolioShares -> Rep ListAcceptedPortfolioShares x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAcceptedPortfolioShares x -> ListAcceptedPortfolioShares
$cfrom :: forall x.
ListAcceptedPortfolioShares -> Rep ListAcceptedPortfolioShares x
Prelude.Generic)

-- |
-- Create a value of 'ListAcceptedPortfolioShares' 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:
--
-- 'portfolioShareType', 'listAcceptedPortfolioShares_portfolioShareType' - The type of shared portfolios to list. The default is to list imported
-- portfolios.
--
-- -   @AWS_ORGANIZATIONS@ - List portfolios shared by the management
--     account of your organization
--
-- -   @AWS_SERVICECATALOG@ - List default portfolios
--
-- -   @IMPORTED@ - List imported portfolios
--
-- 'acceptLanguage', 'listAcceptedPortfolioShares_acceptLanguage' - The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
--
-- 'pageToken', 'listAcceptedPortfolioShares_pageToken' - The page token for the next set of results. To retrieve the first set of
-- results, use null.
--
-- 'pageSize', 'listAcceptedPortfolioShares_pageSize' - The maximum number of items to return with this call.
newListAcceptedPortfolioShares ::
  ListAcceptedPortfolioShares
newListAcceptedPortfolioShares :: ListAcceptedPortfolioShares
newListAcceptedPortfolioShares =
  ListAcceptedPortfolioShares' :: Maybe PortfolioShareType
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> ListAcceptedPortfolioShares
ListAcceptedPortfolioShares'
    { $sel:portfolioShareType:ListAcceptedPortfolioShares' :: Maybe PortfolioShareType
portfolioShareType =
        Maybe PortfolioShareType
forall a. Maybe a
Prelude.Nothing,
      $sel:acceptLanguage:ListAcceptedPortfolioShares' :: Maybe Text
acceptLanguage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:pageToken:ListAcceptedPortfolioShares' :: Maybe Text
pageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:pageSize:ListAcceptedPortfolioShares' :: Maybe Natural
pageSize = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The type of shared portfolios to list. The default is to list imported
-- portfolios.
--
-- -   @AWS_ORGANIZATIONS@ - List portfolios shared by the management
--     account of your organization
--
-- -   @AWS_SERVICECATALOG@ - List default portfolios
--
-- -   @IMPORTED@ - List imported portfolios
listAcceptedPortfolioShares_portfolioShareType :: Lens.Lens' ListAcceptedPortfolioShares (Prelude.Maybe PortfolioShareType)
listAcceptedPortfolioShares_portfolioShareType :: (Maybe PortfolioShareType -> f (Maybe PortfolioShareType))
-> ListAcceptedPortfolioShares -> f ListAcceptedPortfolioShares
listAcceptedPortfolioShares_portfolioShareType = (ListAcceptedPortfolioShares -> Maybe PortfolioShareType)
-> (ListAcceptedPortfolioShares
    -> Maybe PortfolioShareType -> ListAcceptedPortfolioShares)
-> Lens
     ListAcceptedPortfolioShares
     ListAcceptedPortfolioShares
     (Maybe PortfolioShareType)
     (Maybe PortfolioShareType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAcceptedPortfolioShares' {Maybe PortfolioShareType
portfolioShareType :: Maybe PortfolioShareType
$sel:portfolioShareType:ListAcceptedPortfolioShares' :: ListAcceptedPortfolioShares -> Maybe PortfolioShareType
portfolioShareType} -> Maybe PortfolioShareType
portfolioShareType) (\s :: ListAcceptedPortfolioShares
s@ListAcceptedPortfolioShares' {} Maybe PortfolioShareType
a -> ListAcceptedPortfolioShares
s {$sel:portfolioShareType:ListAcceptedPortfolioShares' :: Maybe PortfolioShareType
portfolioShareType = Maybe PortfolioShareType
a} :: ListAcceptedPortfolioShares)

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

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

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

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

instance Prelude.NFData ListAcceptedPortfolioShares

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

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

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

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

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

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

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

instance
  Prelude.NFData
    ListAcceptedPortfolioSharesResponse