module Network.AWS.CloudHSM.ListHSMs
(
listHSMs
, ListHSMs
, lhsmNextToken
, listHSMsResponse
, ListHSMsResponse
, lhsmrsNextToken
, lhsmrsHSMList
, lhsmrsResponseStatus
) where
import Network.AWS.CloudHSM.Types
import Network.AWS.CloudHSM.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype ListHSMs = ListHSMs'
{ _lhsmNextToken :: Maybe Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listHSMs
:: ListHSMs
listHSMs =
ListHSMs'
{ _lhsmNextToken = Nothing
}
lhsmNextToken :: Lens' ListHSMs (Maybe Text)
lhsmNextToken = lens _lhsmNextToken (\ s a -> s{_lhsmNextToken = a});
instance AWSRequest ListHSMs where
type Rs ListHSMs = ListHSMsResponse
request = postJSON cloudHSM
response
= receiveJSON
(\ s h x ->
ListHSMsResponse' <$>
(x .?> "NextToken") <*> (x .?> "HsmList" .!@ mempty)
<*> (pure (fromEnum s)))
instance ToHeaders ListHSMs where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CloudHsmFrontendService.ListHsms" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListHSMs where
toJSON ListHSMs'{..}
= object
(catMaybes [("NextToken" .=) <$> _lhsmNextToken])
instance ToPath ListHSMs where
toPath = const "/"
instance ToQuery ListHSMs where
toQuery = const mempty
data ListHSMsResponse = ListHSMsResponse'
{ _lhsmrsNextToken :: !(Maybe Text)
, _lhsmrsHSMList :: !(Maybe [Text])
, _lhsmrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listHSMsResponse
:: Int
-> ListHSMsResponse
listHSMsResponse pResponseStatus_ =
ListHSMsResponse'
{ _lhsmrsNextToken = Nothing
, _lhsmrsHSMList = Nothing
, _lhsmrsResponseStatus = pResponseStatus_
}
lhsmrsNextToken :: Lens' ListHSMsResponse (Maybe Text)
lhsmrsNextToken = lens _lhsmrsNextToken (\ s a -> s{_lhsmrsNextToken = a});
lhsmrsHSMList :: Lens' ListHSMsResponse [Text]
lhsmrsHSMList = lens _lhsmrsHSMList (\ s a -> s{_lhsmrsHSMList = a}) . _Default . _Coerce;
lhsmrsResponseStatus :: Lens' ListHSMsResponse Int
lhsmrsResponseStatus = lens _lhsmrsResponseStatus (\ s a -> s{_lhsmrsResponseStatus = a});