module Network.AWS.Config.GetResourceConfigHistory
(
getResourceConfigHistory
, GetResourceConfigHistory
, grchChronologicalOrder
, grchNextToken
, grchLimit
, grchLaterTime
, grchEarlierTime
, grchResourceType
, grchResourceId
, getResourceConfigHistoryResponse
, GetResourceConfigHistoryResponse
, grchrsNextToken
, grchrsConfigurationItems
, grchrsResponseStatus
) where
import Network.AWS.Config.Types
import Network.AWS.Config.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetResourceConfigHistory = GetResourceConfigHistory'
{ _grchChronologicalOrder :: !(Maybe ChronologicalOrder)
, _grchNextToken :: !(Maybe Text)
, _grchLimit :: !(Maybe Nat)
, _grchLaterTime :: !(Maybe POSIX)
, _grchEarlierTime :: !(Maybe POSIX)
, _grchResourceType :: !ResourceType
, _grchResourceId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getResourceConfigHistory
:: ResourceType
-> Text
-> GetResourceConfigHistory
getResourceConfigHistory pResourceType_ pResourceId_ =
GetResourceConfigHistory'
{ _grchChronologicalOrder = Nothing
, _grchNextToken = Nothing
, _grchLimit = Nothing
, _grchLaterTime = Nothing
, _grchEarlierTime = Nothing
, _grchResourceType = pResourceType_
, _grchResourceId = pResourceId_
}
grchChronologicalOrder :: Lens' GetResourceConfigHistory (Maybe ChronologicalOrder)
grchChronologicalOrder = lens _grchChronologicalOrder (\ s a -> s{_grchChronologicalOrder = a});
grchNextToken :: Lens' GetResourceConfigHistory (Maybe Text)
grchNextToken = lens _grchNextToken (\ s a -> s{_grchNextToken = a});
grchLimit :: Lens' GetResourceConfigHistory (Maybe Natural)
grchLimit = lens _grchLimit (\ s a -> s{_grchLimit = a}) . mapping _Nat;
grchLaterTime :: Lens' GetResourceConfigHistory (Maybe UTCTime)
grchLaterTime = lens _grchLaterTime (\ s a -> s{_grchLaterTime = a}) . mapping _Time;
grchEarlierTime :: Lens' GetResourceConfigHistory (Maybe UTCTime)
grchEarlierTime = lens _grchEarlierTime (\ s a -> s{_grchEarlierTime = a}) . mapping _Time;
grchResourceType :: Lens' GetResourceConfigHistory ResourceType
grchResourceType = lens _grchResourceType (\ s a -> s{_grchResourceType = a});
grchResourceId :: Lens' GetResourceConfigHistory Text
grchResourceId = lens _grchResourceId (\ s a -> s{_grchResourceId = a});
instance AWSRequest GetResourceConfigHistory where
type Rs GetResourceConfigHistory =
GetResourceConfigHistoryResponse
request = postJSON config
response
= receiveJSON
(\ s h x ->
GetResourceConfigHistoryResponse' <$>
(x .?> "nextToken") <*>
(x .?> "configurationItems" .!@ mempty)
<*> (pure (fromEnum s)))
instance ToHeaders GetResourceConfigHistory where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("StarlingDoveService.GetResourceConfigHistory" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetResourceConfigHistory where
toJSON GetResourceConfigHistory'{..}
= object
(catMaybes
[("chronologicalOrder" .=) <$>
_grchChronologicalOrder,
("nextToken" .=) <$> _grchNextToken,
("limit" .=) <$> _grchLimit,
("laterTime" .=) <$> _grchLaterTime,
("earlierTime" .=) <$> _grchEarlierTime,
Just ("resourceType" .= _grchResourceType),
Just ("resourceId" .= _grchResourceId)])
instance ToPath GetResourceConfigHistory where
toPath = const "/"
instance ToQuery GetResourceConfigHistory where
toQuery = const mempty
data GetResourceConfigHistoryResponse = GetResourceConfigHistoryResponse'
{ _grchrsNextToken :: !(Maybe Text)
, _grchrsConfigurationItems :: !(Maybe [ConfigurationItem])
, _grchrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getResourceConfigHistoryResponse
:: Int
-> GetResourceConfigHistoryResponse
getResourceConfigHistoryResponse pResponseStatus_ =
GetResourceConfigHistoryResponse'
{ _grchrsNextToken = Nothing
, _grchrsConfigurationItems = Nothing
, _grchrsResponseStatus = pResponseStatus_
}
grchrsNextToken :: Lens' GetResourceConfigHistoryResponse (Maybe Text)
grchrsNextToken = lens _grchrsNextToken (\ s a -> s{_grchrsNextToken = a});
grchrsConfigurationItems :: Lens' GetResourceConfigHistoryResponse [ConfigurationItem]
grchrsConfigurationItems = lens _grchrsConfigurationItems (\ s a -> s{_grchrsConfigurationItems = a}) . _Default . _Coerce;
grchrsResponseStatus :: Lens' GetResourceConfigHistoryResponse Int
grchrsResponseStatus = lens _grchrsResponseStatus (\ s a -> s{_grchrsResponseStatus = a});