{-# 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.EC2.ReleaseHosts
(
releaseHosts
, ReleaseHosts
, rhHostIds
, releaseHostsResponse
, ReleaseHostsResponse
, rhrsUnsuccessful
, rhrsSuccessful
, rhrsResponseStatus
) where
import Network.AWS.EC2.Types
import Network.AWS.EC2.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype ReleaseHosts = ReleaseHosts'
{ _rhHostIds :: [Text]
} deriving (Eq,Read,Show,Data,Typeable,Generic)
releaseHosts
:: ReleaseHosts
releaseHosts =
ReleaseHosts'
{ _rhHostIds = mempty
}
rhHostIds :: Lens' ReleaseHosts [Text]
rhHostIds = lens _rhHostIds (\ s a -> s{_rhHostIds = a}) . _Coerce;
instance AWSRequest ReleaseHosts where
type Rs ReleaseHosts = ReleaseHostsResponse
request = postQuery ec2
response
= receiveXML
(\ s h x ->
ReleaseHostsResponse' <$>
(x .@? "unsuccessful" .!@ mempty >>=
may (parseXMLList "item"))
<*>
(x .@? "successful" .!@ mempty >>=
may (parseXMLList "item"))
<*> (pure (fromEnum s)))
instance Hashable ReleaseHosts
instance NFData ReleaseHosts
instance ToHeaders ReleaseHosts where
toHeaders = const mempty
instance ToPath ReleaseHosts where
toPath = const "/"
instance ToQuery ReleaseHosts where
toQuery ReleaseHosts'{..}
= mconcat
["Action" =: ("ReleaseHosts" :: ByteString),
"Version" =: ("2016-11-15" :: ByteString),
toQueryList "HostId" _rhHostIds]
data ReleaseHostsResponse = ReleaseHostsResponse'
{ _rhrsUnsuccessful :: !(Maybe [UnsuccessfulItem])
, _rhrsSuccessful :: !(Maybe [Text])
, _rhrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
releaseHostsResponse
:: Int
-> ReleaseHostsResponse
releaseHostsResponse pResponseStatus_ =
ReleaseHostsResponse'
{ _rhrsUnsuccessful = Nothing
, _rhrsSuccessful = Nothing
, _rhrsResponseStatus = pResponseStatus_
}
rhrsUnsuccessful :: Lens' ReleaseHostsResponse [UnsuccessfulItem]
rhrsUnsuccessful = lens _rhrsUnsuccessful (\ s a -> s{_rhrsUnsuccessful = a}) . _Default . _Coerce;
rhrsSuccessful :: Lens' ReleaseHostsResponse [Text]
rhrsSuccessful = lens _rhrsSuccessful (\ s a -> s{_rhrsSuccessful = a}) . _Default . _Coerce;
rhrsResponseStatus :: Lens' ReleaseHostsResponse Int
rhrsResponseStatus = lens _rhrsResponseStatus (\ s a -> s{_rhrsResponseStatus = a});
instance NFData ReleaseHostsResponse