module Network.AWS.RDS.DownloadDBLogFilePortion
(
DownloadDBLogFilePortion
, downloadDBLogFilePortion
, ddblfpDBInstanceIdentifier
, ddblfpLogFileName
, ddblfpMarker
, ddblfpNumberOfLines
, DownloadDBLogFilePortionResponse
, downloadDBLogFilePortionResponse
, ddblfprAdditionalDataPending
, ddblfprLogFileData
, ddblfprMarker
) where
import Network.AWS.Prelude
import Network.AWS.Request.Query
import Network.AWS.RDS.Types
import qualified GHC.Exts
data DownloadDBLogFilePortion = DownloadDBLogFilePortion
{ _ddblfpDBInstanceIdentifier :: Text
, _ddblfpLogFileName :: Text
, _ddblfpMarker :: Maybe Text
, _ddblfpNumberOfLines :: Maybe Int
} deriving (Eq, Ord, Show)
downloadDBLogFilePortion :: Text
-> Text
-> DownloadDBLogFilePortion
downloadDBLogFilePortion p1 p2 = DownloadDBLogFilePortion
{ _ddblfpDBInstanceIdentifier = p1
, _ddblfpLogFileName = p2
, _ddblfpMarker = Nothing
, _ddblfpNumberOfLines = Nothing
}
ddblfpDBInstanceIdentifier :: Lens' DownloadDBLogFilePortion Text
ddblfpDBInstanceIdentifier =
lens _ddblfpDBInstanceIdentifier
(\s a -> s { _ddblfpDBInstanceIdentifier = a })
ddblfpLogFileName :: Lens' DownloadDBLogFilePortion Text
ddblfpLogFileName =
lens _ddblfpLogFileName (\s a -> s { _ddblfpLogFileName = a })
ddblfpMarker :: Lens' DownloadDBLogFilePortion (Maybe Text)
ddblfpMarker = lens _ddblfpMarker (\s a -> s { _ddblfpMarker = a })
ddblfpNumberOfLines :: Lens' DownloadDBLogFilePortion (Maybe Int)
ddblfpNumberOfLines =
lens _ddblfpNumberOfLines (\s a -> s { _ddblfpNumberOfLines = a })
data DownloadDBLogFilePortionResponse = DownloadDBLogFilePortionResponse
{ _ddblfprAdditionalDataPending :: Maybe Bool
, _ddblfprLogFileData :: Maybe Text
, _ddblfprMarker :: Maybe Text
} deriving (Eq, Ord, Show)
downloadDBLogFilePortionResponse :: DownloadDBLogFilePortionResponse
downloadDBLogFilePortionResponse = DownloadDBLogFilePortionResponse
{ _ddblfprLogFileData = Nothing
, _ddblfprMarker = Nothing
, _ddblfprAdditionalDataPending = Nothing
}
ddblfprAdditionalDataPending :: Lens' DownloadDBLogFilePortionResponse (Maybe Bool)
ddblfprAdditionalDataPending =
lens _ddblfprAdditionalDataPending
(\s a -> s { _ddblfprAdditionalDataPending = a })
ddblfprLogFileData :: Lens' DownloadDBLogFilePortionResponse (Maybe Text)
ddblfprLogFileData =
lens _ddblfprLogFileData (\s a -> s { _ddblfprLogFileData = a })
ddblfprMarker :: Lens' DownloadDBLogFilePortionResponse (Maybe Text)
ddblfprMarker = lens _ddblfprMarker (\s a -> s { _ddblfprMarker = a })
instance ToPath DownloadDBLogFilePortion where
toPath = const "/"
instance ToQuery DownloadDBLogFilePortion where
toQuery DownloadDBLogFilePortion{..} = mconcat
[ "DBInstanceIdentifier" =? _ddblfpDBInstanceIdentifier
, "LogFileName" =? _ddblfpLogFileName
, "Marker" =? _ddblfpMarker
, "NumberOfLines" =? _ddblfpNumberOfLines
]
instance ToHeaders DownloadDBLogFilePortion
instance AWSRequest DownloadDBLogFilePortion where
type Sv DownloadDBLogFilePortion = RDS
type Rs DownloadDBLogFilePortion = DownloadDBLogFilePortionResponse
request = post "DownloadDBLogFilePortion"
response = xmlResponse
instance FromXML DownloadDBLogFilePortionResponse where
parseXML = withElement "DownloadDBLogFilePortionResult" $ \x -> DownloadDBLogFilePortionResponse
<$> x .@? "AdditionalDataPending"
<*> x .@? "LogFileData"
<*> x .@? "Marker"
instance AWSPager DownloadDBLogFilePortion where
page rq rs
| stop (rs ^. ddblfprAdditionalDataPending) = Nothing
| otherwise = Just $ rq
& ddblfpMarker .~ rs ^. ddblfprMarker