%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@s�dZddlmZmZmZeZyddlZWne	k
rQe
ZnXddlmZd�Z
d�Zdd�Zd�Zd	�Zd
�Zd�Zdddddd�ZdS(
u]
Namecheap Domain 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_literalsN(tsixcC@str
dStS(uH
    Check to make sure requests and xml are installed and requests
    unamecheap_domains(tCAN_USE_NAMECHEAPtFalse(((sB/usr/lib/python2.7/site-packages/salt/modules/namecheap_domains.pyt__virtual__*scC@sjtjjjd�}||d<tjjj|�}|dkrDiS|jd�d}tjjj|�S(ua
    Try to reactivate the expired domain name

    Returns the following information:

    - Whether or not the domain was reactivated successfully
    - The amount charged for reactivation
    - The order ID
    - The transaction ID

    CLI Example:

    .. code-block:: bash

        salt 'my-minion' namecheap_domains.reactivate my-domain-name
    unamecheap.domains.reactivateu
DomainNameuDomainReactivateResultiN(tsalttutilst	namecheaptget_optstpost_requesttNonetgetElementsByTagNametxml_to_dict(tdomain_nametoptstresponse_xmltdomainreactivateresult((sB/usr/lib/python2.7/site-packages/salt/modules/namecheap_domains.pyt
reactivate3s
cC@s�tjjjd�}||d<||d<|dk	rB||d<ntjjj|�}|dkrgiS|jd�d}tjjj|�S(u�
    Try to renew the specified expiring domain name for a specified number of years

    domain_name
        The domain name to be renewed

    years
        Number of years to renew

    Returns the following information:

    - Whether or not the domain was renewed successfully
    - The domain ID
    - The order ID
    - The transaction ID
    - The amount charged for renewal

    CLI Example:

    .. code-block:: bash

        salt 'my-minion' namecheap_domains.renew my-domain-name 5
    unamecheap.domains.renewu
DomainNameuYearsu
PromotionCodeuDomainRenewResultiN(RRR	R
RRR
R(Rtyearstpromotion_codeRRtdomainrenewresult((sB/usr/lib/python2.7/site-packages/salt/modules/namecheap_domains.pytrenewPs


cpK@s�d�}dqdrdsdtdudvdwdxdydzd{d|d}d~dd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�g%}tjjjd��}||d�<tj|�|d�<d��}x|tj|�D]k\}}|jd��r
|||||d�d�d�d�d�g�n|jd��rB|||||d�d�d�d�d�g�n|jd��rz|||||d�d�d�d�d�g�n|jd��r�|||||d�d�d�d�d�g�n|jd��r�|||||d�d�d�d�d�g�n|d�kr'||kr'tjjjj	d��t
d���n|||<q�WxO|D]G}	|	|kr<tjjjj	d�|	d��t
d�|	d���q<q<Wtjjj|�}
|
d�kr�iS|
j
d��d�}tjjj|�S(�u0
    Try to register the specified domain name

    domain_name
        The domain name to be registered

    years
        Number of years to register

    Returns the following information:

    - Whether or not the domain was renewed successfully
    - Whether or not WhoisGuard is enabled
    - Whether or not registration is instant
    - The amount charged for registration
    - The domain ID
    - The order ID
    - The transaction ID

    CLI Example:

    .. code-block:: bash

        salt 'my-minion' namecheap_domains.create my-domain-name 2
    uafrualbuarauarguarmuasmuastuaveuawauazeubakubalubanubaqubasubelubenubhoubosubuluburucarucatucheuchiuchvucopucosuczeudanudivudoiudutuenguestufaoufijufinufreufryugeougeruglaugleugonugreugujuhebuhinuhunuincuinduinhuisluitaujavujpnukasukazukhmukirukorukurulaoulavulitultzumalumkdumltumolumonumriumsaunepunoruoriuossupanuperupoluporupusurajurumurususanuscrusinuslouslvusmousndusomuspausrdusrpuswausweusyrutamutelutgkuthautibuturuukruurduuzbuvieuweluyidu
AdminAddress1u	AdminCityuAdminCountryuAdminEmailAddressuAdminFirstNameu
AdminLastNameu
AdminPhoneuAdminPostalCodeuAdminStateProvinceuAuxBillingAddress1uAuxBillingCityuAuxBillingCountryuAuxBillingEmailAddressuAuxBillingFirstNameuAuxBillingLastNameuAuxBillingPhoneuAuxBillingPostalCodeuAuxBillingStateProvinceuRegistrantAddress1uRegistrantCityuRegistrantCountryuRegistrantEmailAddressuRegistrantFirstNameuRegistrantLastNameuRegistrantPhoneuRegistrantPostalCodeuRegistrantStateProvinceuTechAddress1uTechCityuTechCountryuTechEmailAddressu
TechFirstNameuTechLastNameu	TechPhoneuTechPostalCodeuTechStateProvinceuYearsunamecheap.domains.createu
DomainNamecS@s8x1|D])}||}||kr|||<qqWdS(N((t	opts_dicttkwargstvaluetsuffixtpreficestprefixtnextkey((sB/usr/lib/python2.7/site-packages/salt/modules/namecheap_domains.pytadd_to_opts�s

u
Registranti
uTechuAdminu
AuxBillinguBillingiiiuIdnCodeuInvalid IdnCodeuMissing required parameter 'u'uDomainCreateResulti(puafrualbuarauarguarmuasmuastuaveuawauazeubakubalubanubaqubasubelubenubhoubosubuluburucarucatucheuchiuchvucopucosuczeudanudivudoiudutuenguestufaoufijufinufreufryugeougeruglaugleugonugreugujuhebuhinuhunuincuinduinhuisluitaujavujpnukasukazukhmukirukorukurulaoulavulitultzumalumkdumltumolumonumriumsaunepunoruoriuossupanuperupoluporupusurajurumurususanuscrusinuslouslvusmousndusomuspausrdusrpuswausweusyrutamutelutgkuthautibuturuukruurduuzbuvieuweluyidN(RRR	R
Rt	text_typet	iteritemst
startswithtlogterrort	ExceptionRRR
tatts_to_dict(RRRt	idn_codestrequire_optsRRtkeyRtrequiredkeyRtdomainresult((sB/usr/lib/python2.7/site-packages/salt/modules/namecheap_domains.pytcreatexsX
	)))))
cG@s�tjjjd�}dj|�|d<tjjj|�}|dkrMiSi}xN|jd�D]=}|jd�}tjjj	|�||jd�j
�<qcW|S(uT
    Checks the availability of domains

    domains_to_check
        array of strings  List of domains to check

    Returns a dictionary mapping the each domain name to a boolean denoting
    whether or not it is available.

    CLI Example:

    .. code-block:: bash

        salt 'my-minion' namecheap_domains.check domain-to-check
    unamecheap.domains.checku,u
DomainListuDomainCheckResultu	AvailableuDomainN(RRR	R
tjointget_requestRR
tgetAttributetstring_to_valuetlower(tdomains_to_checkRRtdomains_checkedtresultt	available((sB/usr/lib/python2.7/site-packages/salt/modules/namecheap_domains.pytcheck�s,cC@sjtjjjd�}||d<tjjj|�}|dkrDgS|jd�d}tjjj|�S(u-
    Returns information about the requested domain

    returns a dictionary of information about the domain_name

    domain_name
        string  Domain name to get information about

    CLI Example:

    .. code-block:: bash

        salt 'my-minion' namecheap_domains.get_info my-domain-name
    unamecheap.domains.getinfou
DomainNameuDomainGetInfoResultiN(RRR	R
R.RR
R(RRRtdomaingetinforesult((sB/usr/lib/python2.7/site-packages/salt/modules/namecheap_domains.pytget_info�s
cC@s�tjjjtjjjd��}|d	kr4gS|jd�d}g}x�|jd�D]�}tjjj|�}|jj	|d<g}|jd�d}x3|jd�D]"}|j
tjjj|��q�W||d<|j
|�q]W|S(
u�
    Returns a list of TLDs as objects

    CLI Example:

    .. code-block:: bash

        salt 'my-minion' namecheap_domains.get_tld_list
    unamecheap.domains.gettldlistuTldsiuTldudatau
CategoriesuTldCategoryu
categoriesN(RRR	R.R
RR
R&t
firstChildtdatatappend(Rt	tldresultttldstettldt
categoriest
subcategoriestc((sB/usr/lib/python2.7/site-packages/salt/modules/namecheap_domains.pytget_tld_list
s$ 
c
C@s�tjjjd�}|dk	r_|dkrRtjjjjd�td��n||d<n|dk	r�t|�dkr�tjjjj	d�|d	d!}n||d
<n|dk	r�||d<n|dk	r|dks�|d
krtjjjjd�td��n||d<n|dk	ri|dkr\tjjjjd�td��n||d<ntjjj
|�}|dkr�gS|jd�d	}g}x3|jd�D]"}	|jtjjj
|	��q�W|S(u�
    Returns a list of domains for the particular user as a list of objects
    offset by ``page`` length of ``page_size``

    list_type : ALL
        One of ``ALL``, ``EXPIRING``, ``EXPIRED``

    search_term
        Keyword to look for on the domain list

    page : 1
        Number of result page to return

    page_size : 20
        Number of domains to be listed per page (minimum: ``10``, maximum:
        ``100``)

    sort_by
        One of ``NAME``, ``NAME_DESC``, ``EXPIREDATE``, ``EXPIREDATE_DESC``,
        ``CREATEDATE``, or ``CREATEDATE_DESC``

    CLI Example:

    .. code-block:: bash

        salt 'my-minion' namecheap_domains.get_list
    unamecheap.domains.getListuALLuEXPIRINGuEXPIREDuInvalid option for list_typeuListTypeiFu*search_term trimmed to first 70 charactersiu
SearchTermuPageidi
uInvalid option for pageuPageSizeuNAMEu	NAME_DESCu
EXPIREDATEuEXPIREDATE_DESCu
CREATEDATEuCREATEDATE_DESCuInvalid option for sort_byuSortByuDomainGetListResultuDomainN(uALLuEXPIRINGuEXPIRED(uNAMEu	NAME_DESCu
EXPIREDATEuEXPIREDATE_DESCu
CREATEDATEuCREATEDATE_DESC(RRR	R
RR#R$R%tlentwarningR.R
R;R&(
t	list_typetsearch_termtpaget	page_sizetsort_byRRR+tdomainstd((sB/usr/lib/python2.7/site-packages/salt/modules/namecheap_domains.pytget_list-s> 




 (t__doc__t
__future__RRRtTrueRtsalt.utils.namecheapRtImportErrorRtsalt.extRRRRRR,R6R8RCRM(((sB/usr/lib/python2.7/site-packages/salt/modules/namecheap_domains.pyt<module>s&

			(	Y	 		 

Zerion Mini Shell 1.0