{-# 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.RenewDomain
(
renewDomain
, RenewDomain
, rdDurationInYears
, rdDomainName
, rdCurrentExpiryYear
, renewDomainResponse
, RenewDomainResponse
, rrsResponseStatus
, rrsOperationId
) 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 RenewDomain = RenewDomain'
{ _rdDurationInYears :: !(Maybe Nat)
, _rdDomainName :: !Text
, _rdCurrentExpiryYear :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
renewDomain
:: Text
-> Int
-> RenewDomain
renewDomain pDomainName_ pCurrentExpiryYear_ =
RenewDomain'
{ _rdDurationInYears = Nothing
, _rdDomainName = pDomainName_
, _rdCurrentExpiryYear = pCurrentExpiryYear_
}
rdDurationInYears :: Lens' RenewDomain (Maybe Natural)
rdDurationInYears = lens _rdDurationInYears (\ s a -> s{_rdDurationInYears = a}) . mapping _Nat;
rdDomainName :: Lens' RenewDomain Text
rdDomainName = lens _rdDomainName (\ s a -> s{_rdDomainName = a});
rdCurrentExpiryYear :: Lens' RenewDomain Int
rdCurrentExpiryYear = lens _rdCurrentExpiryYear (\ s a -> s{_rdCurrentExpiryYear = a});
instance AWSRequest RenewDomain where
type Rs RenewDomain = RenewDomainResponse
request = postJSON route53Domains
response
= receiveJSON
(\ s h x ->
RenewDomainResponse' <$>
(pure (fromEnum s)) <*> (x .:> "OperationId"))
instance Hashable RenewDomain
instance NFData RenewDomain
instance ToHeaders RenewDomain where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Route53Domains_v20140515.RenewDomain" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON RenewDomain where
toJSON RenewDomain'{..}
= object
(catMaybes
[("DurationInYears" .=) <$> _rdDurationInYears,
Just ("DomainName" .= _rdDomainName),
Just ("CurrentExpiryYear" .= _rdCurrentExpiryYear)])
instance ToPath RenewDomain where
toPath = const "/"
instance ToQuery RenewDomain where
toQuery = const mempty
data RenewDomainResponse = RenewDomainResponse'
{ _rrsResponseStatus :: !Int
, _rrsOperationId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
renewDomainResponse
:: Int
-> Text
-> RenewDomainResponse
renewDomainResponse pResponseStatus_ pOperationId_ =
RenewDomainResponse'
{ _rrsResponseStatus = pResponseStatus_
, _rrsOperationId = pOperationId_
}
rrsResponseStatus :: Lens' RenewDomainResponse Int
rrsResponseStatus = lens _rrsResponseStatus (\ s a -> s{_rrsResponseStatus = a});
rrsOperationId :: Lens' RenewDomainResponse Text
rrsOperationId = lens _rrsOperationId (\ s a -> s{_rrsOperationId = a});
instance NFData RenewDomainResponse