%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/modules/ |
Current File : //lib/python2.7/site-packages/salt/modules/namecheap_domains_dns.pyc |
� ���^c @@ s� d Z d d l m Z m Z m Z d d l m Z e Z y d d l Z Wn e k ra e Z n Xd Z d � Z d � Z d � Z d � Z d � Z d � Z d S( uZ Namecheap DNS Management .. versionadded:: 2017.7.0 Prerequisites ------------- This module uses the ``requests`` Python module to communicate to the namecheap API. Configuration ------------- The Namecheap username, API key and URL should be set in the minion configuration file, or in the Pillar data. .. code-block:: yaml namecheap.name: companyname namecheap.key: a1b2c3d4e5f67a8b9c0d1e2f3 namecheap.client_ip: 162.155.30.172 #Real url namecheap.url: https://api.namecheap.com/xml.response #Sandbox url #namecheap.url: https://api.sandbox.namecheap.xml.response i ( t absolute_importt print_functiont unicode_literals( t sixNu namecheap_domains_dnsc C@ s t r d St S( uH Check to make sure requests and xml are installed and requests u namecheap_domains_dns( t CAN_USE_NAMECHEAPt False( ( ( sF /usr/lib/python2.7/site-packages/salt/modules/namecheap_domains_dns.pyt __virtual__/ s c C@ st t j j j d � } | | d <| | d <t j j j | � } | d k rN i S| j d � d } t j j j | � S( uH Retrieves DNS host record settings for the requested domain. returns a dictionary of information about the requested domain sld SLD of the domain name tld TLD of the domain name CLI Example: .. code-block:: bash salt 'my-minion' namecheap_domains_dns.get_hosts sld tld u namecheap.domains.dns.gethostsu TLDu SLDu DomainDNSGetHostsResulti N( t saltt utilst namecheapt get_optst get_requestt Nonet getElementsByTagNamet xml_to_dict( t sldt tldt optst response_xmlt domaindnsgethostsresult( ( sF /usr/lib/python2.7/site-packages/salt/modules/namecheap_domains_dns.pyt get_hosts8 s c C@ st t j j j d � } | | d <| | d <t j j j | � } | d k rN i S| j d � d } t j j j | � S( uG Gets a list of DNS servers associated with the requested domain. returns a dictionary of information about requested domain sld SLD of the domain name tld TLD of the domain name CLI Example: .. code-block:: bash salt 'my-minion' namecheap_domains_dns.get_list sld tld u namecheap.domains.dns.getlistu TLDu SLDu DomainDNSGetListResulti N( R R R R R R R R ( R R R R t domaindnsgetlistresult( ( sF /usr/lib/python2.7/site-packages/salt/modules/namecheap_domains_dns.pyt get_listW s c C@ s3 t j j j d � } | | d <| | d <d } x� | D]� } t j | � } | d | d | <| d | d | <| d | d | <d | k r� | d | d | <n d | k r� | d | d | <| d | d <n | d 7} q6 Wt j j j | � } | d k rt S| j d � d } t j j j | j d � � S( uB Sets DNS host records settings for the requested domain. returns True if the host records were set successfully sld SLD of the domain name tld TLD of the domain name hosts Must be passed as a list of Python dictionaries, with each dictionary containing the following keys: - **hostname** - **recordtype** - One of ``A``, ``AAAA``, ``CNAME``, ``MX``, ``MXE``, ``TXT``, ``URL``, ``URL301``, or ``FRAME`` - **address** - URL or IP address - **ttl** - An integer between 60 and 60000 (default: ``1800``) Additonally, the ``mxpref`` key can be present, but must be accompanied by an ``emailtype`` key. CLI Example: .. code-block:: bash salt 'my-minion' namecheap_domains_dns.set_hosts sld tld hosts u namecheap.domains.dns.setHostsu SLDu TLDi u hostnameu HostNameu recordtypeu RecordTypeu addressu Addressu ttlu TTLu mxprefu MXPrefu emailtypeu EmailTypeu DomainDNSSetHostsResulti u IsSuccessN( R R R R R t text_typet post_requestR R R t string_to_valuet getAttribute( R R t hostsR t it hostrecordt str_iR t dnsresult( ( sF /usr/lib/python2.7/site-packages/salt/modules/namecheap_domains_dns.pyt set_hostsv s( c C@ s� t j j j d � } | | d <| | d <d j | � | d <t j j j | � } | d k ra t S| j d � d } t j j j | j d � � S( u� Sets domain to use custom DNS servers. returns True if the custom nameservers were set successfully sld SLD of the domain name tld TLD of the domain name nameservers array of strings List of nameservers to be associated with this domain CLI Example: .. code-block:: bash salt 'my-minion' namecheap_domains_dns.set_custom sld tld nameserver u namecheap.domains.dns.setCustomu SLDu TLDu ,u Nameserversu DomainDNSSetCustomResulti u UpdateN( R R R R t joinR R R R R R ( R R t nameserversR R R ( ( sF /usr/lib/python2.7/site-packages/salt/modules/namecheap_domains_dns.pyt set_custom� s c C@ s} t j j j d � } | | d <| | d <t j j j | � } | d k rN t S| j d � d } t j j j | j d � � S( u� Sets domain to use namecheap default DNS servers. Required for free services like Host record management, URL forwarding, email forwarding, dynamic DNS and other value added services. sld SLD of the domain name tld TLD of the domain name Returns ``True`` if the domain was successfully pointed at the default DNS servers. CLI Example: .. code-block:: bash salt 'my-minion' namecheap_domains_dns.set_default sld tld u namecheap.domains.dns.setDefaultu SLDu TLDu DomainDNSSetDefaultResulti u UpdatedN( R R R R R R R R R R ( R R R R R ( ( sF /usr/lib/python2.7/site-packages/salt/modules/namecheap_domains_dns.pyt set_default� s ( t __doc__t __future__R R R t salt.extR t TrueR t salt.utils.namecheapR t ImportErrorR t __virtualname__R R R R R# R$ ( ( ( sF /usr/lib/python2.7/site-packages/salt/modules/namecheap_domains_dns.pyt <module> s 7 !