{-# 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.OpsWorksCM.UpdateServer
(
updateServer
, UpdateServer
, usDisableAutomatedBackup
, usPreferredMaintenanceWindow
, usPreferredBackupWindow
, usBackupRetentionCount
, usServerName
, updateServerResponse
, UpdateServerResponse
, usrsServer
, usrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.OpsWorksCM.Types
import Network.AWS.OpsWorksCM.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data UpdateServer = UpdateServer'
{ _usDisableAutomatedBackup :: !(Maybe Bool)
, _usPreferredMaintenanceWindow :: !(Maybe Text)
, _usPreferredBackupWindow :: !(Maybe Text)
, _usBackupRetentionCount :: !(Maybe Int)
, _usServerName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateServer
:: Text
-> UpdateServer
updateServer pServerName_ =
UpdateServer'
{ _usDisableAutomatedBackup = Nothing
, _usPreferredMaintenanceWindow = Nothing
, _usPreferredBackupWindow = Nothing
, _usBackupRetentionCount = Nothing
, _usServerName = pServerName_
}
usDisableAutomatedBackup :: Lens' UpdateServer (Maybe Bool)
usDisableAutomatedBackup = lens _usDisableAutomatedBackup (\ s a -> s{_usDisableAutomatedBackup = a})
usPreferredMaintenanceWindow :: Lens' UpdateServer (Maybe Text)
usPreferredMaintenanceWindow = lens _usPreferredMaintenanceWindow (\ s a -> s{_usPreferredMaintenanceWindow = a})
usPreferredBackupWindow :: Lens' UpdateServer (Maybe Text)
usPreferredBackupWindow = lens _usPreferredBackupWindow (\ s a -> s{_usPreferredBackupWindow = a})
usBackupRetentionCount :: Lens' UpdateServer (Maybe Int)
usBackupRetentionCount = lens _usBackupRetentionCount (\ s a -> s{_usBackupRetentionCount = a})
usServerName :: Lens' UpdateServer Text
usServerName = lens _usServerName (\ s a -> s{_usServerName = a})
instance AWSRequest UpdateServer where
type Rs UpdateServer = UpdateServerResponse
request = postJSON opsWorksCM
response
= receiveJSON
(\ s h x ->
UpdateServerResponse' <$>
(x .?> "Server") <*> (pure (fromEnum s)))
instance Hashable UpdateServer where
instance NFData UpdateServer where
instance ToHeaders UpdateServer where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("OpsWorksCM_V2016_11_01.UpdateServer" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateServer where
toJSON UpdateServer'{..}
= object
(catMaybes
[("DisableAutomatedBackup" .=) <$>
_usDisableAutomatedBackup,
("PreferredMaintenanceWindow" .=) <$>
_usPreferredMaintenanceWindow,
("PreferredBackupWindow" .=) <$>
_usPreferredBackupWindow,
("BackupRetentionCount" .=) <$>
_usBackupRetentionCount,
Just ("ServerName" .= _usServerName)])
instance ToPath UpdateServer where
toPath = const "/"
instance ToQuery UpdateServer where
toQuery = const mempty
data UpdateServerResponse = UpdateServerResponse'
{ _usrsServer :: !(Maybe Server)
, _usrsResponseStatus :: !Int
} deriving (Eq, Show, Data, Typeable, Generic)
updateServerResponse
:: Int
-> UpdateServerResponse
updateServerResponse pResponseStatus_ =
UpdateServerResponse'
{_usrsServer = Nothing, _usrsResponseStatus = pResponseStatus_}
usrsServer :: Lens' UpdateServerResponse (Maybe Server)
usrsServer = lens _usrsServer (\ s a -> s{_usrsServer = a})
usrsResponseStatus :: Lens' UpdateServerResponse Int
usrsResponseStatus = lens _usrsResponseStatus (\ s a -> s{_usrsResponseStatus = a})
instance NFData UpdateServerResponse where