{-# 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.UpdateSegment
(
updateSegment
, UpdateSegment
, usSegmentId
, usApplicationId
, usWriteSegmentRequest
, updateSegmentResponse
, UpdateSegmentResponse
, usrsResponseStatus
, usrsSegmentResponse
) 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 UpdateSegment = UpdateSegment'
{ _usSegmentId :: !Text
, _usApplicationId :: !Text
, _usWriteSegmentRequest :: !WriteSegmentRequest
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateSegment
:: Text
-> Text
-> WriteSegmentRequest
-> UpdateSegment
updateSegment pSegmentId_ pApplicationId_ pWriteSegmentRequest_ =
UpdateSegment'
{ _usSegmentId = pSegmentId_
, _usApplicationId = pApplicationId_
, _usWriteSegmentRequest = pWriteSegmentRequest_
}
usSegmentId :: Lens' UpdateSegment Text
usSegmentId = lens _usSegmentId (\ s a -> s{_usSegmentId = a})
usApplicationId :: Lens' UpdateSegment Text
usApplicationId = lens _usApplicationId (\ s a -> s{_usApplicationId = a})
usWriteSegmentRequest :: Lens' UpdateSegment WriteSegmentRequest
usWriteSegmentRequest = lens _usWriteSegmentRequest (\ s a -> s{_usWriteSegmentRequest = a})
instance AWSRequest UpdateSegment where
type Rs UpdateSegment = UpdateSegmentResponse
request = putJSON pinpoint
response
= receiveJSON
(\ s h x ->
UpdateSegmentResponse' <$>
(pure (fromEnum s)) <*> (eitherParseJSON x))
instance Hashable UpdateSegment where
instance NFData UpdateSegment where
instance ToHeaders UpdateSegment where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateSegment where
toJSON UpdateSegment'{..}
= object
(catMaybes
[Just
("WriteSegmentRequest" .= _usWriteSegmentRequest)])
instance ToPath UpdateSegment where
toPath UpdateSegment'{..}
= mconcat
["/v1/apps/", toBS _usApplicationId, "/segments/",
toBS _usSegmentId]
instance ToQuery UpdateSegment where
toQuery = const mempty
data UpdateSegmentResponse = UpdateSegmentResponse'
{ _usrsResponseStatus :: !Int
, _usrsSegmentResponse :: !SegmentResponse
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateSegmentResponse
:: Int
-> SegmentResponse
-> UpdateSegmentResponse
updateSegmentResponse pResponseStatus_ pSegmentResponse_ =
UpdateSegmentResponse'
{ _usrsResponseStatus = pResponseStatus_
, _usrsSegmentResponse = pSegmentResponse_
}
usrsResponseStatus :: Lens' UpdateSegmentResponse Int
usrsResponseStatus = lens _usrsResponseStatus (\ s a -> s{_usrsResponseStatus = a})
usrsSegmentResponse :: Lens' UpdateSegmentResponse SegmentResponse
usrsSegmentResponse = lens _usrsSegmentResponse (\ s a -> s{_usrsSegmentResponse = a})
instance NFData UpdateSegmentResponse where