{-# 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.Route53Domains.GetDomainSuggestions
(
getDomainSuggestions
, GetDomainSuggestions
, gdsDomainName
, gdsSuggestionCount
, gdsOnlyAvailable
, getDomainSuggestionsResponse
, GetDomainSuggestionsResponse
, gdsrsSuggestionsList
, gdsrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.Route53Domains.Types
import Network.AWS.Route53Domains.Types.Product
data GetDomainSuggestions = GetDomainSuggestions'
{ _gdsDomainName :: !Text
, _gdsSuggestionCount :: !Int
, _gdsOnlyAvailable :: !Bool
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getDomainSuggestions
:: Text
-> Int
-> Bool
-> GetDomainSuggestions
getDomainSuggestions pDomainName_ pSuggestionCount_ pOnlyAvailable_ =
GetDomainSuggestions'
{ _gdsDomainName = pDomainName_
, _gdsSuggestionCount = pSuggestionCount_
, _gdsOnlyAvailable = pOnlyAvailable_
}
gdsDomainName :: Lens' GetDomainSuggestions Text
gdsDomainName = lens _gdsDomainName (\ s a -> s{_gdsDomainName = a});
gdsSuggestionCount :: Lens' GetDomainSuggestions Int
gdsSuggestionCount = lens _gdsSuggestionCount (\ s a -> s{_gdsSuggestionCount = a});
gdsOnlyAvailable :: Lens' GetDomainSuggestions Bool
gdsOnlyAvailable = lens _gdsOnlyAvailable (\ s a -> s{_gdsOnlyAvailable = a});
instance AWSRequest GetDomainSuggestions where
type Rs GetDomainSuggestions =
GetDomainSuggestionsResponse
request = postJSON route53Domains
response
= receiveJSON
(\ s h x ->
GetDomainSuggestionsResponse' <$>
(x .?> "SuggestionsList" .!@ mempty) <*>
(pure (fromEnum s)))
instance Hashable GetDomainSuggestions
instance NFData GetDomainSuggestions
instance ToHeaders GetDomainSuggestions where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Route53Domains_v20140515.GetDomainSuggestions" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetDomainSuggestions where
toJSON GetDomainSuggestions'{..}
= object
(catMaybes
[Just ("DomainName" .= _gdsDomainName),
Just ("SuggestionCount" .= _gdsSuggestionCount),
Just ("OnlyAvailable" .= _gdsOnlyAvailable)])
instance ToPath GetDomainSuggestions where
toPath = const "/"
instance ToQuery GetDomainSuggestions where
toQuery = const mempty
data GetDomainSuggestionsResponse = GetDomainSuggestionsResponse'
{ _gdsrsSuggestionsList :: !(Maybe [DomainSuggestion])
, _gdsrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getDomainSuggestionsResponse
:: Int
-> GetDomainSuggestionsResponse
getDomainSuggestionsResponse pResponseStatus_ =
GetDomainSuggestionsResponse'
{ _gdsrsSuggestionsList = Nothing
, _gdsrsResponseStatus = pResponseStatus_
}
gdsrsSuggestionsList :: Lens' GetDomainSuggestionsResponse [DomainSuggestion]
gdsrsSuggestionsList = lens _gdsrsSuggestionsList (\ s a -> s{_gdsrsSuggestionsList = a}) . _Default . _Coerce;
gdsrsResponseStatus :: Lens' GetDomainSuggestionsResponse Int
gdsrsResponseStatus = lens _gdsrsResponseStatus (\ s a -> s{_gdsrsResponseStatus = a});
instance NFData GetDomainSuggestionsResponse