%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/boto_route53.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddl	Zddl
jjZddl	Zddl
mZeje�ZyWddlZddlZddlZddlmZejd�jej�eZWnek
r�eZnXd�Zd�Zd	�Zddddddd
�Z!ddddd�Z"ddddd�Z#dddddded
d�Z$eddddddd�Z%dddddddddddded
d�Z&ddddd�Z'd�Z(d�Z)eddddeeddded
d�Z*d�Z+ddddddeeedded
d�
Z,ddddddeeedded
d�
Z-deddddeeedded
d�
Z.d�Z/ed�Z0ddedddddddd �
Z1dS(!u.
Connection module for Amazon Route53

.. versionadded:: 2014.7.0

:configuration: This module accepts explicit route53 credentials but can also
    utilize IAM roles assigned to the instance through Instance Profiles.
    Dynamic credentials are then automatically obtained from AWS API and no
    further configuration is necessary. More Information available at:

    .. code-block:: yaml

        http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html

    If IAM roles are not used you need to specify them either in a pillar or
    in the minion's config file:

    .. code-block:: yaml

        route53.keyid: GKTADJGHEIQSXMKKRBJ08H
        route53.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs

    A region may also be specified in the configuration:

    .. code-block:: yaml

        route53.region: us-east-1

    If a region is not specified, the default is 'universal', which is what the boto_route53
    library expects, rather than None.

    It's also possible to specify key, keyid and region via a profile, either
    as a passed in dict, or as a string to pull from pillars or minion config:

    .. code-block:: yaml

        myprofile:
          keyid: GKTADJGHEIQSXMKKRBJ08H
          key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
          region: us-east-1

:depends: boto
i(tabsolute_importtprint_functiontunicode_literalsN(tSaltInvocationError(tDNSServerErrorubotocC@stjjjdddt�S(u,
    Only load if boto libraries exist.
    tboto_veru2.35.0tcheck_boto3(tsalttutilstversionstcheck_boto_reqstFalse(((s=/usr/lib/python2.7/site-packages/salt/modules/boto_route53.pyt__virtual__MscC@s7tjjjt�tr3tdtddt�ndS(Nuboto.assign_funcsuroute53tpack(RRtcompattpack_dundert__name__tHAS_BOTOt	__utils__t__salt__(topts((s=/usr/lib/python2.7/site-packages/salt/modules/boto_route53.pyt__init__XscC@sbx[|j�D]M}|j|kr
|jdj�dkrAtnt}||krZ|Sq
q
WtS(u
    With boto route53, zones can only be matched by name
    or iterated over in a list.  Since the name will be the
    same for public and private zones in a split DNS situation,
    iterate over the list and match the zone name and public/private
    status.
    uPrivateZoneutrue(t	get_zonestnametconfigtlowertTrueR(tzonet_conntprivate_zonet_zonet
_private_zone((s=/usr/lib/python2.7/site-packages/salt/modules/boto_route53.pyt_get_split_zone^s%c	C@s�td|d|d|d|�}|r<|r<td��nd}xq|r�y�|r�|jd�ru|jdd�n|}t|j|�d	d�}n|r�t|j|�d	d�}n[d}	d}xL|	dk	r|jd
|	d|�}
|
dd
}|
dj	dd�}	q�W|r"|SgSWqEt
k
r�}|r�d|jkr^tj
d�nd|jkr}tj
d�ntjd�|d8}qEntjd|j�gSXqEWdS(us
    Return detailed info about one, or all, zones in the bound account.
    If neither zone_id nor domain_name is provided, return all zones.
    Note that the return format is slightly different between the 'all'
    and 'single' description types.

    zone_id
        The unique identifier for the Hosted Zone

    domain_name
        The FQDN of the Hosted Zone (including final period)

    region
        Region to connect to.

    key
        Secret key to be used.

    keyid
        Access key to be used.

    profile
        A dict with region, key and keyid, or a pillar key (string) that
        contains a dict with region, key and keyid.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_route53.describe_hosted_zones domain_name=foo.bar.com.                 profile='{"region": "us-east-1", "keyid": "A12345678AB", "key": "xblahblahblah"}'
    tregiontkeytkeyidtprofileu5At most one of zone_id or domain_name may be providedi
u/hostedzone/uuGetHostedZoneResponsetstart_markert	zone_listuListHostedZonesResponseuHostedZonesu
NextMarkeru
ThrottlinguThrottled by AWS API.uPriorRequestNotCompleteuoThe request was rejected by AWS API.                              Route 53 was still processing a prior requestiiuCould not list zones: %sN(t	_get_connRt
startswithtreplacetgetattrtget_hosted_zonetNonetget_hosted_zone_by_nametget_all_hosted_zonestgetRtcodetlogtdebugttimetsleepterrortmessage(tzone_idtdomain_nameR!R"R#R$tconntretriestrettmarkertrte((s=/usr/lib/python2.7/site-packages/salt/modules/boto_route53.pytdescribe_hosted_zonesnsB"!	'	


c	C@s<td|d|d|d|�}g|D]}|d^q(S(u�
    List, by their FQDNs, all hosted zones in the bound account.

    region
        Region to connect to.

    key
        Secret key to be used.

    keyid
        Access key to be used.

    profile
        A dict with region, key and keyid, or a pillar key (string) that
        contains a dict with region, key and keyid.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_route53.list_all_zones_by_name
    R!R"R#R$uName(R?(R!R"R#R$R;R=((s=/usr/lib/python2.7/site-packages/salt/modules/boto_route53.pytlist_all_zones_by_name�s	c	C@sHtd|d|d|d|�}g|D]}|djdd�^q(S(u�
    List, by their IDs, all hosted zones in the bound account.

    region
        Region to connect to.

    key
        Secret key to be used.

    keyid
        Access key to be used.

    profile
        A dict with region, key and keyid, or a pillar key (string) that
        contains a dict with region, key and keyid.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_route53.list_all_zones_by_id
    R!R"R#R$uIdu/hostedzone/u(R?R)(R!R"R#R$R;R=((s=/usr/lib/python2.7/site-packages/salt/modules/boto_route53.pytlist_all_zones_by_id�s	ic		C@s6|dkrd}ntd|d|d|d|�}	|sH|dk	r�tjjjdd�|dk	rs|}n|dk	r�|}q�nx�|dkr1yt|	j|��SWq�tk
r-}
|r$d	|
j	kr�t
jd
�nd|
j	krt
jd�ntj
d
�|d8}q�n|
�q�Xq�WdS(u�
    Check for the existence of a Route53 hosted zone.

    .. versionadded:: 2015.8.0

    CLI Example::

        salt myminion boto_route53.zone_exists example.org
    u	universalR!R"R#R$uNeonu�The 'retry_on_rate_limit' and 'rate_limit_retries' arguments have been deprecated in favor of 'retry_on_errors' and 'error_retries' respectively. Their functionality will be removed, as such, their usage is no longer required.iu
ThrottlinguThrottled by AWS API.uPriorRequestNotCompleteuoThe request was rejected by AWS API.                              Route 53 was still processing a prior requestiiN(R,R'RRR	t
warn_untiltbooltget_zoneRR0R1R2R3R4(RR!R"R#R$tretry_on_rate_limittrate_limit_retriestretry_on_errorst
error_retriesR9R>((s=/usr/lib/python2.7/site-packages/salt/modules/boto_route53.pytzone_exists�s2	!	


c
C@s�|d
krd}n|rA|s)|rAd}t|��qAntd|d|d|d|�}	|	j|�}
|
r{tS|	j|d|d|d	|�tS(u!
    Create a Route53 hosted zone.

    .. versionadded:: 2015.8.0

    zone
        DNS zone to create

    private
        True/False if the zone will be a private zone

    vpc_id
        VPC ID to associate the zone to (required if private is True)

    vpc_region
        VPC Region (required if private is True)

    region
        region endpoint to connect to

    key
        AWS key

    keyid
        AWS keyid

    profile
        AWS pillar profile

    CLI Example::

        salt myminion boto_route53.create_zone example.org
    u	universalu:vpc_id and vpc_region must be specified for a private zoneR!R"R#R$Rtvpc_idt
vpc_regionN(R,RR'RDRtcreate_zoneR(RtprivateRJRKR!R"R#R$tmsgR9R((s=/usr/lib/python2.7/site-packages/salt/modules/boto_route53.pyRLs#	!i5uTCPuiicC@sg|dkr6|dkr6d}tj|�i|d6Stjjj||||d|d|	d|
d|�}|dkr�d}ntd|d	|d
|d|�}x�|
dkrbyi|j|�d
6SWq�t	k
r^}tj
|�|rId|jkr
tj
d�nd|jkr,tj
d�ntj
d�|
d8}
q�nitd|�d6SXq�WtS(uy
    Create a Route53 healthcheck

    .. versionadded:: 2018.3.0

    ip_addr

        IP address to check.  ip_addr or fqdn is required.

    fqdn

        Domain name of the endpoint to check.  ip_addr or fqdn is required

    port

        Port to check

    hc_type

        Healthcheck type.  HTTP | HTTPS | HTTP_STR_MATCH | HTTPS_STR_MATCH | TCP

    resource_path

        Path to check

    string_match

        If hc_type is HTTP_STR_MATCH or HTTPS_STR_MATCH, the string to search for in the
        response body from the specified resource

    request_interval

        The number of seconds between the time that Amazon Route 53 gets a response from
        your endpoint and the time that it sends the next health-check request.

    failure_threshold

        The number of consecutive health checks that an endpoint must pass or fail for
        Amazon Route 53 to change the current status of the endpoint from unhealthy to
        healthy or vice versa.

    region

        Region endpoint to connect to

    key

        AWS key

    keyid

        AWS keyid

    profile

        AWS pillar profile

    CLI Example::

        salt myminion boto_route53.create_healthcheck 192.168.0.1
        salt myminion boto_route53.create_healthcheck 192.168.0.1 port=443 hc_type=HTTPS                                                       resource_path=/ fqdn=blog.saltstack.furniture
    u7One of the following must be specified: fqdn or ip_addruerrortfqdntstring_matchtrequest_intervaltfailure_thresholdu	universalR!R"R#R$iuresultu
ThrottlinguThrottled by AWS API.uPriorRequestNotCompleteuoThe request was rejected by AWS API.                              Route 53 was still processing a prior requestiiuboto.get_errorN(R,R1R5tbototroute53thealthchecktHealthCheckR'tcreate_health_checkRR2R0R3R4RR(tip_addrROR!R"R#R$tportthc_typet
resource_pathRPRQRRRGRHRNthc_R9texc((s=/usr/lib/python2.7/site-packages/salt/modules/boto_route53.pytcreate_healthcheckTs>B
		!



c	C@sc|dkrd}ntd|d|d|d|�}|j|�}|r_|j|j�tStS(u�
    Delete a Route53 hosted zone.

    .. versionadded:: 2015.8.0

    CLI Example::

        salt myminion boto_route53.delete_zone example.org
    u	universalR!R"R#R$N(R,R'RDtdelete_hosted_zonetidRR(RR!R"R#R$R9R((s=/usr/lib/python2.7/site-packages/salt/modules/boto_route53.pytdelete_zone�s
	!cC@s|jdd�S(Nu*u\052(R)(R((s=/usr/lib/python2.7/site-packages/salt/modules/boto_route53.pyt_encode_name�scC@s|jdd�S(Nu\052u*(R)(R((s=/usr/lib/python2.7/site-packages/salt/modules/boto_route53.pyt_decode_name�sc	C@s;|dkrd}ntd|d|d|d|�}|sH|dk	r�tjjjdd�|dk	rs|}
n|dk	r�|}q�nx$|dkr�y�|r�t|||	�}n|j|�}|s�d	j|�}t	j
|�dS|j�}tj
�}t|�}|j||d
|d|
�}PWq�tk
r�}|
r�d|jkrht	jd
�nd|jkr�t	jd�ntjd�|d8}q�n|�q�Xq�W|r7t|j�|d<|jd|d<|j|d<|j|d<|jr7g|d<|dj|j�|dj|j�q7n|S(u�
    Get a record from a zone.

    CLI example::

        salt myminion boto_route53.get_record test.example.org example.org A
    u	universalR!R"R#R$uNeonu�The 'retry_on_rate_limit' and 'rate_limit_retries' arguments have been deprecated in favor of 'retry_on_errors' and 'error_retries' respectively. Their functionality will be removed, as such, their usage is no longer required.iuFailed to retrieve zone {0}tallt
identifieru
ThrottlinguThrottled by AWS API.uPriorRequestNotCompleteuoThe request was rejected by AWS API.                              Route 53 was still processing a prior requestiiunameuvalueurecord_typeuttlu
identifierN(R,R'RRR	RBR RDtformatR1R5tuppertodicttOrderedDictRbtfind_recordsRR0R2R3R4RcRtresource_recordsttypetttlRetappendtweight(RRtrecord_typet	fetch_allR!R"R#R$t	split_dnsRReRERFRGRHR9RRNt_typeR;t_recordR>((s=/usr/lib/python2.7/site-packages/salt/modules/boto_route53.pyt
get_record�s\	!	





	
cC@s8dddddddg}||kr4|jd�S|S(	NuAuMXuAAAAuTXTuSRVuSPFuNSu,(tsplit(tvalueRstsplit_types((s=/usr/lib/python2.7/site-packages/salt/modules/boto_route53.pyt_munge_value"s
c	C@sf|dkrd}ntd|d|d|d|	�}|
sH|dk	r�tjjjdd�|
dk	rs|
}n|dk	r�|}q�nx�|dkr{ya|r�t|||�}n|j|�}|s�d	j|�}t	j
|�tS|j�}PWq�t
k
rw}|rnd
|jkr2t	jd�nd|jkrQt	jd
�ntjd�|d8}q�n|�q�Xq�Wt||�}x�|dkrayG|dkr�d}n|j|||||�}t|j||
�SWq�t
k
r]}|rTd
|jkrt	jd�nd|jkr7t	jd
�ntjd�|d8}q�n|�q�Xq�WdS(u�
    Add a record to a zone.

    CLI example::

        salt myminion boto_route53.add_record test.example.org 1.1.1.1 example.org A
    u	universalR!R"R#R$uNeonu�The 'retry_on_rate_limit' and 'rate_limit_retries' arguments have been deprecated in favor of 'retry_on_errors' and 'error_retries' respectively. Their functionality will be removed, as such, their usage is no longer required.iuFailed to retrieve zone {0}u
ThrottlinguThrottled by AWS API.uPriorRequestNotCompleteuoThe request was rejected by AWS API.                              Route 53 was still processing a prior requestiii<N(R,R'RRR	RBR RDRfR1R5RRgRR0R2R3R4Ryt
add_recordt_wait_for_syncR`(RRwRRpReRmR!R"R#R$t
wait_for_syncRrRRERFRGRHR9RRNRsR>t_valuetstatus((s=/usr/lib/python2.7/site-packages/salt/modules/boto_route53.pyRz)sf	!	



	


c	C@s�|dkrd}ntd|d|d|d|	�}|rQt|||�}n|j|�}|s�dj|�}tj|�tS|j�}|
s�|dk	r�t	j
jjdd�|
dk	r�|
}n|dk	r�|}q�nt
||�}x�|d	kr�yQ|j||d
|�}|s*tS|j||||�}t|j||
�SWq�tk
r�}|r�d|jkr�tjd�nd
|jkr�tjd�ntjd�|d8}q�n|�q�Xq�WdS(u�
    Modify a record in a zone.

    CLI example::

        salt myminion boto_route53.modify_record test.example.org 1.1.1.1 example.org A
    u	universalR!R"R#R$uFailed to retrieve zone {0}uNeonu�The 'retry_on_rate_limit' and 'rate_limit_retries' arguments have been deprecated in favor of 'retry_on_errors' and 'error_retries' respectively. Their functionality will be removed, as such, their usage is no longer required.iReu
ThrottlinguThrottled by AWS API.uPriorRequestNotCompleteuoThe request was rejected by AWS API.                              Route 53 was still processing a prior requestiiN(R,R'R RDRfR1R5RRgRRR	RBRyRjt
update_recordR{R`RR0R2R3R4(RRwRRpReRmR!R"R#R$R|RrRRERFRGRHR9RRNRsR}t
old_recordR~R>((s=/usr/lib/python2.7/site-packages/salt/modules/boto_route53.pyRvsL	!
	


c	C@s�|dkrd}ntd|d|d|d|�}|
rQt|||�}n|j|�}|s�dj|�}tj|�tS|j�}|s�|
dk	r�t	j
jjdd�|dk	r�|}n|
dk	r�|
}q�nx�|d	kr�yN|j
||d
|d|�}|s!tS|j|�}t|j||	�SWq�tk
r�}|r�d|jkr{tjd
�nd|jkr�tjd�ntjd�|d8}q�n|�q�Xq�WdS(u�
    Modify a record in a zone.

    CLI example::

        salt myminion boto_route53.delete_record test.example.org example.org A
    u	universalR!R"R#R$uFailed to retrieve zone {0}uNeonu�The 'retry_on_rate_limit' and 'rate_limit_retries' arguments have been deprecated in favor of 'retry_on_errors' and 'error_retries' respectively. Their functionality will be removed, as such, their usage is no longer required.iRdReu
ThrottlinguThrottled by AWS API.uPriorRequestNotCompleteuoThe request was rejected by AWS API.                              Route 53 was still processing a prior requestiiN(R,R'R RDRfR1R5RRgRRR	RBRjt
delete_recordR{R`RR0R2R3R4(RRRpRetall_recordsR!R"R#R$R|RrRRERFRGRHR9RRNRsR�R~R>((s=/usr/lib/python2.7/site-packages/salt/modules/boto_route53.pyR��sJ	!
	


cK@s�d}x�tr�yt||�|�SWq	tk
rO}tjd||�dStk
r�}|r�|jdkr�tjd�t	j
d�|d8}q	ntjd||�dSXq	WdS(Niu6Function `%s()` not found for AWS connection object %su
Throttlingu.Throttled by AWS API.  Will retry in 5 secondsiiuFailed calling %s(): %s(RR*tAttributeErrorR1R5R,RR0R2R3R4(R9tfunctargsttriesR>((s=/usr/lib/python2.7/site-packages/salt/modules/boto_route53.pyt	_try_func�s 		



cC@s�|tkrd}n|stS|}tjd|�x�|dkr�|j|�}|jjj}|dkrrtS|d|kr�|nd}tjd||�tj|�||8}q8q8Wtj	d|�t
S(NiXu;Waiting up to %s seconds for Route53 changes to synchronizeiuINSYNCi<uDSleeping %s seconds waiting for changes to synch (current status %s)u,Route53 changes not synced after %s seconds.(RR1tinfot
get_changetGetChangeResponset
ChangeInfotStatusR3R4R5R(R~R9twaitt	orig_waittchangetcurrentR4((s=/usr/lib/python2.7/site-packages/salt/modules/boto_route53.pyR{s(	


c
C@s�|d%krd}n|jd�s3td��ntd|d|d|	d|
�}|j|�}|r}tjd|�d%Si|d	6|d
6|d6|d6}
|r�t||f�s�td
��ntdd|d|d|d|d|	d|
�j	dg�}|r;|r;g|D]}|d|kr|^q}n|sRtj
d�d%St|�dkr�tj
dg|D]}|d^qt�d%S|d}|r�|d}n|s�|d}n|
ji|d6|d6�n%t
|||f�rtjd�nt|d|
�}|d%kr4tj
d|�d%S|j	di�}|jdi�j	dd �jd!d �}t||d"d#�}|s�tj
d$|�d%S|S(&u�	
    Create a new Route53 Hosted Zone. Returns a Python data structure with information about the
    newly created Hosted Zone.

    domain_name
        The name of the domain. This must be fully-qualified, terminating with a period.  This is
        the name you have registered with your domain registrar.  It is also the name you will
        delegate from your registrar to the Amazon Route 53 delegation servers returned in response
        to this request.

    caller_ref
        A unique string that identifies the request and that allows create_hosted_zone() calls to
        be retried without the risk of executing the operation twice.  It can take several minutes
        for the change to replicate globally, and change from PENDING to INSYNC status. Thus it's
        best to provide some value for this where possible, since duplicate calls while the first
        is in PENDING status will be accepted and can lead to multiple copies of the zone being
        created.  On the other hand, if a zone is created with a given caller_ref, then deleted,
        a second attempt to create a zone with the same caller_ref will fail until that caller_ref
        is flushed from the Route53 system, which can take upwards of 24 hours.

    comment
        Any comments you want to include about the hosted zone.

    private_zone
        Set True if creating a private hosted zone.

    vpc_id
        When creating a private hosted zone, either the VPC ID or VPC Name to associate with is
        required.  Exclusive with vpe_name.  Ignored when creating a non-private zone.

    vpc_name
        When creating a private hosted zone, either the VPC ID or VPC Name to associate with is
        required.  Exclusive with vpe_id.  Ignored when creating a non-private zone.

    vpc_region
        When creating a private hosted zone, the region of the associated VPC is required.  If not
        provided, an effort will be made to determine it from vpc_id or vpc_name, where possible.
        If this fails, you'll need to provide an explicit value for this option.  Ignored when
        creating a non-private zone.

    region
        Region endpoint to connect to.

    key
        AWS key to bind with.

    keyid
        AWS keyid to bind with.

    profile
        Dict, or pillar key pointing to a dict, containing AWS region/key/keyid.

    CLI Example::

        salt myminion boto_route53.create_hosted_zone example.org
    u	universalu.u<Domain MUST be fully-qualified, complete with ending period.R!R"R#R$u%Route53 hosted zone %s already existsudomain_nameu
caller_refucommentuprivate_zoneuCEither vpc_name or vpc_id is required when creating a private zone.uboto_vpc.describe_vpcsRJRuvpcsuregionuCPrivate zone requested but a VPC matching given criteria not found.iuKPrivate zone requested but multiple VPCs matching given criteria found: %s.uidiuvpc_idu
vpc_regionuUOptions vpc_id, vpc_name, and vpc_region are ignored when creating non-private zones.ucreate_hosted_zoneuFailed to create hosted zone %suCreateHostedZoneResponseu
ChangeInfouIduu/change/R�iXu,Hosted zone %s not synced after 600 seconds.N(R,tendswithRR'R-R1R�t_exactly_oneRR/R5tlentupdatetanyR�tpopR)R{(R8t
caller_reftcommentRRJtvpc_nameRKR!R"R#R$R9tdeetsR�tvpcstvtvpcR=R~tsynced((s=/usr/lib/python2.7/site-packages/salt/modules/boto_route53.pytcreate_hosted_zones^;	!


,
	


*(2t__doc__t
__future__RRRtloggingR3tsalt.utils.compatRtsalt.utils.versionstsalt.utils.odictRRhtsalt.exceptionsRt	getLoggerRR1RStboto.route53tboto.route53.healthchecktboto.route53.exceptionRtsetLeveltCRITICALRRtImportErrorRRRR R,R?R@RARIRLR^RaRbRcRuRyRzRR�R�R{R�(((s=/usr/lib/python2.7/site-packages/salt/modules/boto_route53.pyt<module>,sz


				G-6d			F		I	:	9	

Zerion Mini Shell 1.0