{-# 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.StorageGateway.AddWorkingStorage
(
addWorkingStorage
, AddWorkingStorage
, awsGatewayARN
, awsDiskIds
, addWorkingStorageResponse
, AddWorkingStorageResponse
, awsrsGatewayARN
, awsrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.StorageGateway.Types
import Network.AWS.StorageGateway.Types.Product
data AddWorkingStorage = AddWorkingStorage'
{ _awsGatewayARN :: !Text
, _awsDiskIds :: ![Text]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
addWorkingStorage
:: Text
-> AddWorkingStorage
addWorkingStorage pGatewayARN_ =
AddWorkingStorage' {_awsGatewayARN = pGatewayARN_, _awsDiskIds = mempty}
awsGatewayARN :: Lens' AddWorkingStorage Text
awsGatewayARN = lens _awsGatewayARN (\ s a -> s{_awsGatewayARN = a})
awsDiskIds :: Lens' AddWorkingStorage [Text]
awsDiskIds = lens _awsDiskIds (\ s a -> s{_awsDiskIds = a}) . _Coerce
instance AWSRequest AddWorkingStorage where
type Rs AddWorkingStorage = AddWorkingStorageResponse
request = postJSON storageGateway
response
= receiveJSON
(\ s h x ->
AddWorkingStorageResponse' <$>
(x .?> "GatewayARN") <*> (pure (fromEnum s)))
instance Hashable AddWorkingStorage where
instance NFData AddWorkingStorage where
instance ToHeaders AddWorkingStorage where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("StorageGateway_20130630.AddWorkingStorage" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON AddWorkingStorage where
toJSON AddWorkingStorage'{..}
= object
(catMaybes
[Just ("GatewayARN" .= _awsGatewayARN),
Just ("DiskIds" .= _awsDiskIds)])
instance ToPath AddWorkingStorage where
toPath = const "/"
instance ToQuery AddWorkingStorage where
toQuery = const mempty
data AddWorkingStorageResponse = AddWorkingStorageResponse'
{ _awsrsGatewayARN :: !(Maybe Text)
, _awsrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
addWorkingStorageResponse
:: Int
-> AddWorkingStorageResponse
addWorkingStorageResponse pResponseStatus_ =
AddWorkingStorageResponse'
{_awsrsGatewayARN = Nothing, _awsrsResponseStatus = pResponseStatus_}
awsrsGatewayARN :: Lens' AddWorkingStorageResponse (Maybe Text)
awsrsGatewayARN = lens _awsrsGatewayARN (\ s a -> s{_awsrsGatewayARN = a})
awsrsResponseStatus :: Lens' AddWorkingStorageResponse Int
awsrsResponseStatus = lens _awsrsResponseStatus (\ s a -> s{_awsrsResponseStatus = a})
instance NFData AddWorkingStorageResponse where