module Network.AWS.ServiceCatalog.ListPortfolioAccess
(
listPortfolioAccess
, ListPortfolioAccess
, lAcceptLanguage
, lPortfolioId
, listPortfolioAccessResponse
, ListPortfolioAccessResponse
, lparsNextPageToken
, lparsAccountIds
, lparsResponseStatus
) 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 ListPortfolioAccess = ListPortfolioAccess'
{ _lAcceptLanguage :: !(Maybe Text)
, _lPortfolioId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listPortfolioAccess
:: Text
-> ListPortfolioAccess
listPortfolioAccess pPortfolioId_ =
ListPortfolioAccess'
{_lAcceptLanguage = Nothing, _lPortfolioId = pPortfolioId_}
lAcceptLanguage :: Lens' ListPortfolioAccess (Maybe Text)
lAcceptLanguage = lens _lAcceptLanguage (\ s a -> s{_lAcceptLanguage = a});
lPortfolioId :: Lens' ListPortfolioAccess Text
lPortfolioId = lens _lPortfolioId (\ s a -> s{_lPortfolioId = a});
instance AWSRequest ListPortfolioAccess where
type Rs ListPortfolioAccess =
ListPortfolioAccessResponse
request = postJSON serviceCatalog
response
= receiveJSON
(\ s h x ->
ListPortfolioAccessResponse' <$>
(x .?> "NextPageToken") <*>
(x .?> "AccountIds" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable ListPortfolioAccess where
instance NFData ListPortfolioAccess where
instance ToHeaders ListPortfolioAccess where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWS242ServiceCatalogService.ListPortfolioAccess" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListPortfolioAccess where
toJSON ListPortfolioAccess'{..}
= object
(catMaybes
[("AcceptLanguage" .=) <$> _lAcceptLanguage,
Just ("PortfolioId" .= _lPortfolioId)])
instance ToPath ListPortfolioAccess where
toPath = const "/"
instance ToQuery ListPortfolioAccess where
toQuery = const mempty
data ListPortfolioAccessResponse = ListPortfolioAccessResponse'
{ _lparsNextPageToken :: !(Maybe Text)
, _lparsAccountIds :: !(Maybe [Text])
, _lparsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listPortfolioAccessResponse
:: Int
-> ListPortfolioAccessResponse
listPortfolioAccessResponse pResponseStatus_ =
ListPortfolioAccessResponse'
{ _lparsNextPageToken = Nothing
, _lparsAccountIds = Nothing
, _lparsResponseStatus = pResponseStatus_
}
lparsNextPageToken :: Lens' ListPortfolioAccessResponse (Maybe Text)
lparsNextPageToken = lens _lparsNextPageToken (\ s a -> s{_lparsNextPageToken = a});
lparsAccountIds :: Lens' ListPortfolioAccessResponse [Text]
lparsAccountIds = lens _lparsAccountIds (\ s a -> s{_lparsAccountIds = a}) . _Default . _Coerce;
lparsResponseStatus :: Lens' ListPortfolioAccessResponse Int
lparsResponseStatus = lens _lparsResponseStatus (\ s a -> s{_lparsResponseStatus = a});
instance NFData ListPortfolioAccessResponse where