module Network.AWS.StorageGateway.AddCache
(
addCache
, AddCache
, acGatewayARN
, acDiskIds
, addCacheResponse
, AddCacheResponse
, acrsGatewayARN
, acrsResponseStatus
) where
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.StorageGateway.Types
import Network.AWS.StorageGateway.Types.Product
data AddCache = AddCache'
{ _acGatewayARN :: !Text
, _acDiskIds :: ![Text]
} deriving (Eq,Read,Show,Data,Typeable,Generic)
addCache
:: Text
-> AddCache
addCache pGatewayARN_ =
AddCache'
{ _acGatewayARN = pGatewayARN_
, _acDiskIds = mempty
}
acGatewayARN :: Lens' AddCache Text
acGatewayARN = lens _acGatewayARN (\ s a -> s{_acGatewayARN = a});
acDiskIds :: Lens' AddCache [Text]
acDiskIds = lens _acDiskIds (\ s a -> s{_acDiskIds = a}) . _Coerce;
instance AWSRequest AddCache where
type Rs AddCache = AddCacheResponse
request = postJSON storageGateway
response
= receiveJSON
(\ s h x ->
AddCacheResponse' <$>
(x .?> "GatewayARN") <*> (pure (fromEnum s)))
instance ToHeaders AddCache where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("StorageGateway_20130630.AddCache" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON AddCache where
toJSON AddCache'{..}
= object
(catMaybes
[Just ("GatewayARN" .= _acGatewayARN),
Just ("DiskIds" .= _acDiskIds)])
instance ToPath AddCache where
toPath = const "/"
instance ToQuery AddCache where
toQuery = const mempty
data AddCacheResponse = AddCacheResponse'
{ _acrsGatewayARN :: !(Maybe Text)
, _acrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
addCacheResponse
:: Int
-> AddCacheResponse
addCacheResponse pResponseStatus_ =
AddCacheResponse'
{ _acrsGatewayARN = Nothing
, _acrsResponseStatus = pResponseStatus_
}
acrsGatewayARN :: Lens' AddCacheResponse (Maybe Text)
acrsGatewayARN = lens _acrsGatewayARN (\ s a -> s{_acrsGatewayARN = a});
acrsResponseStatus :: Lens' AddCacheResponse Int
acrsResponseStatus = lens _acrsResponseStatus (\ s a -> s{_acrsResponseStatus = a});