{-# 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 #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Network.AWS.Route53Domains.RegisterDomain -- Copyright : (c) 2013-2016 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay <brendan.g.hay@gmail.com> -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- This operation registers a domain. Domains are registered by the AWS registrar partner, Gandi. For some top-level domains (TLDs), this operation requires extra parameters. -- -- -- When you register a domain, Amazon Route 53 does the following: -- -- * Creates a Amazon Route 53 hosted zone that has the same name as the domain. Amazon Route 53 assigns four name servers to your hosted zone and automatically updates your domain registration with the names of these name servers. * Enables autorenew, so your domain registration will renew automatically each year. We'll notify you in advance of the renewal date so you can choose whether to renew the registration. * Optionally enables privacy protection, so WHOIS queries return contact information for our registrar partner, Gandi, instead of the information you entered for registrant, admin, and tech contacts. * If registration is successful, returns an operation ID that you can use to track the progress and completion of the action. If the request is not completed successfully, the domain registrant is notified by email. * Charges your AWS account an amount based on the top-level domain. For more information, see <http://aws.amazon.com/route53/pricing/ Amazon Route 53 Pricing> . -- module Network.AWS.Route53Domains.RegisterDomain ( -- * Creating a Request registerDomain , RegisterDomain -- * Request Lenses , rPrivacyProtectTechContact , rPrivacyProtectRegistrantContact , rAutoRenew , rPrivacyProtectAdminContact , rIdNLangCode , rDomainName , rDurationInYears , rAdminContact , rRegistrantContact , rTechContact -- * Destructuring the Response , registerDomainResponse , RegisterDomainResponse -- * Response Lenses , rdrsResponseStatus , rdrsOperationId ) 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 -- | The RegisterDomain request includes the following elements. -- -- -- -- /See:/ 'registerDomain' smart constructor. data RegisterDomain = RegisterDomain' { _rPrivacyProtectTechContact :: !(Maybe Bool) , _rPrivacyProtectRegistrantContact :: !(Maybe Bool) , _rAutoRenew :: !(Maybe Bool) , _rPrivacyProtectAdminContact :: !(Maybe Bool) , _rIdNLangCode :: !(Maybe Text) , _rDomainName :: !Text , _rDurationInYears :: !Nat , _rAdminContact :: !(Sensitive ContactDetail) , _rRegistrantContact :: !(Sensitive ContactDetail) , _rTechContact :: !(Sensitive ContactDetail) } deriving (Eq,Read,Show,Data,Typeable,Generic) -- | Creates a value of 'RegisterDomain' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'rPrivacyProtectTechContact' - Whether you want to conceal contact information from WHOIS queries. If you specify true, WHOIS ("who is") queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter. Type: Boolean Default: @true@ Valid values: @true@ | @false@ Required: No -- -- * 'rPrivacyProtectRegistrantContact' - Whether you want to conceal contact information from WHOIS queries. If you specify true, WHOIS ("who is") queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter. Type: Boolean Default: @true@ Valid values: @true@ | @false@ Required: No -- -- * 'rAutoRenew' - Indicates whether the domain will be automatically renewed (@true@ ) or not (@false@ ). Autorenewal only takes effect after the account is charged. Type: Boolean Valid values: @true@ | @false@ Default: @true@ Required: No -- -- * 'rPrivacyProtectAdminContact' - Whether you want to conceal contact information from WHOIS queries. If you specify true, WHOIS ("who is") queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter. Type: Boolean Default: @true@ Valid values: @true@ | @false@ Required: No -- -- * 'rIdNLangCode' - Reserved for future use. -- -- * 'rDomainName' - The name of a domain. Type: String Default: None Constraints: The domain name can contain only the letters a through z, the numbers 0 through 9, and hyphen (-). Internationalized Domain Names are not supported. Required: Yes -- -- * 'rDurationInYears' - The number of years the domain will be registered. Domains are registered for a minimum of one year. The maximum period depends on the top-level domain. Type: Integer Default: 1 Valid values: Integer from 1 to 10 Required: Yes -- -- * 'rAdminContact' - Provides detailed contact information. Type: Complex Children: @FirstName@ , @MiddleName@ , @LastName@ , @ContactType@ , @OrganizationName@ , @AddressLine1@ , @AddressLine2@ , @City@ , @State@ , @CountryCode@ , @ZipCode@ , @PhoneNumber@ , @Email@ , @Fax@ , @ExtraParams@ Required: Yes -- -- * 'rRegistrantContact' - Provides detailed contact information. Type: Complex Children: @FirstName@ , @MiddleName@ , @LastName@ , @ContactType@ , @OrganizationName@ , @AddressLine1@ , @AddressLine2@ , @City@ , @State@ , @CountryCode@ , @ZipCode@ , @PhoneNumber@ , @Email@ , @Fax@ , @ExtraParams@ Required: Yes -- -- * 'rTechContact' - Provides detailed contact information. Type: Complex Children: @FirstName@ , @MiddleName@ , @LastName@ , @ContactType@ , @OrganizationName@ , @AddressLine1@ , @AddressLine2@ , @City@ , @State@ , @CountryCode@ , @ZipCode@ , @PhoneNumber@ , @Email@ , @Fax@ , @ExtraParams@ Required: Yes registerDomain :: Text -- ^ 'rDomainName' -> Natural -- ^ 'rDurationInYears' -> ContactDetail -- ^ 'rAdminContact' -> ContactDetail -- ^ 'rRegistrantContact' -> ContactDetail -- ^ 'rTechContact' -> RegisterDomain registerDomain pDomainName_ pDurationInYears_ pAdminContact_ pRegistrantContact_ pTechContact_ = RegisterDomain' { _rPrivacyProtectTechContact = Nothing , _rPrivacyProtectRegistrantContact = Nothing , _rAutoRenew = Nothing , _rPrivacyProtectAdminContact = Nothing , _rIdNLangCode = Nothing , _rDomainName = pDomainName_ , _rDurationInYears = _Nat # pDurationInYears_ , _rAdminContact = _Sensitive # pAdminContact_ , _rRegistrantContact = _Sensitive # pRegistrantContact_ , _rTechContact = _Sensitive # pTechContact_ } -- | Whether you want to conceal contact information from WHOIS queries. If you specify true, WHOIS ("who is") queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter. Type: Boolean Default: @true@ Valid values: @true@ | @false@ Required: No rPrivacyProtectTechContact :: Lens' RegisterDomain (Maybe Bool) rPrivacyProtectTechContact = lens _rPrivacyProtectTechContact (\ s a -> s{_rPrivacyProtectTechContact = a}); -- | Whether you want to conceal contact information from WHOIS queries. If you specify true, WHOIS ("who is") queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter. Type: Boolean Default: @true@ Valid values: @true@ | @false@ Required: No rPrivacyProtectRegistrantContact :: Lens' RegisterDomain (Maybe Bool) rPrivacyProtectRegistrantContact = lens _rPrivacyProtectRegistrantContact (\ s a -> s{_rPrivacyProtectRegistrantContact = a}); -- | Indicates whether the domain will be automatically renewed (@true@ ) or not (@false@ ). Autorenewal only takes effect after the account is charged. Type: Boolean Valid values: @true@ | @false@ Default: @true@ Required: No rAutoRenew :: Lens' RegisterDomain (Maybe Bool) rAutoRenew = lens _rAutoRenew (\ s a -> s{_rAutoRenew = a}); -- | Whether you want to conceal contact information from WHOIS queries. If you specify true, WHOIS ("who is") queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter. Type: Boolean Default: @true@ Valid values: @true@ | @false@ Required: No rPrivacyProtectAdminContact :: Lens' RegisterDomain (Maybe Bool) rPrivacyProtectAdminContact = lens _rPrivacyProtectAdminContact (\ s a -> s{_rPrivacyProtectAdminContact = a}); -- | Reserved for future use. rIdNLangCode :: Lens' RegisterDomain (Maybe Text) rIdNLangCode = lens _rIdNLangCode (\ s a -> s{_rIdNLangCode = a}); -- | The name of a domain. Type: String Default: None Constraints: The domain name can contain only the letters a through z, the numbers 0 through 9, and hyphen (-). Internationalized Domain Names are not supported. Required: Yes rDomainName :: Lens' RegisterDomain Text rDomainName = lens _rDomainName (\ s a -> s{_rDomainName = a}); -- | The number of years the domain will be registered. Domains are registered for a minimum of one year. The maximum period depends on the top-level domain. Type: Integer Default: 1 Valid values: Integer from 1 to 10 Required: Yes rDurationInYears :: Lens' RegisterDomain Natural rDurationInYears = lens _rDurationInYears (\ s a -> s{_rDurationInYears = a}) . _Nat; -- | Provides detailed contact information. Type: Complex Children: @FirstName@ , @MiddleName@ , @LastName@ , @ContactType@ , @OrganizationName@ , @AddressLine1@ , @AddressLine2@ , @City@ , @State@ , @CountryCode@ , @ZipCode@ , @PhoneNumber@ , @Email@ , @Fax@ , @ExtraParams@ Required: Yes rAdminContact :: Lens' RegisterDomain ContactDetail rAdminContact = lens _rAdminContact (\ s a -> s{_rAdminContact = a}) . _Sensitive; -- | Provides detailed contact information. Type: Complex Children: @FirstName@ , @MiddleName@ , @LastName@ , @ContactType@ , @OrganizationName@ , @AddressLine1@ , @AddressLine2@ , @City@ , @State@ , @CountryCode@ , @ZipCode@ , @PhoneNumber@ , @Email@ , @Fax@ , @ExtraParams@ Required: Yes rRegistrantContact :: Lens' RegisterDomain ContactDetail rRegistrantContact = lens _rRegistrantContact (\ s a -> s{_rRegistrantContact = a}) . _Sensitive; -- | Provides detailed contact information. Type: Complex Children: @FirstName@ , @MiddleName@ , @LastName@ , @ContactType@ , @OrganizationName@ , @AddressLine1@ , @AddressLine2@ , @City@ , @State@ , @CountryCode@ , @ZipCode@ , @PhoneNumber@ , @Email@ , @Fax@ , @ExtraParams@ Required: Yes rTechContact :: Lens' RegisterDomain ContactDetail rTechContact = lens _rTechContact (\ s a -> s{_rTechContact = a}) . _Sensitive; instance AWSRequest RegisterDomain where type Rs RegisterDomain = RegisterDomainResponse request = postJSON route53Domains response = receiveJSON (\ s h x -> RegisterDomainResponse' <$> (pure (fromEnum s)) <*> (x .:> "OperationId")) instance Hashable RegisterDomain instance NFData RegisterDomain instance ToHeaders RegisterDomain where toHeaders = const (mconcat ["X-Amz-Target" =# ("Route53Domains_v20140515.RegisterDomain" :: ByteString), "Content-Type" =# ("application/x-amz-json-1.1" :: ByteString)]) instance ToJSON RegisterDomain where toJSON RegisterDomain'{..} = object (catMaybes [("PrivacyProtectTechContact" .=) <$> _rPrivacyProtectTechContact, ("PrivacyProtectRegistrantContact" .=) <$> _rPrivacyProtectRegistrantContact, ("AutoRenew" .=) <$> _rAutoRenew, ("PrivacyProtectAdminContact" .=) <$> _rPrivacyProtectAdminContact, ("IdnLangCode" .=) <$> _rIdNLangCode, Just ("DomainName" .= _rDomainName), Just ("DurationInYears" .= _rDurationInYears), Just ("AdminContact" .= _rAdminContact), Just ("RegistrantContact" .= _rRegistrantContact), Just ("TechContact" .= _rTechContact)]) instance ToPath RegisterDomain where toPath = const "/" instance ToQuery RegisterDomain where toQuery = const mempty -- | The RegisterDomain response includes the following element. -- -- -- -- /See:/ 'registerDomainResponse' smart constructor. data RegisterDomainResponse = RegisterDomainResponse' { _rdrsResponseStatus :: !Int , _rdrsOperationId :: !Text } deriving (Eq,Read,Show,Data,Typeable,Generic) -- | Creates a value of 'RegisterDomainResponse' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'rdrsResponseStatus' - -- | The response status code. -- -- * 'rdrsOperationId' - Identifier for tracking the progress of the request. To use this ID to query the operation status, use GetOperationDetail. Type: String Default: None Constraints: Maximum 255 characters. registerDomainResponse :: Int -- ^ 'rdrsResponseStatus' -> Text -- ^ 'rdrsOperationId' -> RegisterDomainResponse registerDomainResponse pResponseStatus_ pOperationId_ = RegisterDomainResponse' { _rdrsResponseStatus = pResponseStatus_ , _rdrsOperationId = pOperationId_ } -- | -- | The response status code. rdrsResponseStatus :: Lens' RegisterDomainResponse Int rdrsResponseStatus = lens _rdrsResponseStatus (\ s a -> s{_rdrsResponseStatus = a}); -- | Identifier for tracking the progress of the request. To use this ID to query the operation status, use GetOperationDetail. Type: String Default: None Constraints: Maximum 255 characters. rdrsOperationId :: Lens' RegisterDomainResponse Text rdrsOperationId = lens _rdrsOperationId (\ s a -> s{_rdrsOperationId = a}); instance NFData RegisterDomainResponse