{-# 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.GetDomain
(
getDomain
, GetDomain
, gdDomainName
, getDomainResponse
, GetDomainResponse
, gdrsDomain
, gdrsResponseStatus
) 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 GetDomain = GetDomain'
{ _gdDomainName :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getDomain
:: Text
-> GetDomain
getDomain pDomainName_ =
GetDomain'
{ _gdDomainName = pDomainName_
}
gdDomainName :: Lens' GetDomain Text
gdDomainName = lens _gdDomainName (\ s a -> s{_gdDomainName = a});
instance AWSRequest GetDomain where
type Rs GetDomain = GetDomainResponse
request = postJSON lightsail
response
= receiveJSON
(\ s h x ->
GetDomainResponse' <$>
(x .?> "domain") <*> (pure (fromEnum s)))
instance Hashable GetDomain
instance NFData GetDomain
instance ToHeaders GetDomain where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Lightsail_20161128.GetDomain" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetDomain where
toJSON GetDomain'{..}
= object
(catMaybes [Just ("domainName" .= _gdDomainName)])
instance ToPath GetDomain where
toPath = const "/"
instance ToQuery GetDomain where
toQuery = const mempty
data GetDomainResponse = GetDomainResponse'
{ _gdrsDomain :: !(Maybe Domain)
, _gdrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getDomainResponse
:: Int
-> GetDomainResponse
getDomainResponse pResponseStatus_ =
GetDomainResponse'
{ _gdrsDomain = Nothing
, _gdrsResponseStatus = pResponseStatus_
}
gdrsDomain :: Lens' GetDomainResponse (Maybe Domain)
gdrsDomain = lens _gdrsDomain (\ s a -> s{_gdrsDomain = a});
gdrsResponseStatus :: Lens' GetDomainResponse Int
gdrsResponseStatus = lens _gdrsResponseStatus (\ s a -> s{_gdrsResponseStatus = a});
instance NFData GetDomainResponse