{-# 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.StartMaintenance
(
startMaintenance
, StartMaintenance
, smEngineAttributes
, smServerName
, startMaintenanceResponse
, StartMaintenanceResponse
, smrsServer
, smrsResponseStatus
) 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 StartMaintenance = StartMaintenance'
{ _smEngineAttributes :: !(Maybe [EngineAttribute])
, _smServerName :: !Text
} deriving (Eq, Show, Data, Typeable, Generic)
startMaintenance
:: Text
-> StartMaintenance
startMaintenance pServerName_ =
StartMaintenance'
{_smEngineAttributes = Nothing, _smServerName = pServerName_}
smEngineAttributes :: Lens' StartMaintenance [EngineAttribute]
smEngineAttributes = lens _smEngineAttributes (\ s a -> s{_smEngineAttributes = a}) . _Default . _Coerce
smServerName :: Lens' StartMaintenance Text
smServerName = lens _smServerName (\ s a -> s{_smServerName = a})
instance AWSRequest StartMaintenance where
type Rs StartMaintenance = StartMaintenanceResponse
request = postJSON opsWorksCM
response
= receiveJSON
(\ s h x ->
StartMaintenanceResponse' <$>
(x .?> "Server") <*> (pure (fromEnum s)))
instance Hashable StartMaintenance where
instance NFData StartMaintenance where
instance ToHeaders StartMaintenance where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("OpsWorksCM_V2016_11_01.StartMaintenance" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON StartMaintenance where
toJSON StartMaintenance'{..}
= object
(catMaybes
[("EngineAttributes" .=) <$> _smEngineAttributes,
Just ("ServerName" .= _smServerName)])
instance ToPath StartMaintenance where
toPath = const "/"
instance ToQuery StartMaintenance where
toQuery = const mempty
data StartMaintenanceResponse = StartMaintenanceResponse'
{ _smrsServer :: !(Maybe Server)
, _smrsResponseStatus :: !Int
} deriving (Eq, Show, Data, Typeable, Generic)
startMaintenanceResponse
:: Int
-> StartMaintenanceResponse
startMaintenanceResponse pResponseStatus_ =
StartMaintenanceResponse'
{_smrsServer = Nothing, _smrsResponseStatus = pResponseStatus_}
smrsServer :: Lens' StartMaintenanceResponse (Maybe Server)
smrsServer = lens _smrsServer (\ s a -> s{_smrsServer = a})
smrsResponseStatus :: Lens' StartMaintenanceResponse Int
smrsResponseStatus = lens _smrsResponseStatus (\ s a -> s{_smrsResponseStatus = a})
instance NFData StartMaintenanceResponse where