module Network.AWS.EC2.CreateFlowLogs
(
createFlowLogs
, CreateFlowLogs
, cflClientToken
, cflResourceIds
, cflResourceType
, cflTrafficType
, cflLogGroupName
, cflDeliverLogsPermissionARN
, createFlowLogsResponse
, CreateFlowLogsResponse
, cflrsUnsuccessful
, cflrsClientToken
, cflrsFlowLogIds
, cflrsResponseStatus
) where
import Network.AWS.EC2.Types
import Network.AWS.EC2.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateFlowLogs = CreateFlowLogs'
{ _cflClientToken :: !(Maybe Text)
, _cflResourceIds :: ![Text]
, _cflResourceType :: !FlowLogsResourceType
, _cflTrafficType :: !TrafficType
, _cflLogGroupName :: !Text
, _cflDeliverLogsPermissionARN :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createFlowLogs
:: FlowLogsResourceType
-> TrafficType
-> Text
-> Text
-> CreateFlowLogs
createFlowLogs pResourceType_ pTrafficType_ pLogGroupName_ pDeliverLogsPermissionARN_ =
CreateFlowLogs'
{ _cflClientToken = Nothing
, _cflResourceIds = mempty
, _cflResourceType = pResourceType_
, _cflTrafficType = pTrafficType_
, _cflLogGroupName = pLogGroupName_
, _cflDeliverLogsPermissionARN = pDeliverLogsPermissionARN_
}
cflClientToken :: Lens' CreateFlowLogs (Maybe Text)
cflClientToken = lens _cflClientToken (\ s a -> s{_cflClientToken = a});
cflResourceIds :: Lens' CreateFlowLogs [Text]
cflResourceIds = lens _cflResourceIds (\ s a -> s{_cflResourceIds = a}) . _Coerce;
cflResourceType :: Lens' CreateFlowLogs FlowLogsResourceType
cflResourceType = lens _cflResourceType (\ s a -> s{_cflResourceType = a});
cflTrafficType :: Lens' CreateFlowLogs TrafficType
cflTrafficType = lens _cflTrafficType (\ s a -> s{_cflTrafficType = a});
cflLogGroupName :: Lens' CreateFlowLogs Text
cflLogGroupName = lens _cflLogGroupName (\ s a -> s{_cflLogGroupName = a});
cflDeliverLogsPermissionARN :: Lens' CreateFlowLogs Text
cflDeliverLogsPermissionARN = lens _cflDeliverLogsPermissionARN (\ s a -> s{_cflDeliverLogsPermissionARN = a});
instance AWSRequest CreateFlowLogs where
type Rs CreateFlowLogs = CreateFlowLogsResponse
request = postQuery eC2
response
= receiveXML
(\ s h x ->
CreateFlowLogsResponse' <$>
(x .@? "unsuccessful" .!@ mempty >>=
may (parseXMLList "item"))
<*> (x .@? "clientToken")
<*>
(x .@? "flowLogIdSet" .!@ mempty >>=
may (parseXMLList "item"))
<*> (pure (fromEnum s)))
instance ToHeaders CreateFlowLogs where
toHeaders = const mempty
instance ToPath CreateFlowLogs where
toPath = const "/"
instance ToQuery CreateFlowLogs where
toQuery CreateFlowLogs'{..}
= mconcat
["Action" =: ("CreateFlowLogs" :: ByteString),
"Version" =: ("2015-10-01" :: ByteString),
"ClientToken" =: _cflClientToken,
toQueryList "ResourceId" _cflResourceIds,
"ResourceType" =: _cflResourceType,
"TrafficType" =: _cflTrafficType,
"LogGroupName" =: _cflLogGroupName,
"DeliverLogsPermissionArn" =:
_cflDeliverLogsPermissionARN]
data CreateFlowLogsResponse = CreateFlowLogsResponse'
{ _cflrsUnsuccessful :: !(Maybe [UnsuccessfulItem])
, _cflrsClientToken :: !(Maybe Text)
, _cflrsFlowLogIds :: !(Maybe [Text])
, _cflrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createFlowLogsResponse
:: Int
-> CreateFlowLogsResponse
createFlowLogsResponse pResponseStatus_ =
CreateFlowLogsResponse'
{ _cflrsUnsuccessful = Nothing
, _cflrsClientToken = Nothing
, _cflrsFlowLogIds = Nothing
, _cflrsResponseStatus = pResponseStatus_
}
cflrsUnsuccessful :: Lens' CreateFlowLogsResponse [UnsuccessfulItem]
cflrsUnsuccessful = lens _cflrsUnsuccessful (\ s a -> s{_cflrsUnsuccessful = a}) . _Default . _Coerce;
cflrsClientToken :: Lens' CreateFlowLogsResponse (Maybe Text)
cflrsClientToken = lens _cflrsClientToken (\ s a -> s{_cflrsClientToken = a});
cflrsFlowLogIds :: Lens' CreateFlowLogsResponse [Text]
cflrsFlowLogIds = lens _cflrsFlowLogIds (\ s a -> s{_cflrsFlowLogIds = a}) . _Default . _Coerce;
cflrsResponseStatus :: Lens' CreateFlowLogsResponse Int
cflrsResponseStatus = lens _cflrsResponseStatus (\ s a -> s{_cflrsResponseStatus = a});