module Network.AWS.CloudFront.ListInvalidations
(
ListInvalidations
, listInvalidations
, liDistributionId
, liMarker
, liMaxItems
, ListInvalidationsResponse
, listInvalidationsResponse
, lirInvalidationList
) where
import Network.AWS.Prelude
import Network.AWS.Request.RestXML
import Network.AWS.CloudFront.Types
import qualified GHC.Exts
data ListInvalidations = ListInvalidations
{ _liDistributionId :: Text
, _liMarker :: Maybe Text
, _liMaxItems :: Maybe Text
} deriving (Eq, Ord, Read, Show)
listInvalidations :: Text
-> ListInvalidations
listInvalidations p1 = ListInvalidations
{ _liDistributionId = p1
, _liMarker = Nothing
, _liMaxItems = Nothing
}
liDistributionId :: Lens' ListInvalidations Text
liDistributionId = lens _liDistributionId (\s a -> s { _liDistributionId = a })
liMarker :: Lens' ListInvalidations (Maybe Text)
liMarker = lens _liMarker (\s a -> s { _liMarker = a })
liMaxItems :: Lens' ListInvalidations (Maybe Text)
liMaxItems = lens _liMaxItems (\s a -> s { _liMaxItems = a })
newtype ListInvalidationsResponse = ListInvalidationsResponse
{ _lirInvalidationList :: InvalidationList
} deriving (Eq, Read, Show)
listInvalidationsResponse :: InvalidationList
-> ListInvalidationsResponse
listInvalidationsResponse p1 = ListInvalidationsResponse
{ _lirInvalidationList = p1
}
lirInvalidationList :: Lens' ListInvalidationsResponse InvalidationList
lirInvalidationList =
lens _lirInvalidationList (\s a -> s { _lirInvalidationList = a })
instance ToPath ListInvalidations where
toPath ListInvalidations{..} = mconcat
[ "/2014-11-06/distribution/"
, toText _liDistributionId
, "/invalidation"
]
instance ToQuery ListInvalidations where
toQuery ListInvalidations{..} = mconcat
[ "Marker" =? _liMarker
, "MaxItems" =? _liMaxItems
]
instance ToHeaders ListInvalidations
instance ToXMLRoot ListInvalidations where
toXMLRoot = const (namespaced ns "ListInvalidations" [])
instance ToXML ListInvalidations
instance AWSRequest ListInvalidations where
type Sv ListInvalidations = CloudFront
type Rs ListInvalidations = ListInvalidationsResponse
request = get
response = xmlResponse
instance FromXML ListInvalidationsResponse where
parseXML x = ListInvalidationsResponse
<$> x .@ "InvalidationList"
instance AWSPager ListInvalidations where
page rq rs
| stop (rs ^. lirInvalidationList . ilIsTruncated) = Nothing
| otherwise = Just $ rq
& liMarker .~ rs ^. lirInvalidationList . ilNextMarker