{-# 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.PutLogEvents
(
putLogEvents
, PutLogEvents
, pleSequenceToken
, pleLogGroupName
, pleLogStreamName
, pleLogEvents
, putLogEventsResponse
, PutLogEventsResponse
, plersRejectedLogEventsInfo
, plersNextSequenceToken
, plersResponseStatus
) 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 PutLogEvents = PutLogEvents'
{ _pleSequenceToken :: !(Maybe Text)
, _pleLogGroupName :: !Text
, _pleLogStreamName :: !Text
, _pleLogEvents :: !(List1 InputLogEvent)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
putLogEvents
:: Text
-> Text
-> NonEmpty InputLogEvent
-> PutLogEvents
putLogEvents pLogGroupName_ pLogStreamName_ pLogEvents_ =
PutLogEvents'
{ _pleSequenceToken = Nothing
, _pleLogGroupName = pLogGroupName_
, _pleLogStreamName = pLogStreamName_
, _pleLogEvents = _List1 # pLogEvents_
}
pleSequenceToken :: Lens' PutLogEvents (Maybe Text)
pleSequenceToken = lens _pleSequenceToken (\ s a -> s{_pleSequenceToken = a});
pleLogGroupName :: Lens' PutLogEvents Text
pleLogGroupName = lens _pleLogGroupName (\ s a -> s{_pleLogGroupName = a});
pleLogStreamName :: Lens' PutLogEvents Text
pleLogStreamName = lens _pleLogStreamName (\ s a -> s{_pleLogStreamName = a});
pleLogEvents :: Lens' PutLogEvents (NonEmpty InputLogEvent)
pleLogEvents = lens _pleLogEvents (\ s a -> s{_pleLogEvents = a}) . _List1;
instance AWSRequest PutLogEvents where
type Rs PutLogEvents = PutLogEventsResponse
request = postJSON cloudWatchLogs
response
= receiveJSON
(\ s h x ->
PutLogEventsResponse' <$>
(x .?> "rejectedLogEventsInfo") <*>
(x .?> "nextSequenceToken")
<*> (pure (fromEnum s)))
instance Hashable PutLogEvents
instance NFData PutLogEvents
instance ToHeaders PutLogEvents where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Logs_20140328.PutLogEvents" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON PutLogEvents where
toJSON PutLogEvents'{..}
= object
(catMaybes
[("sequenceToken" .=) <$> _pleSequenceToken,
Just ("logGroupName" .= _pleLogGroupName),
Just ("logStreamName" .= _pleLogStreamName),
Just ("logEvents" .= _pleLogEvents)])
instance ToPath PutLogEvents where
toPath = const "/"
instance ToQuery PutLogEvents where
toQuery = const mempty
data PutLogEventsResponse = PutLogEventsResponse'
{ _plersRejectedLogEventsInfo :: !(Maybe RejectedLogEventsInfo)
, _plersNextSequenceToken :: !(Maybe Text)
, _plersResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
putLogEventsResponse
:: Int
-> PutLogEventsResponse
putLogEventsResponse pResponseStatus_ =
PutLogEventsResponse'
{ _plersRejectedLogEventsInfo = Nothing
, _plersNextSequenceToken = Nothing
, _plersResponseStatus = pResponseStatus_
}
plersRejectedLogEventsInfo :: Lens' PutLogEventsResponse (Maybe RejectedLogEventsInfo)
plersRejectedLogEventsInfo = lens _plersRejectedLogEventsInfo (\ s a -> s{_plersRejectedLogEventsInfo = a});
plersNextSequenceToken :: Lens' PutLogEventsResponse (Maybe Text)
plersNextSequenceToken = lens _plersNextSequenceToken (\ s a -> s{_plersNextSequenceToken = a});
plersResponseStatus :: Lens' PutLogEventsResponse Int
plersResponseStatus = lens _plersResponseStatus (\ s a -> s{_plersResponseStatus = a});
instance NFData PutLogEventsResponse