{-# 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.GetInstance
(
getInstance
, GetInstance
, giInstanceName
, getInstanceResponse
, GetInstanceResponse
, girsInstance
, girsResponseStatus
) 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 GetInstance = GetInstance'
{ _giInstanceName :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getInstance
:: Text
-> GetInstance
getInstance pInstanceName_ = GetInstance' {_giInstanceName = pInstanceName_}
giInstanceName :: Lens' GetInstance Text
giInstanceName = lens _giInstanceName (\ s a -> s{_giInstanceName = a})
instance AWSRequest GetInstance where
type Rs GetInstance = GetInstanceResponse
request = postJSON lightsail
response
= receiveJSON
(\ s h x ->
GetInstanceResponse' <$>
(x .?> "instance") <*> (pure (fromEnum s)))
instance Hashable GetInstance where
instance NFData GetInstance where
instance ToHeaders GetInstance where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Lightsail_20161128.GetInstance" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetInstance where
toJSON GetInstance'{..}
= object
(catMaybes
[Just ("instanceName" .= _giInstanceName)])
instance ToPath GetInstance where
toPath = const "/"
instance ToQuery GetInstance where
toQuery = const mempty
data GetInstanceResponse = GetInstanceResponse'
{ _girsInstance :: !(Maybe Instance)
, _girsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getInstanceResponse
:: Int
-> GetInstanceResponse
getInstanceResponse pResponseStatus_ =
GetInstanceResponse'
{_girsInstance = Nothing, _girsResponseStatus = pResponseStatus_}
girsInstance :: Lens' GetInstanceResponse (Maybe Instance)
girsInstance = lens _girsInstance (\ s a -> s{_girsInstance = a})
girsResponseStatus :: Lens' GetInstanceResponse Int
girsResponseStatus = lens _girsResponseStatus (\ s a -> s{_girsResponseStatus = a})
instance NFData GetInstanceResponse where