module Network.AWS.ServiceCatalog.ListPortfolios
(
listPortfolios
, ListPortfolios
, lpAcceptLanguage
, lpPageToken
, lpPageSize
, listPortfoliosResponse
, ListPortfoliosResponse
, lprsNextPageToken
, lprsPortfolioDetails
, lprsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.ServiceCatalog.Types
import Network.AWS.ServiceCatalog.Types.Product
data ListPortfolios = ListPortfolios'
{ _lpAcceptLanguage :: !(Maybe Text)
, _lpPageToken :: !(Maybe Text)
, _lpPageSize :: !(Maybe Nat)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listPortfolios
:: ListPortfolios
listPortfolios =
ListPortfolios'
{_lpAcceptLanguage = Nothing, _lpPageToken = Nothing, _lpPageSize = Nothing}
lpAcceptLanguage :: Lens' ListPortfolios (Maybe Text)
lpAcceptLanguage = lens _lpAcceptLanguage (\ s a -> s{_lpAcceptLanguage = a});
lpPageToken :: Lens' ListPortfolios (Maybe Text)
lpPageToken = lens _lpPageToken (\ s a -> s{_lpPageToken = a});
lpPageSize :: Lens' ListPortfolios (Maybe Natural)
lpPageSize = lens _lpPageSize (\ s a -> s{_lpPageSize = a}) . mapping _Nat;
instance AWSRequest ListPortfolios where
type Rs ListPortfolios = ListPortfoliosResponse
request = postJSON serviceCatalog
response
= receiveJSON
(\ s h x ->
ListPortfoliosResponse' <$>
(x .?> "NextPageToken") <*>
(x .?> "PortfolioDetails" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable ListPortfolios where
instance NFData ListPortfolios where
instance ToHeaders ListPortfolios where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWS242ServiceCatalogService.ListPortfolios" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListPortfolios where
toJSON ListPortfolios'{..}
= object
(catMaybes
[("AcceptLanguage" .=) <$> _lpAcceptLanguage,
("PageToken" .=) <$> _lpPageToken,
("PageSize" .=) <$> _lpPageSize])
instance ToPath ListPortfolios where
toPath = const "/"
instance ToQuery ListPortfolios where
toQuery = const mempty
data ListPortfoliosResponse = ListPortfoliosResponse'
{ _lprsNextPageToken :: !(Maybe Text)
, _lprsPortfolioDetails :: !(Maybe [PortfolioDetail])
, _lprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listPortfoliosResponse
:: Int
-> ListPortfoliosResponse
listPortfoliosResponse pResponseStatus_ =
ListPortfoliosResponse'
{ _lprsNextPageToken = Nothing
, _lprsPortfolioDetails = Nothing
, _lprsResponseStatus = pResponseStatus_
}
lprsNextPageToken :: Lens' ListPortfoliosResponse (Maybe Text)
lprsNextPageToken = lens _lprsNextPageToken (\ s a -> s{_lprsNextPageToken = a});
lprsPortfolioDetails :: Lens' ListPortfoliosResponse [PortfolioDetail]
lprsPortfolioDetails = lens _lprsPortfolioDetails (\ s a -> s{_lprsPortfolioDetails = a}) . _Default . _Coerce;
lprsResponseStatus :: Lens' ListPortfoliosResponse Int
lprsResponseStatus = lens _lprsResponseStatus (\ s a -> s{_lprsResponseStatus = a});
instance NFData ListPortfoliosResponse where