{-# 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.Pinpoint.PutEventStream
(
putEventStream
, PutEventStream
, pesApplicationId
, pesWriteEventStream
, putEventStreamResponse
, PutEventStreamResponse
, pesrsResponseStatus
, pesrsEventStream
) where
import Network.AWS.Lens
import Network.AWS.Pinpoint.Types
import Network.AWS.Pinpoint.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data PutEventStream = PutEventStream'
{ _pesApplicationId :: !Text
, _pesWriteEventStream :: !WriteEventStream
} deriving (Eq, Read, Show, Data, Typeable, Generic)
putEventStream
:: Text
-> WriteEventStream
-> PutEventStream
putEventStream pApplicationId_ pWriteEventStream_ =
PutEventStream'
{ _pesApplicationId = pApplicationId_
, _pesWriteEventStream = pWriteEventStream_
}
pesApplicationId :: Lens' PutEventStream Text
pesApplicationId = lens _pesApplicationId (\ s a -> s{_pesApplicationId = a})
pesWriteEventStream :: Lens' PutEventStream WriteEventStream
pesWriteEventStream = lens _pesWriteEventStream (\ s a -> s{_pesWriteEventStream = a})
instance AWSRequest PutEventStream where
type Rs PutEventStream = PutEventStreamResponse
request = postJSON pinpoint
response
= receiveJSON
(\ s h x ->
PutEventStreamResponse' <$>
(pure (fromEnum s)) <*> (eitherParseJSON x))
instance Hashable PutEventStream where
instance NFData PutEventStream where
instance ToHeaders PutEventStream where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON PutEventStream where
toJSON PutEventStream'{..}
= object
(catMaybes
[Just ("WriteEventStream" .= _pesWriteEventStream)])
instance ToPath PutEventStream where
toPath PutEventStream'{..}
= mconcat
["/v1/apps/", toBS _pesApplicationId, "/eventstream"]
instance ToQuery PutEventStream where
toQuery = const mempty
data PutEventStreamResponse = PutEventStreamResponse'
{ _pesrsResponseStatus :: !Int
, _pesrsEventStream :: !EventStream
} deriving (Eq, Read, Show, Data, Typeable, Generic)
putEventStreamResponse
:: Int
-> EventStream
-> PutEventStreamResponse
putEventStreamResponse pResponseStatus_ pEventStream_ =
PutEventStreamResponse'
{_pesrsResponseStatus = pResponseStatus_, _pesrsEventStream = pEventStream_}
pesrsResponseStatus :: Lens' PutEventStreamResponse Int
pesrsResponseStatus = lens _pesrsResponseStatus (\ s a -> s{_pesrsResponseStatus = a})
pesrsEventStream :: Lens' PutEventStreamResponse EventStream
pesrsEventStream = lens _pesrsEventStream (\ s a -> s{_pesrsEventStream = a})
instance NFData PutEventStreamResponse where