{-# 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 #-}
module Amazonka.ServiceCatalog.ListPortfolios
(
ListPortfolios (..),
newListPortfolios,
listPortfolios_acceptLanguage,
listPortfolios_pageSize,
listPortfolios_pageToken,
ListPortfoliosResponse (..),
newListPortfoliosResponse,
listPortfoliosResponse_nextPageToken,
listPortfoliosResponse_portfolioDetails,
listPortfoliosResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.ServiceCatalog.Types
data ListPortfolios = ListPortfolios'
{
ListPortfolios -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
ListPortfolios -> Maybe Natural
pageSize :: Prelude.Maybe Prelude.Natural,
ListPortfolios -> Maybe Text
pageToken :: Prelude.Maybe Prelude.Text
}
deriving (ListPortfolios -> ListPortfolios -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPortfolios -> ListPortfolios -> Bool
$c/= :: ListPortfolios -> ListPortfolios -> Bool
== :: ListPortfolios -> ListPortfolios -> Bool
$c== :: ListPortfolios -> ListPortfolios -> Bool
Prelude.Eq, ReadPrec [ListPortfolios]
ReadPrec ListPortfolios
Int -> ReadS ListPortfolios
ReadS [ListPortfolios]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPortfolios]
$creadListPrec :: ReadPrec [ListPortfolios]
readPrec :: ReadPrec ListPortfolios
$creadPrec :: ReadPrec ListPortfolios
readList :: ReadS [ListPortfolios]
$creadList :: ReadS [ListPortfolios]
readsPrec :: Int -> ReadS ListPortfolios
$creadsPrec :: Int -> ReadS ListPortfolios
Prelude.Read, Int -> ListPortfolios -> ShowS
[ListPortfolios] -> ShowS
ListPortfolios -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPortfolios] -> ShowS
$cshowList :: [ListPortfolios] -> ShowS
show :: ListPortfolios -> String
$cshow :: ListPortfolios -> String
showsPrec :: Int -> ListPortfolios -> ShowS
$cshowsPrec :: Int -> ListPortfolios -> ShowS
Prelude.Show, forall x. Rep ListPortfolios x -> ListPortfolios
forall x. ListPortfolios -> Rep ListPortfolios x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPortfolios x -> ListPortfolios
$cfrom :: forall x. ListPortfolios -> Rep ListPortfolios x
Prelude.Generic)
newListPortfolios ::
ListPortfolios
newListPortfolios :: ListPortfolios
newListPortfolios =
ListPortfolios'
{ $sel:acceptLanguage:ListPortfolios' :: Maybe Text
acceptLanguage = forall a. Maybe a
Prelude.Nothing,
$sel:pageSize:ListPortfolios' :: Maybe Natural
pageSize = forall a. Maybe a
Prelude.Nothing,
$sel:pageToken:ListPortfolios' :: Maybe Text
pageToken = forall a. Maybe a
Prelude.Nothing
}
listPortfolios_acceptLanguage :: Lens.Lens' ListPortfolios (Prelude.Maybe Prelude.Text)
listPortfolios_acceptLanguage :: Lens' ListPortfolios (Maybe Text)
listPortfolios_acceptLanguage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPortfolios' {Maybe Text
acceptLanguage :: Maybe Text
$sel:acceptLanguage:ListPortfolios' :: ListPortfolios -> Maybe Text
acceptLanguage} -> Maybe Text
acceptLanguage) (\s :: ListPortfolios
s@ListPortfolios' {} Maybe Text
a -> ListPortfolios
s {$sel:acceptLanguage:ListPortfolios' :: Maybe Text
acceptLanguage = Maybe Text
a} :: ListPortfolios)
listPortfolios_pageSize :: Lens.Lens' ListPortfolios (Prelude.Maybe Prelude.Natural)
listPortfolios_pageSize :: Lens' ListPortfolios (Maybe Natural)
listPortfolios_pageSize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPortfolios' {Maybe Natural
pageSize :: Maybe Natural
$sel:pageSize:ListPortfolios' :: ListPortfolios -> Maybe Natural
pageSize} -> Maybe Natural
pageSize) (\s :: ListPortfolios
s@ListPortfolios' {} Maybe Natural
a -> ListPortfolios
s {$sel:pageSize:ListPortfolios' :: Maybe Natural
pageSize = Maybe Natural
a} :: ListPortfolios)
listPortfolios_pageToken :: Lens.Lens' ListPortfolios (Prelude.Maybe Prelude.Text)
listPortfolios_pageToken :: Lens' ListPortfolios (Maybe Text)
listPortfolios_pageToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPortfolios' {Maybe Text
pageToken :: Maybe Text
$sel:pageToken:ListPortfolios' :: ListPortfolios -> Maybe Text
pageToken} -> Maybe Text
pageToken) (\s :: ListPortfolios
s@ListPortfolios' {} Maybe Text
a -> ListPortfolios
s {$sel:pageToken:ListPortfolios' :: Maybe Text
pageToken = Maybe Text
a} :: ListPortfolios)
instance Core.AWSPager ListPortfolios where
page :: ListPortfolios
-> AWSResponse ListPortfolios -> Maybe ListPortfolios
page ListPortfolios
rq AWSResponse ListPortfolios
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListPortfolios
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPortfoliosResponse (Maybe Text)
listPortfoliosResponse_nextPageToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListPortfolios
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPortfoliosResponse (Maybe [PortfolioDetail])
listPortfoliosResponse_portfolioDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListPortfolios
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListPortfolios (Maybe Text)
listPortfolios_pageToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListPortfolios
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPortfoliosResponse (Maybe Text)
listPortfoliosResponse_nextPageToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListPortfolios where
type
AWSResponse ListPortfolios =
ListPortfoliosResponse
request :: (Service -> Service) -> ListPortfolios -> Request ListPortfolios
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListPortfolios
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListPortfolios)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text
-> Maybe [PortfolioDetail] -> Int -> ListPortfoliosResponse
ListPortfoliosResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextPageToken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"PortfolioDetails"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListPortfolios where
hashWithSalt :: Int -> ListPortfolios -> Int
hashWithSalt Int
_salt ListPortfolios' {Maybe Natural
Maybe Text
pageToken :: Maybe Text
pageSize :: Maybe Natural
acceptLanguage :: Maybe Text
$sel:pageToken:ListPortfolios' :: ListPortfolios -> Maybe Text
$sel:pageSize:ListPortfolios' :: ListPortfolios -> Maybe Natural
$sel:acceptLanguage:ListPortfolios' :: ListPortfolios -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
acceptLanguage
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
pageSize
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
pageToken
instance Prelude.NFData ListPortfolios where
rnf :: ListPortfolios -> ()
rnf ListPortfolios' {Maybe Natural
Maybe Text
pageToken :: Maybe Text
pageSize :: Maybe Natural
acceptLanguage :: Maybe Text
$sel:pageToken:ListPortfolios' :: ListPortfolios -> Maybe Text
$sel:pageSize:ListPortfolios' :: ListPortfolios -> Maybe Natural
$sel:acceptLanguage:ListPortfolios' :: ListPortfolios -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
acceptLanguage
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
pageSize
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
pageToken
instance Data.ToHeaders ListPortfolios where
toHeaders :: ListPortfolios -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWS242ServiceCatalogService.ListPortfolios" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListPortfolios where
toJSON :: ListPortfolios -> Value
toJSON ListPortfolios' {Maybe Natural
Maybe Text
pageToken :: Maybe Text
pageSize :: Maybe Natural
acceptLanguage :: Maybe Text
$sel:pageToken:ListPortfolios' :: ListPortfolios -> Maybe Text
$sel:pageSize:ListPortfolios' :: ListPortfolios -> Maybe Natural
$sel:acceptLanguage:ListPortfolios' :: ListPortfolios -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"AcceptLanguage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
acceptLanguage,
(Key
"PageSize" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
pageSize,
(Key
"PageToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
pageToken
]
)
instance Data.ToPath ListPortfolios where
toPath :: ListPortfolios -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListPortfolios where
toQuery :: ListPortfolios -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListPortfoliosResponse = ListPortfoliosResponse'
{
ListPortfoliosResponse -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
ListPortfoliosResponse -> Maybe [PortfolioDetail]
portfolioDetails :: Prelude.Maybe [PortfolioDetail],
ListPortfoliosResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListPortfoliosResponse -> ListPortfoliosResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPortfoliosResponse -> ListPortfoliosResponse -> Bool
$c/= :: ListPortfoliosResponse -> ListPortfoliosResponse -> Bool
== :: ListPortfoliosResponse -> ListPortfoliosResponse -> Bool
$c== :: ListPortfoliosResponse -> ListPortfoliosResponse -> Bool
Prelude.Eq, ReadPrec [ListPortfoliosResponse]
ReadPrec ListPortfoliosResponse
Int -> ReadS ListPortfoliosResponse
ReadS [ListPortfoliosResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPortfoliosResponse]
$creadListPrec :: ReadPrec [ListPortfoliosResponse]
readPrec :: ReadPrec ListPortfoliosResponse
$creadPrec :: ReadPrec ListPortfoliosResponse
readList :: ReadS [ListPortfoliosResponse]
$creadList :: ReadS [ListPortfoliosResponse]
readsPrec :: Int -> ReadS ListPortfoliosResponse
$creadsPrec :: Int -> ReadS ListPortfoliosResponse
Prelude.Read, Int -> ListPortfoliosResponse -> ShowS
[ListPortfoliosResponse] -> ShowS
ListPortfoliosResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPortfoliosResponse] -> ShowS
$cshowList :: [ListPortfoliosResponse] -> ShowS
show :: ListPortfoliosResponse -> String
$cshow :: ListPortfoliosResponse -> String
showsPrec :: Int -> ListPortfoliosResponse -> ShowS
$cshowsPrec :: Int -> ListPortfoliosResponse -> ShowS
Prelude.Show, forall x. Rep ListPortfoliosResponse x -> ListPortfoliosResponse
forall x. ListPortfoliosResponse -> Rep ListPortfoliosResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPortfoliosResponse x -> ListPortfoliosResponse
$cfrom :: forall x. ListPortfoliosResponse -> Rep ListPortfoliosResponse x
Prelude.Generic)
newListPortfoliosResponse ::
Prelude.Int ->
ListPortfoliosResponse
newListPortfoliosResponse :: Int -> ListPortfoliosResponse
newListPortfoliosResponse Int
pHttpStatus_ =
ListPortfoliosResponse'
{ $sel:nextPageToken:ListPortfoliosResponse' :: Maybe Text
nextPageToken =
forall a. Maybe a
Prelude.Nothing,
$sel:portfolioDetails:ListPortfoliosResponse' :: Maybe [PortfolioDetail]
portfolioDetails = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListPortfoliosResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listPortfoliosResponse_nextPageToken :: Lens.Lens' ListPortfoliosResponse (Prelude.Maybe Prelude.Text)
listPortfoliosResponse_nextPageToken :: Lens' ListPortfoliosResponse (Maybe Text)
listPortfoliosResponse_nextPageToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPortfoliosResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:ListPortfoliosResponse' :: ListPortfoliosResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: ListPortfoliosResponse
s@ListPortfoliosResponse' {} Maybe Text
a -> ListPortfoliosResponse
s {$sel:nextPageToken:ListPortfoliosResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: ListPortfoliosResponse)
listPortfoliosResponse_portfolioDetails :: Lens.Lens' ListPortfoliosResponse (Prelude.Maybe [PortfolioDetail])
listPortfoliosResponse_portfolioDetails :: Lens' ListPortfoliosResponse (Maybe [PortfolioDetail])
listPortfoliosResponse_portfolioDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPortfoliosResponse' {Maybe [PortfolioDetail]
portfolioDetails :: Maybe [PortfolioDetail]
$sel:portfolioDetails:ListPortfoliosResponse' :: ListPortfoliosResponse -> Maybe [PortfolioDetail]
portfolioDetails} -> Maybe [PortfolioDetail]
portfolioDetails) (\s :: ListPortfoliosResponse
s@ListPortfoliosResponse' {} Maybe [PortfolioDetail]
a -> ListPortfoliosResponse
s {$sel:portfolioDetails:ListPortfoliosResponse' :: Maybe [PortfolioDetail]
portfolioDetails = Maybe [PortfolioDetail]
a} :: ListPortfoliosResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listPortfoliosResponse_httpStatus :: Lens.Lens' ListPortfoliosResponse Prelude.Int
listPortfoliosResponse_httpStatus :: Lens' ListPortfoliosResponse Int
listPortfoliosResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPortfoliosResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListPortfoliosResponse' :: ListPortfoliosResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListPortfoliosResponse
s@ListPortfoliosResponse' {} Int
a -> ListPortfoliosResponse
s {$sel:httpStatus:ListPortfoliosResponse' :: Int
httpStatus = Int
a} :: ListPortfoliosResponse)
instance Prelude.NFData ListPortfoliosResponse where
rnf :: ListPortfoliosResponse -> ()
rnf ListPortfoliosResponse' {Int
Maybe [PortfolioDetail]
Maybe Text
httpStatus :: Int
portfolioDetails :: Maybe [PortfolioDetail]
nextPageToken :: Maybe Text
$sel:httpStatus:ListPortfoliosResponse' :: ListPortfoliosResponse -> Int
$sel:portfolioDetails:ListPortfoliosResponse' :: ListPortfoliosResponse -> Maybe [PortfolioDetail]
$sel:nextPageToken:ListPortfoliosResponse' :: ListPortfoliosResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextPageToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [PortfolioDetail]
portfolioDetails
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus