module Network.AWS.DeviceFarm.GetDevice
(
getDevice
, GetDevice
, gdArn
, getDeviceResponse
, GetDeviceResponse
, gdrsDevice
, gdrsResponseStatus
) where
import Network.AWS.DeviceFarm.Types
import Network.AWS.DeviceFarm.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype GetDevice = GetDevice'
{ _gdArn :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getDevice
:: Text
-> GetDevice
getDevice pArn_ =
GetDevice'
{ _gdArn = pArn_
}
gdArn :: Lens' GetDevice Text
gdArn = lens _gdArn (\ s a -> s{_gdArn = a});
instance AWSRequest GetDevice where
type Rs GetDevice = GetDeviceResponse
request = postJSON deviceFarm
response
= receiveJSON
(\ s h x ->
GetDeviceResponse' <$>
(x .?> "device") <*> (pure (fromEnum s)))
instance ToHeaders GetDevice where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DeviceFarm_20150623.GetDevice" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetDevice where
toJSON GetDevice'{..}
= object (catMaybes [Just ("arn" .= _gdArn)])
instance ToPath GetDevice where
toPath = const "/"
instance ToQuery GetDevice where
toQuery = const mempty
data GetDeviceResponse = GetDeviceResponse'
{ _gdrsDevice :: !(Maybe Device)
, _gdrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getDeviceResponse
:: Int
-> GetDeviceResponse
getDeviceResponse pResponseStatus_ =
GetDeviceResponse'
{ _gdrsDevice = Nothing
, _gdrsResponseStatus = pResponseStatus_
}
gdrsDevice :: Lens' GetDeviceResponse (Maybe Device)
gdrsDevice = lens _gdrsDevice (\ s a -> s{_gdrsDevice = a});
gdrsResponseStatus :: Lens' GetDeviceResponse Int
gdrsResponseStatus = lens _gdrsResponseStatus (\ s a -> s{_gdrsResponseStatus = a});