%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/modules/namecheap_domains_dns.pyc

�
���^c@@s�dZddlmZmZmZddlmZeZyddl	Z
Wnek
raeZnXdZ
d�Zd�Zd�Zd	�Zd
�Zd�ZdS(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(tabsolute_importtprint_functiontunicode_literals(tsixNunamecheap_domains_dnscC@str
dStS(uH
    Check to make sure requests and xml are installed and requests
    unamecheap_domains_dns(tCAN_USE_NAMECHEAPtFalse(((sF/usr/lib/python2.7/site-packages/salt/modules/namecheap_domains_dns.pyt__virtual__/scC@sttjjjd�}||d<||d<tjjj|�}|dkrNiS|jd�d}tjjj|�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
    unamecheap.domains.dns.gethostsuTLDuSLDuDomainDNSGetHostsResultiN(tsalttutilst	namecheaptget_optstget_requesttNonetgetElementsByTagNametxml_to_dict(tsldttldtoptstresponse_xmltdomaindnsgethostsresult((sF/usr/lib/python2.7/site-packages/salt/modules/namecheap_domains_dns.pyt	get_hosts8s

cC@sttjjjd�}||d<||d<tjjj|�}|dkrNiS|jd�d}tjjj|�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
    unamecheap.domains.dns.getlistuTLDuSLDuDomainDNSGetListResultiN(RRR	R
RRR
R(RRRRtdomaindnsgetlistresult((sF/usr/lib/python2.7/site-packages/salt/modules/namecheap_domains_dns.pytget_listWs

c	C@s3tjjjd�}||d<||d<d}x�|D]�}tj|�}|d|d|<|d|d|<|d	|d
|<d|kr�|d|d|<nd
|kr�|d
|d|<|d|d<n|d7}q6Wtjjj|�}|dkrtS|j	d�d}tjjj
|jd��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
    unamecheap.domains.dns.setHostsuSLDuTLDiuhostnameuHostNameu
recordtypeu
RecordTypeuaddressuAddressuttluTTLumxprefuMXPrefu	emailtypeu	EmailTypeuDomainDNSSetHostsResultiu	IsSuccessN(RRR	R
Rt	text_typetpost_requestRRR
tstring_to_valuetgetAttribute(	RRthostsRtit
hostrecordtstr_iRt	dnsresult((sF/usr/lib/python2.7/site-packages/salt/modules/namecheap_domains_dns.pyt	set_hostsvs(


cC@s�tjjjd�}||d<||d<dj|�|d<tjjj|�}|d	kratS|jd�d}tjjj	|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
    unamecheap.domains.dns.setCustomuSLDuTLDu,uNameserversuDomainDNSSetCustomResultiuUpdateN(RRR	R
tjoinRRRR
RR(RRtnameserversRRR((sF/usr/lib/python2.7/site-packages/salt/modules/namecheap_domains_dns.pyt
set_custom�s

cC@s}tjjjd�}||d<||d<tjjj|�}|dkrNtS|jd�d}tjjj|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.setDefaultuSLDuTLDuDomainDNSSetDefaultResultiuUpdatedN(
RRR	R
RRRR
RR(RRRRR((sF/usr/lib/python2.7/site-packages/salt/modules/namecheap_domains_dns.pytset_default�s

(t__doc__t
__future__RRRtsalt.extRtTrueRtsalt.utils.namecheapRtImportErrorRt__virtualname__RRRR R#R$(((sF/usr/lib/python2.7/site-packages/salt/modules/namecheap_domains_dns.pyt<module>s

					7	!

Zerion Mini Shell 1.0