module Network.AWS.DeviceFarm.CreateDevicePool
(
createDevicePool
, CreateDevicePool
, cdpDescription
, cdpProjectARN
, cdpName
, cdpRules
, createDevicePoolResponse
, CreateDevicePoolResponse
, cdprsDevicePool
, cdprsResponseStatus
) where
import Network.AWS.DeviceFarm.Types
import Network.AWS.DeviceFarm.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateDevicePool = CreateDevicePool'
{ _cdpDescription :: !(Maybe Text)
, _cdpProjectARN :: !Text
, _cdpName :: !Text
, _cdpRules :: ![Rule]
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createDevicePool
:: Text
-> Text
-> CreateDevicePool
createDevicePool pProjectARN_ pName_ =
CreateDevicePool'
{ _cdpDescription = Nothing
, _cdpProjectARN = pProjectARN_
, _cdpName = pName_
, _cdpRules = mempty
}
cdpDescription :: Lens' CreateDevicePool (Maybe Text)
cdpDescription = lens _cdpDescription (\ s a -> s{_cdpDescription = a});
cdpProjectARN :: Lens' CreateDevicePool Text
cdpProjectARN = lens _cdpProjectARN (\ s a -> s{_cdpProjectARN = a});
cdpName :: Lens' CreateDevicePool Text
cdpName = lens _cdpName (\ s a -> s{_cdpName = a});
cdpRules :: Lens' CreateDevicePool [Rule]
cdpRules = lens _cdpRules (\ s a -> s{_cdpRules = a}) . _Coerce;
instance AWSRequest CreateDevicePool where
type Rs CreateDevicePool = CreateDevicePoolResponse
request = postJSON deviceFarm
response
= receiveJSON
(\ s h x ->
CreateDevicePoolResponse' <$>
(x .?> "devicePool") <*> (pure (fromEnum s)))
instance ToHeaders CreateDevicePool where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DeviceFarm_20150623.CreateDevicePool" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateDevicePool where
toJSON CreateDevicePool'{..}
= object
(catMaybes
[("description" .=) <$> _cdpDescription,
Just ("projectArn" .= _cdpProjectARN),
Just ("name" .= _cdpName),
Just ("rules" .= _cdpRules)])
instance ToPath CreateDevicePool where
toPath = const "/"
instance ToQuery CreateDevicePool where
toQuery = const mempty
data CreateDevicePoolResponse = CreateDevicePoolResponse'
{ _cdprsDevicePool :: !(Maybe DevicePool)
, _cdprsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createDevicePoolResponse
:: Int
-> CreateDevicePoolResponse
createDevicePoolResponse pResponseStatus_ =
CreateDevicePoolResponse'
{ _cdprsDevicePool = Nothing
, _cdprsResponseStatus = pResponseStatus_
}
cdprsDevicePool :: Lens' CreateDevicePoolResponse (Maybe DevicePool)
cdprsDevicePool = lens _cdprsDevicePool (\ s a -> s{_cdprsDevicePool = a});
cdprsResponseStatus :: Lens' CreateDevicePoolResponse Int
cdprsResponseStatus = lens _cdprsResponseStatus (\ s a -> s{_cdprsResponseStatus = a});