File "dns_common_lexicon.cpython-36.pyc"

Full Path: /home/attunedd/public_html/byp/izo/con7ext_sym404/rintoar.txt/usr/lib/python3.6/site-packages/certbot/plugins/__pycache__/dns_common_lexicon.cpython-36.pyc
File size: 5.07 KB
MIME-type: text/x-bytecode.python
Charset: 8 bit

3

گa;@sdZddlZddlmZddlmZddlmZddlmZddlmZddlm	Z	dd	lm
Z
dd
lmZddl
mZyddlmZdd
lmZWnek
rdZdZYnXejeZGdddZeeeefeeefeeeeeffdddZdS)z;Common code for DNS Authenticator Plugins built on Lexicon.N)Any)Dict)Mapping)Optional)Union)	HTTPError)RequestException)errors)
dns_common)ConfigResolver)Providerc@seZdZdZddddZeeeddddZeeeddd	d
Zedddd
Ze	ee
jdddZe
eee
jdddZdS)
LexiconClientzI
    Encapsulates all communication with a DNS provider via Lexicon.
    N)returncCs|dS)N)selfrr(/usr/lib/python3.6/dns_common_lexicon.py__init__#szLexiconClient.__init__)domainrecord_namerecord_contentrcCsh|j|y|jjd||dWnBtk
rb}z&tjd|ddtjdj|WYdd}~XnXdS)a
        Add a TXT record using the supplied information.

        :param str domain: The domain to use to look up the managed zone.
        :param str record_name: The record name (typically beginning with '_acme-challenge.').
        :param str record_content: The record content (typically the challenge validation).
        :raises errors.PluginError: if an error occurs communicating with the DNS Provider API
        TXT)rtypenamecontentz'Encountered error adding TXT record: %sT)exc_infozError adding TXT record: {0}N)	_find_domain_idproviderZ
create_recordrloggerdebugr	PluginErrorformat)rrrrerrradd_txt_record&s	
zLexiconClient.add_txt_recordcCsy|j|Wn2tjk
r@}ztjd|dddSd}~XnXy|jjd||dWn2tk
r}ztjd|ddWYdd}~XnXdS)a
        Delete a TXT record using the supplied information.

        :param str domain: The domain to use to look up the managed zone.
        :param str record_name: The record name (typically beginning with '_acme-challenge.').
        :param str record_content: The record content (typically the challenge validation).
        :raises errors.PluginError: if an error occurs communicating with the DNS Provider  API
        z7Encountered error finding domain_id during deletion: %sT)rNr)rrrz)Encountered error deleting TXT record: %s)rr	rrrrZ
delete_recordr)rrrrr!rrrdel_txt_record7s	zLexiconClient.del_txt_record)rrcCstj|}x|D]}y0t|jdr0||jjd<n||j_|jjdStk
rz}z|j||}|rj|WYdd}~Xqt	k
r}z|j
||}|r|WYdd}~XqXqWtjdj
||dS)z
        Find the domain_id for a given domain.

        :param str domain: The domain for which to find the domain_id.
        :raises errors.PluginError: if the domain_id cannot be found.
        optionsrNzAUnable to determine zone identifier for {0} using zone names: {1})r
Zbase_domain_name_guesseshasattrrr$rZauthenticater_handle_http_error	Exception_handle_general_errorr	rr )rrZdomain_name_guessesdomain_namer!Zresult1Zresult2rrrrLs$


zLexiconClient._find_domain_id)r!r)rcCstjdj||S)Nz/Error determining zone identifier for {0}: {1}.)r	rr )rr!r)rrrr&psz LexiconClient._handle_http_errorcCs$t|jds tjdj||SdS)NzNo domain foundz9Unexpected error determining zone identifier for {0}: {1})str
startswithr	rr )rr!r)rrrr(ts
z#LexiconClient._handle_general_error)__name__
__module____qualname____doc__rr*r"r#rrr	rr&r'rr(rrrrr
s$r
)lexicon_provider_namelexicon_optionsprovider_optionsrcCsLd|i}|j|ts"|j|n&i}|j||||<tj|j}|S)ao
    Convenient function to build a Lexicon 2.x/3.x config object.
    :param str lexicon_provider_name: the name of the lexicon provider to use
    :param dict lexicon_options: options specific to lexicon
    :param dict provider_options: options specific to provider
    :return: configuration to apply to the provider
    :rtype: ConfigurationResolver or dict
    Z
provider_name)updaterZ	with_dictZwith_env)r0r1r2configZprovider_configrrrbuild_lexicon_config{s

r5)r/ZloggingZtypingrrrrrZrequests.exceptionsrrZcertbotr	Zcertbot.pluginsr
Zlexicon.configrZlexicon.providers.baserImportErrorZ	getLoggerr,rr
r*r5rrrr<module>s*

]