{-# 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.StartInstance
(
startInstance
, StartInstance
, sInstanceName
, startInstanceResponse
, StartInstanceResponse
, srsOperations
, srsResponseStatus
) 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 StartInstance = StartInstance'
{ _sInstanceName :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
startInstance
:: Text
-> StartInstance
startInstance pInstanceName_ = StartInstance' {_sInstanceName = pInstanceName_}
sInstanceName :: Lens' StartInstance Text
sInstanceName = lens _sInstanceName (\ s a -> s{_sInstanceName = a})
instance AWSRequest StartInstance where
type Rs StartInstance = StartInstanceResponse
request = postJSON lightsail
response
= receiveJSON
(\ s h x ->
StartInstanceResponse' <$>
(x .?> "operations" .!@ mempty) <*>
(pure (fromEnum s)))
instance Hashable StartInstance where
instance NFData StartInstance where
instance ToHeaders StartInstance where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Lightsail_20161128.StartInstance" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON StartInstance where
toJSON StartInstance'{..}
= object
(catMaybes [Just ("instanceName" .= _sInstanceName)])
instance ToPath StartInstance where
toPath = const "/"
instance ToQuery StartInstance where
toQuery = const mempty
data StartInstanceResponse = StartInstanceResponse'
{ _srsOperations :: !(Maybe [Operation])
, _srsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
startInstanceResponse
:: Int
-> StartInstanceResponse
startInstanceResponse pResponseStatus_ =
StartInstanceResponse'
{_srsOperations = Nothing, _srsResponseStatus = pResponseStatus_}
srsOperations :: Lens' StartInstanceResponse [Operation]
srsOperations = lens _srsOperations (\ s a -> s{_srsOperations = a}) . _Default . _Coerce
srsResponseStatus :: Lens' StartInstanceResponse Int
srsResponseStatus = lens _srsResponseStatus (\ s a -> s{_srsResponseStatus = a})
instance NFData StartInstanceResponse where