%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/libcloud_dns.pyo

�
���^c@@s�dZddlmZmZmZddlZddlZddlm	Z
eje�Z
dZy�ddlZddlmZddlmZeed�r�e
ej�e
e�kr�e��nejd	�jej�eZWnek
r�eZnXd
�Zd�Zd�Zd
�Zd�Z dd�Z"d�Z#d�Z$ddd�Z%ddd�Z&d�Z'd�Z(d�Z)d�Z*d�Z+d�Z,d�Z-d�Z.dS(uC
Apache Libcloud DNS Management
==============================

Connection module for Apache Libcloud DNS management

.. versionadded:: 2016.11.0

:configuration:
    This module uses a configuration profile for one or multiple DNS providers

    .. code-block:: yaml

        libcloud_dns:
            profile_test1:
              driver: cloudflare
              key: 12345
              secret: mysecret
            profile_test2:
              driver: godaddy
              key: 12345
              secret: mysecret
              shopper_id: 12345

:depends: apache-libcloud
i(tabsolute_importtunicode_literalstprint_functionN(tLooseVersionu2.0.0(t
get_driver(t
RecordTypeu__version__ulibcloudcC@s#tsdjt�}t|fStS(u0
    Only load if libcloud libraries exist.
    uAA apache-libcloud library with version at least {0} was not found(tHAS_LIBCLOUDtformattREQUIRED_LIBCLOUD_VERSIONtFalsetTrue(tmsg((s=/usr/lib/python2.7/site-packages/salt/modules/libcloud_dns.pyt__virtual__:s
	
cC@stjjjt�dS(N(tsalttutilstcompattpack_dundert__name__(topts((s=/usr/lib/python2.7/site-packages/salt/modules/libcloud_dns.pyt__init__EscC@s�tdd�|}t|d�}|j�}|d=|jd�|d<|jdd�|d<|jdt�|d<|jdd�|d<|jdd�|d<||�S(	Nu
config.optionulibcloud_dnsudriverukeyusecretusecureuhostuport(t__salt__RtcopytgettNoneR
(tprofiletconfigtclstargs((s=/usr/lib/python2.7/site-packages/salt/modules/libcloud_dns.pyt_get_driverIscC@std|�}|j�S(u�
    List available record types for the given profile, e.g. A, AAAA

    :param profile: The profile key
    :type  profile: ``str``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_dns.list_record_types profile1
    R(Rtlist_record_types(Rtconn((s=/usr/lib/python2.7/site-packages/salt/modules/libcloud_dns.pyRVs
cC@s2td|�}g|j�D]}t|�^qS(u�
    List zones for the given profile

    :param profile: The profile key
    :type  profile: ``str``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_dns.list_zones profile1
    R(Rt
list_zonest_simple_zone(RRtzone((s=/usr/lib/python2.7/site-packages/salt/modules/libcloud_dns.pyRgs
cC@s�td|�}|j|�}|dk	r_g|j|�D]!}|j|kr:t|�^q:Sg|j|�D]}t|�^qoSdS(u{
    List records for the given zone_id on the given profile

    :param zone_id: Zone to export.
    :type  zone_id: ``str``

    :param profile: The profile key
    :type  profile: ``str``

    :param type: The record type, e.g. A, NS
    :type  type: ``str``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_dns.list_records google.com profile1
    RN(Rtget_zoneRtlist_recordsttypet_simple_record(tzone_idRR$RR!trecord((s=/usr/lib/python2.7/site-packages/salt/modules/libcloud_dns.pyR#xs
5cC@s"td|�}t|j|��S(u8
    Get zone information for the given zone_id on the given profile

    :param zone_id: Zone to export.
    :type  zone_id: ``str``

    :param profile: The profile key
    :type  profile: ``str``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_dns.get_zone google.com profile1
    R(RR R"(R&RR((s=/usr/lib/python2.7/site-packages/salt/modules/libcloud_dns.pyR"�scC@s%td|�}t|j||��S(u�
    Get record information for the given zone_id on the given profile

    :param zone_id: Zone to export.
    :type  zone_id: ``str``

    :param record_id: Record to delete.
    :type  record_id: ``str``

    :param profile: The profile key
    :type  profile: ``str``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_dns.get_record google.com www profile1
    R(RR%t
get_record(R&t	record_idRR((s=/usr/lib/python2.7/site-packages/salt/modules/libcloud_dns.pyR(�sumastercC@s4td|�}|j|d|d|�}t|�S(u�
    Create a new zone.

    :param domain: Zone domain name (e.g. example.com)
    :type domain: ``str``

    :param profile: The profile key
    :type  profile: ``str``

    :param type: Zone type (master / slave).
    :type  type: ``str``

    :param ttl: TTL for new records. (optional)
    :type  ttl: ``int``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_dns.create_zone google.com profile1
    RR$tttl(Rt
create_recordR (tdomainRR$R*RR!((s=/usr/lib/python2.7/site-packages/salt/modules/libcloud_dns.pytcreate_zone�sc
C@sFtd|�}|j|�}t|jd|d|d|d|��S(u
    Update an existing zone.

    :param zone_id: Zone ID to update.
    :type  zone_id: ``str``

    :param domain: Zone domain name (e.g. example.com)
    :type  domain: ``str``

    :param profile: The profile key
    :type  profile: ``str``

    :param type: Zone type (master / slave).
    :type  type: ``str``

    :param ttl: TTL for new records. (optional)
    :type  ttl: ``int``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_dns.update_zone google.com google.com profile1 type=slave
    RR!R,R$R*(RR"R tupdate_zone(R&R,RR$R*RR!((s=/usr/lib/python2.7/site-packages/salt/modules/libcloud_dns.pyR.�scC@sFtd|�}t|�}|j|�}t|j||||��S(u�
    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_id: Zone where the requested record is created.
    :type  zone_id: ``str``

    :param type: DNS record type (A, AAAA, ...).
    :type  type: ``str``

    :param data: Data for the record (depends on the record type).
    :type  data: ``str``

    :param profile: The profile key
    :type  profile: ``str``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_dns.create_record www google.com A 12.32.12.2 profile1
    R(Rt_string_to_record_typeR"R%R+(tnameR&R$tdataRRtrecord_typeR!((s=/usr/lib/python2.7/site-packages/salt/modules/libcloud_dns.pyR+�scC@s.td|�}|jd|�}|j|�S(u 
    Delete a zone.

    :param zone_id: Zone to delete.
    :type  zone_id: ``str``

    :param profile: The profile key
    :type  profile: ``str``

    :rtype: ``bool``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_dns.delete_zone google.com profile1
    RR&(RR"tdelete_zone(R&RRR!((s=/usr/lib/python2.7/site-packages/salt/modules/libcloud_dns.pyR3scC@s4td|�}|jd|d|�}|j|�S(uo
    Delete a record.

    :param zone_id: Zone to delete.
    :type  zone_id: ``str``

    :param record_id: Record to delete.
    :type  record_id: ``str``

    :param profile: The profile key
    :type  profile: ``str``

    :rtype: ``bool``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_dns.delete_record google.com www profile1
    RR&R)(RR(t
delete_record(R&R)RRR'((s=/usr/lib/python2.7/site-packages/salt/modules/libcloud_dns.pyR40scC@s+td|�}|j|�}|j|�S(uo
    Export Zone to the BIND compatible format.

    :param zone_id: Zone to export.
    :type  zone_id: ``str``

    :param profile: The profile key
    :type  profile: ``str``

    :return: Zone data in BIND compatible format.
    :rtype: ``str``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_dns.get_bind_data google.com profile1
    R(RR"texport_zone_to_bind_format(R&RRR!((s=/usr/lib/python2.7/site-packages/salt/modules/libcloud_dns.pyt
get_bind_dataJscK@s2t|�td|�}t||�}||�S(u�
    Call an extended method on the driver

    :param method: Driver's method name
    :type  method: ``str``

    :param profile: The profile key
    :type  profile: ``str``

    :param libcloud_kwargs: Extra arguments for the driver's delete_container method
    :type  libcloud_kwargs: ``dict``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_dns.extra ex_get_permissions google container_name=my_container object_name=me.jpg --out=yaml
    R(t_sanitize_kwargsRtgetattr(tmethodRtlibcloud_kwargsRtconnection_method((s=/usr/lib/python2.7/site-packages/salt/modules/libcloud_dns.pytextrabs
cC@s|j�}tt|�}|S(u�
    Return a string representation of a DNS record type to a
    libcloud RecordType ENUM.

    :param string: A record type, e.g. A, TXT, NS
    :type  string: ``str``

    :rtype: :class:`RecordType`
    (tupperR8R(tstringR2((s=/usr/lib/python2.7/site-packages/salt/modules/libcloud_dns.pyR/{s
cC@s6i|jd6|jd6|jd6|jd6|jd6S(Nuidudomainutypeuttluextra(tidR,R$R*R<(R!((s=/usr/lib/python2.7/site-packages/salt/modules/libcloud_dns.pyR �s



cC@sPi|jd6|jd6|jd6|jd6t|j�d6|jd6|jd6S(Nuidunameutypeudatauzoneuttluextra(R?R0R$R1R R!R*R<(R'((s=/usr/lib/python2.7/site-packages/salt/modules/libcloud_dns.pyR%�s




(/t__doc__t
__future__RRRtloggingtsalt.utils.compatR
tsalt.utils.versionsRt
_LooseVersiont	getLoggerRtlogRtlibcloudtlibcloud.dns.providersRtlibcloud.dns.typesRthasattrt__version__tImportErrortsetLeveltCRITICALR
RR	RRRRRRR#R"R(R-R.R+R3R4R6R<R/R R%(((s=/usr/lib/python2.7/site-packages/salt/modules/libcloud_dns.pyt<module>sD*


			
					"						

Zerion Mini Shell 1.0