{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.CloudWatchLogs.CreateExportTask
(
createExportTask
, CreateExportTask
, cetDestinationPrefix
, cetTaskName
, cetLogStreamNamePrefix
, cetLogGroupName
, cetFrom
, cetTo
, cetDestination
, createExportTaskResponse
, CreateExportTaskResponse
, cetrsTaskId
, cetrsResponseStatus
) where
import Network.AWS.CloudWatchLogs.Types
import Network.AWS.CloudWatchLogs.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateExportTask = CreateExportTask'
{ _cetDestinationPrefix :: !(Maybe Text)
, _cetTaskName :: !(Maybe Text)
, _cetLogStreamNamePrefix :: !(Maybe Text)
, _cetLogGroupName :: !Text
, _cetFrom :: !Nat
, _cetTo :: !Nat
, _cetDestination :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createExportTask
:: Text
-> Natural
-> Natural
-> Text
-> CreateExportTask
createExportTask pLogGroupName_ pFrom_ pTo_ pDestination_ =
CreateExportTask'
{ _cetDestinationPrefix = Nothing
, _cetTaskName = Nothing
, _cetLogStreamNamePrefix = Nothing
, _cetLogGroupName = pLogGroupName_
, _cetFrom = _Nat # pFrom_
, _cetTo = _Nat # pTo_
, _cetDestination = pDestination_
}
cetDestinationPrefix :: Lens' CreateExportTask (Maybe Text)
cetDestinationPrefix = lens _cetDestinationPrefix (\ s a -> s{_cetDestinationPrefix = a});
cetTaskName :: Lens' CreateExportTask (Maybe Text)
cetTaskName = lens _cetTaskName (\ s a -> s{_cetTaskName = a});
cetLogStreamNamePrefix :: Lens' CreateExportTask (Maybe Text)
cetLogStreamNamePrefix = lens _cetLogStreamNamePrefix (\ s a -> s{_cetLogStreamNamePrefix = a});
cetLogGroupName :: Lens' CreateExportTask Text
cetLogGroupName = lens _cetLogGroupName (\ s a -> s{_cetLogGroupName = a});
cetFrom :: Lens' CreateExportTask Natural
cetFrom = lens _cetFrom (\ s a -> s{_cetFrom = a}) . _Nat;
cetTo :: Lens' CreateExportTask Natural
cetTo = lens _cetTo (\ s a -> s{_cetTo = a}) . _Nat;
cetDestination :: Lens' CreateExportTask Text
cetDestination = lens _cetDestination (\ s a -> s{_cetDestination = a});
instance AWSRequest CreateExportTask where
type Rs CreateExportTask = CreateExportTaskResponse
request = postJSON cloudWatchLogs
response
= receiveJSON
(\ s h x ->
CreateExportTaskResponse' <$>
(x .?> "taskId") <*> (pure (fromEnum s)))
instance Hashable CreateExportTask
instance NFData CreateExportTask
instance ToHeaders CreateExportTask where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Logs_20140328.CreateExportTask" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateExportTask where
toJSON CreateExportTask'{..}
= object
(catMaybes
[("destinationPrefix" .=) <$> _cetDestinationPrefix,
("taskName" .=) <$> _cetTaskName,
("logStreamNamePrefix" .=) <$>
_cetLogStreamNamePrefix,
Just ("logGroupName" .= _cetLogGroupName),
Just ("from" .= _cetFrom), Just ("to" .= _cetTo),
Just ("destination" .= _cetDestination)])
instance ToPath CreateExportTask where
toPath = const "/"
instance ToQuery CreateExportTask where
toQuery = const mempty
data CreateExportTaskResponse = CreateExportTaskResponse'
{ _cetrsTaskId :: !(Maybe Text)
, _cetrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createExportTaskResponse
:: Int
-> CreateExportTaskResponse
createExportTaskResponse pResponseStatus_ =
CreateExportTaskResponse'
{ _cetrsTaskId = Nothing
, _cetrsResponseStatus = pResponseStatus_
}
cetrsTaskId :: Lens' CreateExportTaskResponse (Maybe Text)
cetrsTaskId = lens _cetrsTaskId (\ s a -> s{_cetrsTaskId = a});
cetrsResponseStatus :: Lens' CreateExportTaskResponse Int
cetrsResponseStatus = lens _cetrsResponseStatus (\ s a -> s{_cetrsResponseStatus = a});
instance NFData CreateExportTaskResponse