module Network.AWS.Redshift.EnableLogging
(
EnableLogging
, enableLogging
, elBucketName
, elClusterIdentifier
, elS3KeyPrefix
, EnableLoggingResponse
, enableLoggingResponse
, elrBucketName
, elrLastFailureMessage
, elrLastFailureTime
, elrLastSuccessfulDeliveryTime
, elrLoggingEnabled
, elrS3KeyPrefix
) where
import Network.AWS.Prelude
import Network.AWS.Request.Query
import Network.AWS.Redshift.Types
import qualified GHC.Exts
data EnableLogging = EnableLogging
{ _elBucketName :: Text
, _elClusterIdentifier :: Text
, _elS3KeyPrefix :: Maybe Text
} deriving (Eq, Ord, Read, Show)
enableLogging :: Text
-> Text
-> EnableLogging
enableLogging p1 p2 = EnableLogging
{ _elClusterIdentifier = p1
, _elBucketName = p2
, _elS3KeyPrefix = Nothing
}
elBucketName :: Lens' EnableLogging Text
elBucketName = lens _elBucketName (\s a -> s { _elBucketName = a })
elClusterIdentifier :: Lens' EnableLogging Text
elClusterIdentifier =
lens _elClusterIdentifier (\s a -> s { _elClusterIdentifier = a })
elS3KeyPrefix :: Lens' EnableLogging (Maybe Text)
elS3KeyPrefix = lens _elS3KeyPrefix (\s a -> s { _elS3KeyPrefix = a })
data EnableLoggingResponse = EnableLoggingResponse
{ _elrBucketName :: Maybe Text
, _elrLastFailureMessage :: Maybe Text
, _elrLastFailureTime :: Maybe ISO8601
, _elrLastSuccessfulDeliveryTime :: Maybe ISO8601
, _elrLoggingEnabled :: Maybe Bool
, _elrS3KeyPrefix :: Maybe Text
} deriving (Eq, Ord, Read, Show)
enableLoggingResponse :: EnableLoggingResponse
enableLoggingResponse = EnableLoggingResponse
{ _elrLoggingEnabled = Nothing
, _elrBucketName = Nothing
, _elrS3KeyPrefix = Nothing
, _elrLastSuccessfulDeliveryTime = Nothing
, _elrLastFailureTime = Nothing
, _elrLastFailureMessage = Nothing
}
elrBucketName :: Lens' EnableLoggingResponse (Maybe Text)
elrBucketName = lens _elrBucketName (\s a -> s { _elrBucketName = a })
elrLastFailureMessage :: Lens' EnableLoggingResponse (Maybe Text)
elrLastFailureMessage =
lens _elrLastFailureMessage (\s a -> s { _elrLastFailureMessage = a })
elrLastFailureTime :: Lens' EnableLoggingResponse (Maybe UTCTime)
elrLastFailureTime =
lens _elrLastFailureTime (\s a -> s { _elrLastFailureTime = a })
. mapping _Time
elrLastSuccessfulDeliveryTime :: Lens' EnableLoggingResponse (Maybe UTCTime)
elrLastSuccessfulDeliveryTime =
lens _elrLastSuccessfulDeliveryTime
(\s a -> s { _elrLastSuccessfulDeliveryTime = a })
. mapping _Time
elrLoggingEnabled :: Lens' EnableLoggingResponse (Maybe Bool)
elrLoggingEnabled =
lens _elrLoggingEnabled (\s a -> s { _elrLoggingEnabled = a })
elrS3KeyPrefix :: Lens' EnableLoggingResponse (Maybe Text)
elrS3KeyPrefix = lens _elrS3KeyPrefix (\s a -> s { _elrS3KeyPrefix = a })
instance ToPath EnableLogging where
toPath = const "/"
instance ToQuery EnableLogging where
toQuery EnableLogging{..} = mconcat
[ "BucketName" =? _elBucketName
, "ClusterIdentifier" =? _elClusterIdentifier
, "S3KeyPrefix" =? _elS3KeyPrefix
]
instance ToHeaders EnableLogging
instance AWSRequest EnableLogging where
type Sv EnableLogging = Redshift
type Rs EnableLogging = EnableLoggingResponse
request = post "EnableLogging"
response = xmlResponse
instance FromXML EnableLoggingResponse where
parseXML = withElement "EnableLoggingResult" $ \x -> EnableLoggingResponse
<$> x .@? "BucketName"
<*> x .@? "LastFailureMessage"
<*> x .@? "LastFailureTime"
<*> x .@? "LastSuccessfulDeliveryTime"
<*> x .@? "LoggingEnabled"
<*> x .@? "S3KeyPrefix"