{-# 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.Lightsail.StopInstance
(
stopInstance
, StopInstance
, siInstanceName
, stopInstanceResponse
, StopInstanceResponse
, sirsOperations
, sirsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Lightsail.Types
import Network.AWS.Lightsail.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype StopInstance = StopInstance'
{ _siInstanceName :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
stopInstance
:: Text
-> StopInstance
stopInstance pInstanceName_ =
StopInstance'
{ _siInstanceName = pInstanceName_
}
siInstanceName :: Lens' StopInstance Text
siInstanceName = lens _siInstanceName (\ s a -> s{_siInstanceName = a});
instance AWSRequest StopInstance where
type Rs StopInstance = StopInstanceResponse
request = postJSON lightsail
response
= receiveJSON
(\ s h x ->
StopInstanceResponse' <$>
(x .?> "operations" .!@ mempty) <*>
(pure (fromEnum s)))
instance Hashable StopInstance
instance NFData StopInstance
instance ToHeaders StopInstance where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Lightsail_20161128.StopInstance" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON StopInstance where
toJSON StopInstance'{..}
= object
(catMaybes
[Just ("instanceName" .= _siInstanceName)])
instance ToPath StopInstance where
toPath = const "/"
instance ToQuery StopInstance where
toQuery = const mempty
data StopInstanceResponse = StopInstanceResponse'
{ _sirsOperations :: !(Maybe [Operation])
, _sirsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
stopInstanceResponse
:: Int
-> StopInstanceResponse
stopInstanceResponse pResponseStatus_ =
StopInstanceResponse'
{ _sirsOperations = Nothing
, _sirsResponseStatus = pResponseStatus_
}
sirsOperations :: Lens' StopInstanceResponse [Operation]
sirsOperations = lens _sirsOperations (\ s a -> s{_sirsOperations = a}) . _Default . _Coerce;
sirsResponseStatus :: Lens' StopInstanceResponse Int
sirsResponseStatus = lens _sirsResponseStatus (\ s a -> s{_sirsResponseStatus = a});
instance NFData StopInstanceResponse