{-# 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.UpdateDomainNameservers
(
updateDomainNameservers
, UpdateDomainNameservers
, udnFIAuthKey
, udnDomainName
, udnNameservers
, updateDomainNameserversResponse
, UpdateDomainNameserversResponse
, udnrsResponseStatus
, udnrsOperationId
) 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 UpdateDomainNameservers = UpdateDomainNameservers'
{ _udnFIAuthKey :: !(Maybe Text)
, _udnDomainName :: !Text
, _udnNameservers :: ![Nameserver]
} deriving (Eq,Read,Show,Data,Typeable,Generic)
updateDomainNameservers
:: Text
-> UpdateDomainNameservers
updateDomainNameservers pDomainName_ =
UpdateDomainNameservers'
{ _udnFIAuthKey = Nothing
, _udnDomainName = pDomainName_
, _udnNameservers = mempty
}
udnFIAuthKey :: Lens' UpdateDomainNameservers (Maybe Text)
udnFIAuthKey = lens _udnFIAuthKey (\ s a -> s{_udnFIAuthKey = a});
udnDomainName :: Lens' UpdateDomainNameservers Text
udnDomainName = lens _udnDomainName (\ s a -> s{_udnDomainName = a});
udnNameservers :: Lens' UpdateDomainNameservers [Nameserver]
udnNameservers = lens _udnNameservers (\ s a -> s{_udnNameservers = a}) . _Coerce;
instance AWSRequest UpdateDomainNameservers where
type Rs UpdateDomainNameservers =
UpdateDomainNameserversResponse
request = postJSON route53Domains
response
= receiveJSON
(\ s h x ->
UpdateDomainNameserversResponse' <$>
(pure (fromEnum s)) <*> (x .:> "OperationId"))
instance Hashable UpdateDomainNameservers
instance NFData UpdateDomainNameservers
instance ToHeaders UpdateDomainNameservers where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Route53Domains_v20140515.UpdateDomainNameservers"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateDomainNameservers where
toJSON UpdateDomainNameservers'{..}
= object
(catMaybes
[("FIAuthKey" .=) <$> _udnFIAuthKey,
Just ("DomainName" .= _udnDomainName),
Just ("Nameservers" .= _udnNameservers)])
instance ToPath UpdateDomainNameservers where
toPath = const "/"
instance ToQuery UpdateDomainNameservers where
toQuery = const mempty
data UpdateDomainNameserversResponse = UpdateDomainNameserversResponse'
{ _udnrsResponseStatus :: !Int
, _udnrsOperationId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
updateDomainNameserversResponse
:: Int
-> Text
-> UpdateDomainNameserversResponse
updateDomainNameserversResponse pResponseStatus_ pOperationId_ =
UpdateDomainNameserversResponse'
{ _udnrsResponseStatus = pResponseStatus_
, _udnrsOperationId = pOperationId_
}
udnrsResponseStatus :: Lens' UpdateDomainNameserversResponse Int
udnrsResponseStatus = lens _udnrsResponseStatus (\ s a -> s{_udnrsResponseStatus = a});
udnrsOperationId :: Lens' UpdateDomainNameserversResponse Text
udnrsOperationId = lens _udnrsOperationId (\ s a -> s{_udnrsOperationId = a});
instance NFData UpdateDomainNameserversResponse