Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/libcloud/dns/drivers/__pycache__/onapp.cpython-39.pyc
Ðазад
a q�h�) � @ sZ d Z dgZddlZddlmZ ddlmZmZ ddlm Z m Z mZ dZG dd� de �Z dS ) z OnApp DNS Driver �OnAppDNSDriver� N)�OnAppConnection)�Provider� RecordType)� DNSDriver�Zone�Recordi� c @ s� e Zd ZejZdZdZeZ e jde jde j de jde jde jde jd e jd iZdd� Zd d� Zd)dd�Zdd� Zdd� Zdd� Zd*dd�Zd+dd�Zdd� Zdd � Zd!d"� Zd#d$� Zd%d&� Z d,d'd(�Z!dS )-r ZOnAppzhttp://onapp.com/�SOA�NS�A�AAAA�CNAME�MX�TXT�SRVc C s | j �d�}| �|j�}|S )zU Return a list of zones. :return: ``list`` of :class:`Zone` �/dns_zones.json)� connection�request� _to_zones�object)�self�response�zones� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/libcloud/dns/drivers/onapp.py� list_zones2 s zOnAppDNSDriver.list_zonesc C s | j �d| �}| �|j�}|S )z� Return a Zone instance. :param zone_id: ID of the required zone :type zone_id: ``str`` :rtype: :class:`Zone` �/dns_zones/%s.json)r r �_to_zoner )r �zone_idr �zoner r r �get_zone= s zOnAppDNSDriver.get_zone�masterNc C sP d|i}|dur|� |� t�d|i�}| jjddddi|d�}| �|j�}|S ) ah Create a new zone. :param domain: Zone domain name (e.g. example.com) :type domain: ``str`` :param type: Zone type (All zones are master by design). :type type: ``str`` :param ttl: TTL for new records. (This is not really used) :type ttl: ``int`` :param extra: Extra attributes (set auto_populate: 0 if you don't want to auto populate with existing DNS records). (optional) :type extra: ``dict`` :rtype: :class:`Zone` For more info, please see: https://docs.onapp.com/display/52API/Add+DNS+Zone �nameN�dns_zoner �POST�Content-type�application/json��method�headers�data)�update�json�dumpsr r r r ) r �domain�type�ttl�extrar# Z dns_zone_datar r r r r �create_zoneJ s �zOnAppDNSDriver.create_zonec C s | j jd|j dd� dS )z� Delete a zone. Note: This will also delete all the records belonging to this zone. :param zone: Zone to delete. :type zone: :class:`Zone` :rtype: ``bool`` r �DELETE�r( T)r r �id)r r r r r �delete_zonel s �zOnAppDNSDriver.delete_zonec C s0 | j �d|j �}|jd d }| �||�}|S )z� Return a list of records for the provided zone. :param zone: Zone to list records for. :type zone: :class:`Zone` :return: ``list`` of :class:`Record` �/dns_zones/%s/records.jsonr# �records)r r r5 r �_to_records)r r r Zdns_recordsr8 r r r �list_records| s �zOnAppDNSDriver.list_recordsc C s( | j �d||f �}| j|j|d�}|S )z� Return a Record instance. :param zone_id: ID of the required zone :type zone_id: ``str`` :param record_id: ID of the required record :type record_id: ``str`` :rtype: :class:`Record` �/dns_zones/%s/records/%s.json)r )r r � _to_recordr )r r Z record_idr �recordr r r � get_record� s �zOnAppDNSDriver.get_recordc C sP | � ||||�}t�d|i�}| jjd|j dddi|d�}| j|j|d�} | S )az Create a new record. :param name: Record name without the domain name (e.g. www). Note: If you want to create a record for a base domain name, you should specify empty string ('') for this argument. :type name: ``str`` :param zone: Zone where the requested record is created. :type zone: :class:`Zone` :param type: DNS record type (A, AAAA, ...). :type type: :class:`RecordType` :param data: Data for the record (depends on the record type). Used only for A and AAAA record types. :type data: ``str`` :param extra: Extra attributes (driver specific). (optional) :type extra: ``dict`` :rtype: :class:`Record` For more info, please see: https://docs.onapp.com/display/52API/Add+DNS+Record � dns_recordr7 r$ r% r&