module Network.AWS.CloudFront.GetDistribution
(
getDistribution
, GetDistribution
, gdId
, getDistributionResponse
, GetDistributionResponse
, gdrsETag
, gdrsDistribution
, gdrsResponseStatus
) where
import Network.AWS.CloudFront.Types
import Network.AWS.CloudFront.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype GetDistribution = GetDistribution'
{ _gdId :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getDistribution
:: Text
-> GetDistribution
getDistribution pId_ =
GetDistribution'
{ _gdId = pId_
}
gdId :: Lens' GetDistribution Text
gdId = lens _gdId (\ s a -> s{_gdId = a});
instance AWSRequest GetDistribution where
type Rs GetDistribution = GetDistributionResponse
request = get cloudFront
response
= receiveXML
(\ s h x ->
GetDistributionResponse' <$>
(h .#? "ETag") <*> (parseXML x) <*>
(pure (fromEnum s)))
instance ToHeaders GetDistribution where
toHeaders = const mempty
instance ToPath GetDistribution where
toPath GetDistribution'{..}
= mconcat ["/2015-07-27/distribution/", toBS _gdId]
instance ToQuery GetDistribution where
toQuery = const mempty
data GetDistributionResponse = GetDistributionResponse'
{ _gdrsETag :: !(Maybe Text)
, _gdrsDistribution :: !(Maybe Distribution)
, _gdrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getDistributionResponse
:: Int
-> GetDistributionResponse
getDistributionResponse pResponseStatus_ =
GetDistributionResponse'
{ _gdrsETag = Nothing
, _gdrsDistribution = Nothing
, _gdrsResponseStatus = pResponseStatus_
}
gdrsETag :: Lens' GetDistributionResponse (Maybe Text)
gdrsETag = lens _gdrsETag (\ s a -> s{_gdrsETag = a});
gdrsDistribution :: Lens' GetDistributionResponse (Maybe Distribution)
gdrsDistribution = lens _gdrsDistribution (\ s a -> s{_gdrsDistribution = a});
gdrsResponseStatus :: Lens' GetDistributionResponse Int
gdrsResponseStatus = lens _gdrsResponseStatus (\ s a -> s{_gdrsResponseStatus = a});