{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.IAM.ListInstanceProfiles
(
listInstanceProfiles
, ListInstanceProfiles
, lipPathPrefix
, lipMarker
, lipMaxItems
, listInstanceProfilesResponse
, ListInstanceProfilesResponse
, liprsMarker
, liprsIsTruncated
, liprsResponseStatus
, liprsInstanceProfiles
) where
import Network.AWS.IAM.Types
import Network.AWS.IAM.Types.Product
import Network.AWS.Lens
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListInstanceProfiles = ListInstanceProfiles'
{ _lipPathPrefix :: !(Maybe Text)
, _lipMarker :: !(Maybe Text)
, _lipMaxItems :: !(Maybe Nat)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listInstanceProfiles
:: ListInstanceProfiles
listInstanceProfiles =
ListInstanceProfiles'
{ _lipPathPrefix = Nothing
, _lipMarker = Nothing
, _lipMaxItems = Nothing
}
lipPathPrefix :: Lens' ListInstanceProfiles (Maybe Text)
lipPathPrefix = lens _lipPathPrefix (\ s a -> s{_lipPathPrefix = a});
lipMarker :: Lens' ListInstanceProfiles (Maybe Text)
lipMarker = lens _lipMarker (\ s a -> s{_lipMarker = a});
lipMaxItems :: Lens' ListInstanceProfiles (Maybe Natural)
lipMaxItems = lens _lipMaxItems (\ s a -> s{_lipMaxItems = a}) . mapping _Nat;
instance AWSPager ListInstanceProfiles where
page rq rs
| stop (rs ^. liprsIsTruncated) = Nothing
| isNothing (rs ^. liprsMarker) = Nothing
| otherwise =
Just $ rq & lipMarker .~ rs ^. liprsMarker
instance AWSRequest ListInstanceProfiles where
type Rs ListInstanceProfiles =
ListInstanceProfilesResponse
request = postQuery iam
response
= receiveXMLWrapper "ListInstanceProfilesResult"
(\ s h x ->
ListInstanceProfilesResponse' <$>
(x .@? "Marker") <*> (x .@? "IsTruncated") <*>
(pure (fromEnum s))
<*>
(x .@? "InstanceProfiles" .!@ mempty >>=
parseXMLList "member"))
instance Hashable ListInstanceProfiles
instance NFData ListInstanceProfiles
instance ToHeaders ListInstanceProfiles where
toHeaders = const mempty
instance ToPath ListInstanceProfiles where
toPath = const "/"
instance ToQuery ListInstanceProfiles where
toQuery ListInstanceProfiles'{..}
= mconcat
["Action" =: ("ListInstanceProfiles" :: ByteString),
"Version" =: ("2010-05-08" :: ByteString),
"PathPrefix" =: _lipPathPrefix,
"Marker" =: _lipMarker, "MaxItems" =: _lipMaxItems]
data ListInstanceProfilesResponse = ListInstanceProfilesResponse'
{ _liprsMarker :: !(Maybe Text)
, _liprsIsTruncated :: !(Maybe Bool)
, _liprsResponseStatus :: !Int
, _liprsInstanceProfiles :: ![InstanceProfile]
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listInstanceProfilesResponse
:: Int
-> ListInstanceProfilesResponse
listInstanceProfilesResponse pResponseStatus_ =
ListInstanceProfilesResponse'
{ _liprsMarker = Nothing
, _liprsIsTruncated = Nothing
, _liprsResponseStatus = pResponseStatus_
, _liprsInstanceProfiles = mempty
}
liprsMarker :: Lens' ListInstanceProfilesResponse (Maybe Text)
liprsMarker = lens _liprsMarker (\ s a -> s{_liprsMarker = a});
liprsIsTruncated :: Lens' ListInstanceProfilesResponse (Maybe Bool)
liprsIsTruncated = lens _liprsIsTruncated (\ s a -> s{_liprsIsTruncated = a});
liprsResponseStatus :: Lens' ListInstanceProfilesResponse Int
liprsResponseStatus = lens _liprsResponseStatus (\ s a -> s{_liprsResponseStatus = a});
liprsInstanceProfiles :: Lens' ListInstanceProfilesResponse [InstanceProfile]
liprsInstanceProfiles = lens _liprsInstanceProfiles (\ s a -> s{_liprsInstanceProfiles = a}) . _Coerce;
instance NFData ListInstanceProfilesResponse