module Network.AWS.CloudFront.GetDistribution
(
GetDistribution
, getDistribution
, gdId
, GetDistributionResponse
, getDistributionResponse
, gdrDistribution
, gdrETag
) where
import Network.AWS.Prelude
import Network.AWS.Request.RestXML
import Network.AWS.CloudFront.Types
import qualified GHC.Exts
newtype GetDistribution = GetDistribution
{ _gdId :: Text
} deriving (Eq, Ord, Read, Show, Monoid, IsString)
getDistribution :: Text
-> GetDistribution
getDistribution p1 = GetDistribution
{ _gdId = p1
}
gdId :: Lens' GetDistribution Text
gdId = lens _gdId (\s a -> s { _gdId = a })
data GetDistributionResponse = GetDistributionResponse
{ _gdrDistribution :: Maybe Distribution
, _gdrETag :: Maybe Text
} deriving (Eq, Read, Show)
getDistributionResponse :: GetDistributionResponse
getDistributionResponse = GetDistributionResponse
{ _gdrDistribution = Nothing
, _gdrETag = Nothing
}
gdrDistribution :: Lens' GetDistributionResponse (Maybe Distribution)
gdrDistribution = lens _gdrDistribution (\s a -> s { _gdrDistribution = a })
gdrETag :: Lens' GetDistributionResponse (Maybe Text)
gdrETag = lens _gdrETag (\s a -> s { _gdrETag = a })
instance ToPath GetDistribution where
toPath GetDistribution{..} = mconcat
[ "/2014-11-06/distribution/"
, toText _gdId
]
instance ToQuery GetDistribution where
toQuery = const mempty
instance ToHeaders GetDistribution
instance ToXMLRoot GetDistribution where
toXMLRoot = const (namespaced ns "GetDistribution" [])
instance ToXML GetDistribution
instance AWSRequest GetDistribution where
type Sv GetDistribution = CloudFront
type Rs GetDistribution = GetDistributionResponse
request = get
response = xmlHeaderResponse $ \h x -> GetDistributionResponse
<$> x .@? "Distribution"
<*> h ~:? "ETag"