{-# 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.GetSegment
(
getSegment
, GetSegment
, gsSegmentId
, gsApplicationId
, getSegmentResponse
, GetSegmentResponse
, gssrsResponseStatus
, gssrsSegmentResponse
) 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 GetSegment = GetSegment'
{ _gsSegmentId :: !Text
, _gsApplicationId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getSegment
:: Text
-> Text
-> GetSegment
getSegment pSegmentId_ pApplicationId_ =
GetSegment' {_gsSegmentId = pSegmentId_, _gsApplicationId = pApplicationId_}
gsSegmentId :: Lens' GetSegment Text
gsSegmentId = lens _gsSegmentId (\ s a -> s{_gsSegmentId = a})
gsApplicationId :: Lens' GetSegment Text
gsApplicationId = lens _gsApplicationId (\ s a -> s{_gsApplicationId = a})
instance AWSRequest GetSegment where
type Rs GetSegment = GetSegmentResponse
request = get pinpoint
response
= receiveJSON
(\ s h x ->
GetSegmentResponse' <$>
(pure (fromEnum s)) <*> (eitherParseJSON x))
instance Hashable GetSegment where
instance NFData GetSegment where
instance ToHeaders GetSegment where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToPath GetSegment where
toPath GetSegment'{..}
= mconcat
["/v1/apps/", toBS _gsApplicationId, "/segments/",
toBS _gsSegmentId]
instance ToQuery GetSegment where
toQuery = const mempty
data GetSegmentResponse = GetSegmentResponse'
{ _gssrsResponseStatus :: !Int
, _gssrsSegmentResponse :: !SegmentResponse
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getSegmentResponse
:: Int
-> SegmentResponse
-> GetSegmentResponse
getSegmentResponse pResponseStatus_ pSegmentResponse_ =
GetSegmentResponse'
{ _gssrsResponseStatus = pResponseStatus_
, _gssrsSegmentResponse = pSegmentResponse_
}
gssrsResponseStatus :: Lens' GetSegmentResponse Int
gssrsResponseStatus = lens _gssrsResponseStatus (\ s a -> s{_gssrsResponseStatus = a})
gssrsSegmentResponse :: Lens' GetSegmentResponse SegmentResponse
gssrsSegmentResponse = lens _gssrsSegmentResponse (\ s a -> s{_gssrsSegmentResponse = a})
instance NFData GetSegmentResponse where