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

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddlZ	ddl
Z	ddlmZm
Z
ddlmZeje�Zy?ddlZddlmZejd�jej�eZWnek
r�eZnXd�Zd	�Zd
dd�Zd
dd�Zdddddddd�Z!ddddd�Z"ddddd�Z#dddddd�Z$dddddedddddd�Z%ddddddddd�Z&ddddddddddd�
Z'ddddddddddd�
Z(ddddd�Z)dddddd�Z*d�Z+d�Z,d�Z-d�Z.dddddddddd�	Z/ddddddddd �Z0dS(!u�
Execution module for Amazon Route53 written against Boto 3

.. versionadded:: 2017.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

    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

    Note that Route53 essentially ignores all (valid) settings for 'region',
    since there is only one Endpoint (in us-east-1 if you care) and any (valid)
    region setting will just send you there.  It is entirely safe to set it to
    None as well.

:depends: boto3
i(tabsolute_importtprint_functiontunicode_literalsN(tSaltInvocationErrortCommandExecutionError(tsix(tClientErroruboto3cC@stjjj�S(ug
    Only load if boto libraries exist and if boto libraries are greater than
    a given version.
    (tsalttutilstversionstcheck_boto_reqs(((s>/usr/lib/python2.7/site-packages/salt/modules/boto3_route53.pyt__virtual__LscC@s1tjjjt�tr-tdtd�ndS(Nuboto3.assign_funcsuroute53(RRtcompattpack_dundert__name__t	HAS_BOTO3t	__utils__(topts((s>/usr/lib/python2.7/site-packages/salt/modules/boto3_route53.pyt__init__TsuMarkeru
NextMarkercC@sKg}|j|d�}d}x&|dk	rFy||�}Wn{tk
r�}	|r�|	jjdi�jd�dkr�tjd�tjd�|d8}q!ntjd	||	�gSX|r�|j|g�n|}
t	|
t
�r�|
jd
d�nd|t	|
t�r|
n|
g7}|j|�}|j
i||6�q!W|S(Nui
uErroruCodeu
ThrottlinguThrottled by AWS API.iiu'Could not collect results from %s(): %suResponseMetadata(tgettNoneRtresponsetlogtdebugttimetsleepterrort
isinstancetdicttpoptlisttupdate(tfunctitemtargstmarkert
nextmarkertrettMarkerttriestrteti((s>/usr/lib/python2.7/site-packages/salt/modules/boto3_route53.pyt_collect_resultsZs(*


%"i
icC@s�x�td|d�D]�}tjd|�d}y|jd|�dd}WnMtk
r�}|jjdi�jd�d	kr�tjd
�q�|�nX|dkr�tSt	j
|�qWtjd�tS(
Niu#Getting route53 status (attempt %s)uwaittIdu
ChangeInfouStatusuErroruCodeu
ThrottlinguThrottled by AWS API.uINSYNCu,Timed out waiting for Route53 INSYNC status.(
trangeRtinfot
get_changeRRRRtTrueRRRtFalse(tchangetconnR'RtretrytstatusR)((s>/usr/lib/python2.7/site-packages/salt/modules/boto3_route53.pyt_wait_for_syncrs$

c
C@s't||f�s!td��n|d
k	rLt|t�rLtd��n|ryt|d|d|d|d|�}n$t|d|d|d|d|�}|d
k	r�g|D]$}|ddd	|kr�|^q�}nt|�d
kr#tj	dg|D]}	|	dd^q��g}n|S(u�
    Find a hosted zone with the given characteristics.

    Id
        The unique Zone Identifier for the Hosted Zone.  Exclusive with Name.

    Name
        The domain name associated with the Hosted Zone.  Exclusive with Id.
        Note this has the potential to match more then one hosted zone (e.g. a public and a private
        if both exist) which will raise an error unless PrivateZone has also been passed in order
        split the different.

    PrivateZone
        Boolean - Set to True if searching for a private hosted zone.

    region
        Region to connect to.

    key
        Secret key to be used.

    keyid
        Access key to be used.

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

    CLI Example:

    .. code-block:: bash

        salt myminion boto3_route53.find_hosted_zone Name=salt.org.                 profile='{"region": "us-east-1", "keyid": "A12345678AB", "key": "xblahblahblah"}'
    u-Exactly one of either Id or Name is required.u7If set, PrivateZone must be a bool (e.g. True / False).tregiontkeytkeyidtprofileu
HostedZoneuConfiguPrivateZoneiuSRequest matched more than one Hosted Zone (%s). Refine your criteria and try again.uIdN(
t_exactly_oneRRRtbooltget_hosted_zonetget_hosted_zones_by_domaintlenRR(
R,tNametPrivateZoneR7R8R9R:R%tmtz((s>/usr/lib/python2.7/site-packages/salt/modules/boto3_route53.pytfind_hosted_zone�s$'$4"	c	C@sAtd|d|d|d|�}i|d6}t|jd|�S(u
    Return detailed info about the given zone.

    Id
        The unique Zone Identifier for the Hosted Zone.

    region
        Region to connect to.

    key
        Secret key to be used.

    keyid
        Access key to be used.

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

    CLI Example:

    .. code-block:: bash

        salt myminion boto3_route53.get_hosted_zone Z1234567690                 profile='{"region": "us-east-1", "keyid": "A12345678AB", "key": "xblahblahblah"}'
    R7R8R9R:uIdN(t	_get_connR+R=R(R,R7R8R9R:R3R"((s>/usr/lib/python2.7/site-packages/salt/modules/boto3_route53.pyR=�s!
c	
C@s�td|d|d|d|�}gt|jdi�D]"}|dt|�kr7|^q7}g}x=|D]5}|td|dd|d|d|d|�7}qlW|S(	u�
    Find any zones with the given domain name and return detailed info about them.
    Note that this can return multiple Route53 zones, since a domain name can be used in
    both public and private zones.

    Name
        The domain name associated with the Hosted Zone(s).

    region
        Region to connect to.

    key
        Secret key to be used.

    keyid
        Access key to be used.

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

    CLI Example:

    .. code-block:: bash

        salt myminion boto3_route53.get_hosted_zones_by_domain salt.org.                 profile='{"region": "us-east-1", "keyid": "A12345678AB", "key": "xblahblahblah"}'
    R7R8R9R:uHostedZonesuNameR,uId(RER+tlist_hosted_zonest
aws_encodeR=(	R@R7R8R9R:R3RCtzonesR%((s>/usr/lib/python2.7/site-packages/salt/modules/boto3_route53.pyR>�s!"
3c	C@sMtd|d|d|d|�}|r4i|d6ni}t|jd|�S(u�
    Return detailed info about all zones in the bound account.

    DelegationSetId
        If you're using reusable delegation sets and you want to list all of the hosted zones that
        are associated with a reusable delegation set, specify the ID of that delegation set.

    region
        Region to connect to.

    key
        Secret key to be used.

    keyid
        Access key to be used.

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

    CLI Example:

    .. code-block:: bash

        salt myminion boto3_route53.describe_hosted_zones                 profile='{"region": "us-east-1", "keyid": "A12345678AB", "key": "xblahblahblah"}'
    R7R8R9R:uDelegationSetIduHostedZones(RER+RF(tDelegationSetIdR7R8R9R:R3R"((s>/usr/lib/python2.7/site-packages/salt/modules/boto3_route53.pyRF�s!uc
C@s|jd�std��nt|�}td|d|	d|
d|�}td|d|d|d|	d|
d|�}
|
r�tjd	|�d)Si|d
6|d6i|d6|d
6d6}|r�|ji|d6�nd)|r t	||f�std��nt
dd|d|d|d|	d|
d|�jdg�}|rw|rwg|D]}|d|krR|^qR}n|s�tjd�d)St
|�dkr�tjdg|D]}|d^q��d)S|d}|r�|d}n|s�|d}n|jii|d6|d6d6�n%t|||f�rEtjd�nd}x�|ryE|j|�}|jd d)�t|d!d"|�r�|gSgSWqNtk
r}|r�|jjd#i�jd$�d%kr�tjd&�tjd'�|d8}qNntjd(||�gSXqNWgS(*u	
    Create a new Route53 Hosted Zone. Returns a Python data structure with information about the
    newly created Hosted Zone.

    Name
        The name of the domain. This should be a fully-specified domain, and should terminate with
        a period. This is the name you have registered with your DNS 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.

    VPCId
        When creating a private hosted zone, either the VPC ID or VPC Name to associate with is
        required.  Exclusive with VPCName.  Ignored if passed for a non-private zone.

    VPCName
        When creating a private hosted zone, either the VPC ID or VPC Name to associate with is
        required.  Exclusive with VPCId.  Ignored if passed for a non-private zone.

    VPCRegion
        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 VPCId or VPCName, if possible.  If
        this fails, you'll need to provide an explicit value for this option.  Ignored if passed for
        a non-private zone.

    CallerReference
        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.  This is a required parameter
        when creating new Hosted Zones.  Maximum length of 128.

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

    PrivateZone
        Boolean - Set to True if creating a private hosted zone.

    DelegationSetId
        If you want to associate a reusable delegation set with this hosted zone, the ID that Amazon
        Route 53 assigned to the reusable delegation set when you created it.  Note that XXX TODO
        create_delegation_set() is not yet implemented, so you'd need to manually create any
        delegation sets before utilizing this.

    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 boto3_route53.create_hosted_zone example.org.
    u.u>Domain must be fully-qualified, complete with trailing period.R7R8R9R:R@RAubRoute 53 hosted zone %s already exists. You may want to pass e.g. 'PrivateZone=True' or similar...uNameuCallerReferenceuCommentuPrivateZoneuHostedZoneConfiguDelegationSetIduAEither VPCName or VPCId is required when creating a private zone.uboto_vpc.describe_vpcstvpc_idtnameuvpcsuregionu@Private zone requested but no VPC matching given criteria found.iuKPrivate zone requested but multiple VPCs matching given criteria found: %s.uidiuVPCIdu	VPCRegionuVPCuROptions VPCId, VPCName, and VPCRegion are ignored when creating non-private zones.i
uResponseMetadatau
ChangeInfouIduErroruCodeu
ThrottlinguThrottled by AWS API.iu#Failed to create hosted zone %s: %sN(tendswithRRGRERDRR.RRR;t__salt__RRR?tanytcreate_hosted_zoneRR6RRRRR(R@tVPCIdtVPCNamet	VPCRegiontCallerReferencetCommentRARIR7R8R9R:R3tdeetsR"tvpcstvtvpcR'R(R)((s>/usr/lib/python2.7/site-packages/salt/modules/boto3_route53.pyROsv<! 
,



%	*


	c	C@s�t||f�s!td��ntd|d|d|d|�}|r�i|d6|d6|d6|d	6|d
6|d6}	t|	�}
|
s�tjd|�gS|
d
dd}nd}x�|r{y3|jd|d|�}|jdd�|gSWq�t	k
rw}
|r[|
j
jdi�jd�dkr[tjd�t
jd�|d8}q�ntjd|pm||
�q�Xq�WgS(u
    Update the comment on an existing Route 53 hosted zone.

    Id
        The unique Zone Identifier for the Hosted Zone.

    Name
        The domain name associated with the Hosted Zone(s).

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

    PrivateZone
        Boolean - Set to True if changing a private hosted zone.

    CLI Example::

        salt myminion boto3_route53.update_hosted_zone_comment Name=example.org.                 Comment="This is an example comment for an example zone"
    u-Exactly one of either Id or Name is required.R7R8R9R:uNameuPrivateZoneuregionukeyukeyiduprofileu4Couldn't resolve domain name %s to a hosted zone ID.iu
HostedZoneuIdi
R,RTuResponseMetadatauErroruCodeu
ThrottlinguThrottled by AWS API.iiu.Failed to update comment on hosted zone %s: %sN(R;RRERDRRtupdate_hosted_zone_commentRRRRRRRR(R,R@RTRAR7R8R9R:R3R"tzoneR'R(R)((s>/usr/lib/python2.7/site-packages/salt/modules/boto3_route53.pyRY�s4!	*


	c

C@st||f�s!td��nt||f�sBtd��n|r�i|d6td6|d6|d6|d6|	d6}
t|
�}|s�tjd	|�tS|d
dd}ntd
d|d|d|d|d|d|	�jdg�}|r(|r(g|D]}
|
d|kr|
^q}n|s?tjd�tSt	|�dkr�tjddj
g|D]}
|
d^qg��tS|d
}|r�|d}n|s�|d}ni|d6i|d6|d6d6}
|d)k	r�|
ji|d6�nd)t
d|d|d|d|	�}d}x�|ry(|j|
�}t|d d|�SWq'tk
r}|jjd!i�jd"�d#kr�tjd$�tS|r�|jjd!i�jd"�d%kr�tjd&�tjd'�|d8}q'ntjd(|p||p||�q'Xq'WtS(*u]
    Associates an Amazon VPC with a private hosted zone.

    To perform the association, the VPC and the private hosted zone must already exist. You can't
    convert a public hosted zone into a private hosted zone.  If you want to associate a VPC from
    one AWS account with a zone from a another, the AWS account owning the hosted zone must first
    submit a CreateVPCAssociationAuthorization (using create_vpc_association_authorization() or by
    other means, such as the AWS console).  With that done, the account owning the VPC can then call
    associate_vpc_with_hosted_zone() to create the association.

    Note that if both sides happen to be within the same account, associate_vpc_with_hosted_zone()
    is enough on its own, and there is no need for the CreateVPCAssociationAuthorization step.

    Also note that looking up hosted zones by name (e.g. using the Name parameter) only works
    within a single account - if you're associating a VPC to a zone in a different account, as
    outlined above, you unfortunately MUST use the HostedZoneId parameter exclusively.

    HostedZoneId
        The unique Zone Identifier for the Hosted Zone.

    Name
        The domain name associated with the Hosted Zone(s).

    VPCId
        When working with a private hosted zone, either the VPC ID or VPC Name to associate with is
        required.  Exclusive with VPCName.

    VPCName
        When working with a private hosted zone, either the VPC ID or VPC Name to associate with is
        required.  Exclusive with VPCId.

    VPCRegion
        When working with a private hosted zone, the region of the associated VPC is required.  If
        not provided, an effort will be made to determine it from VPCId or VPCName, if possible.  If
        this fails, you'll need to provide an explicit value for VPCRegion.

    Comment
        Any comments you want to include about the change being made.

    CLI Example::

        salt myminion boto3_route53.associate_vpc_with_hosted_zone                     Name=example.org. VPCName=myVPC                     VPCRegion=us-east-1 Comment="Whoo-hoo!  I added another VPC."

    u7Exactly one of either HostedZoneId or Name is required.u3Exactly one of either VPCId or VPCName is required.uNameuPrivateZoneuregionukeyukeyiduprofileu<Couldn't resolve domain name %s to a private hosted zone ID.iu
HostedZoneuIduboto_vpc.describe_vpcsRJRKR7R8R9R:uvpcsu)No VPC matching the given criteria found.iu4Multiple VPCs matching the given criteria found: %s.u, uiduHostedZoneIduVPCIdu	VPCRegionuVPCuCommenti
u
ChangeInfouErroruCodeuConflictingDomainExistsuVPC Association already exists.u
ThrottlinguThrottled by AWS API.iu2Failed to associate VPC %s with hosted zone %s: %sN(R;RR0RDRRR1RMRR?tjoinRRREtassociate_vpc_with_hosted_zoneR6RRRRR(tHostedZoneIdR@RPRQRRRTR7R8R9R:R"RZRVRWRXR3R'R(R)((s>/usr/lib/python2.7/site-packages/salt/modules/boto3_route53.pyR\�sd1",
	'


"&!	$
*


	!c

C@st||f�s!td��nt||f�sBtd��n|r�i|d6td6|d6|d6|d6|	d6}
t|
�}|s�tjd	|�tS|d
dd}ntd
d|d|d|d|d|d|	�jdg�}|r(|r(g|D]}
|
d|kr|
^q}n|s?tjd�tSt	|�dkr�tjddj
g|D]}
|
d^qg��tS|d
}|r�|d}n|s�|d}ni|d6i|d6|d6d6}
|d)k	r�|
ji|d6�nd)t
d|d|d|d|	�}d}x�|ry(|j|
�}t|d d|�SWq'tk
r}|jjd!i�jd"�d#kr�tjd$�tS|r�|jjd!i�jd"�d%kr�tjd&�tjd'�|d8}q'ntjd(|p||p||�q'Xq'WtS(*u;
    Disassociates an Amazon VPC from a private hosted zone.

    You can't disassociate the last VPC from a private hosted zone.  You also can't convert a
    private hosted zone into a public hosted zone.

    Note that looking up hosted zones by name (e.g. using the Name parameter) only works XXX FACTCHECK
    within a single AWS account - if you're disassociating a VPC in one account from a hosted zone
    in a different account you unfortunately MUST use the HostedZoneId parameter exclusively. XXX FIXME DOCU

    HostedZoneId
        The unique Zone Identifier for the Hosted Zone.

    Name
        The domain name associated with the Hosted Zone(s).

    VPCId
        When working with a private hosted zone, either the VPC ID or VPC Name to associate with is
        required.  Exclusive with VPCName.

    VPCName
        When working with a private hosted zone, either the VPC ID or VPC Name to associate with is
        required.  Exclusive with VPCId.

    VPCRegion
        When working with a private hosted zone, the region of the associated VPC is required.  If
        not provided, an effort will be made to determine it from VPCId or VPCName, if possible.  If
        this fails, you'll need to provide an explicit value for VPCRegion.

    Comment
        Any comments you want to include about the change being made.

    CLI Example::

        salt myminion boto3_route53.disassociate_vpc_from_hosted_zone                     Name=example.org. VPCName=myVPC                     VPCRegion=us-east-1 Comment="Whoops!  Don't wanna talk to this-here zone no more."

    u7Exactly one of either HostedZoneId or Name is required.u3Exactly one of either VPCId or VPCName is required.uNameuPrivateZoneuregionukeyukeyiduprofileu<Couldn't resolve domain name %s to a private hosted zone ID.iu
HostedZoneuIduboto_vpc.describe_vpcsRJRKR7R8R9R:uvpcsu)No VPC matching the given criteria found.iu4Multiple VPCs matching the given criteria found: %s.u, uiduHostedZoneIduVPCIdu	VPCRegionuVPCuCommenti
u
ChangeInfouErroruCodeuVPCAssociationNotFounduNo VPC Association exists.u
ThrottlinguThrottled by AWS API.iu2Failed to associate VPC %s with hosted zone %s: %sN(R;RR0RDRRR1RMRR?R[RRREt!disassociate_vpc_from_hosted_zoneR6RRRRR(R]R@RPRQRRRTR7R8R9R:R"RZRVRWRXR3R'R(R)((s>/usr/lib/python2.7/site-packages/salt/modules/boto3_route53.pyR^:s`*",
	'


"&!	$
*


	!c	C@sytd|d|d|d|�}y+|jd|�}t|dd|�SWn&tk
rt}tjd||�nXtS(	u~
    Delete a Route53 hosted zone.

    CLI Example::

        salt myminion boto3_route53.delete_hosted_zone Z1234567890
    R7R8R9R:R,u
ChangeInfouIdu#Failed to delete hosted zone %s: %s(REtdelete_hosted_zoneR6RRRR1(R,R7R8R9R:R3R(R)((s>/usr/lib/python2.7/site-packages/salt/modules/boto3_route53.pyR_�s!c	C@s�i|d6|d6|d6|d6|d6|d6}t|�}|sVtjd|�tS|dd	d
}td|d|d
|d|d|�S(u�
    Delete a Route53 hosted zone by domain name, and PrivateZone status if provided.

    CLI Example::

        salt myminion boto3_route53.delete_hosted_zone_by_domain example.org.
    uNameuPrivateZoneuregionukeyukeyiduprofileu4Couldn't resolve domain name %s to a hosted zone ID.iu
HostedZoneuIdR,R7R8R9R:(RDRRR1R_(	R@RAR7R8R9R:R"RZR,((s>/usr/lib/python2.7/site-packages/salt/modules/boto3_route53.pytdelete_hosted_zone_by_domain�s	cC@s�d}y/|jd�tjdt|jd��}WnNtk
rW|jd�}n/tk
r�}tjd|�t	|��nXtj
d||�|S(u�
    An implementation of the encoding required to suport AWS's domain name
    rules defined here__:

    .. __: http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DomainNameFormat.html

    While AWS's documentation specifies individual ASCII characters which need
    to be encoded, we instead just try to force the string to one of
    escaped unicode or idna depending on whether there are non-ASCII characters
    present.

    This means that we support things like ドメイン.テスト as a domain name string.

    More information about IDNA encoding in python is found here__:

    .. __: https://pypi.org/project/idna

    uasciiu\\x([a-f0-8]{2})uunicode_escapeuidnauACouldn't encode %s using either 'unicode_escape' or 'idna' codecsuAWS-encoded result for %s: %sN(Rtencodetretsubt_hexReplacetUnicodeEncodeErrort	ExceptionRRRR(txR%R)((s>/usr/lib/python2.7/site-packages/salt/modules/boto3_route53.pyRG�s
	
cC@s<d}x/|t|d�kr7t|d|dd�|d|dd<d|d|dkr�d}xo|t|d|dd�kr�t|d|dd|d�|d|dd|d<|d7}qlWnd|d|dkr*t|d|ddd	�|d|ddd	<n|d7}q	W|S(
uX
    helper method to process a change batch & encode the bits which need encoding.
    iuChangesuResourceRecordSetuNameuResourceRecordsuValueiuAliasTargetuDNSName(R?RG(tot
change_idxtrr_idx((s>/usr/lib/python2.7/site-packages/salt/modules/boto3_route53.pyt_aws_encode_changebatch�s,%<7cC@s&d|kr|jd�S|jd�S(u�
    An implementation of the decoding required to suport AWS's domain name
    rules defined here__:

    .. __: http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DomainNameFormat.html

    The important part is this:

        If the domain name includes any characters other than a to z, 0 to 9, - (hyphen),
        or _ (underscore), Route 53 API actions return the characters as escape codes.
        This is true whether you specify the characters as characters or as escape
        codes when you create the entity.
        The Route 53 console displays the characters as characters, not as escape codes."

        For a list of ASCII characters the corresponding octal codes, do an internet search on "ascii table".

    We look for the existance of any escape codes which give us a clue that
    we're received an escaped unicode string; or we assume it's idna encoded
    and then decode as necessary.
    u\uunicode_escapeuidna(tdecode(Rg((s>/usr/lib/python2.7/site-packages/salt/modules/boto3_route53.pyt_aws_decodes
cC@s0t|jd�d�}dtt|��dS(u5
    Converts a hex code to a base 16 int then the octal of it, minus the leading
    zero.

    This is necessary because x.encode('unicode_escape') automatically assumes
    you want a hex string, which AWS will accept but doesn't result in what
    you really want unless it's an octal escape sequence
    iiu\(tinttgrouptstrtoct(Rgtc((s>/usr/lib/python2.7/site-packages/salt/modules/boto3_route53.pyRd!s	c		C@s]t||f�s!td��n|r�i|d6|d6|d6|d6|d6}	|d#k	rr|	ji|d6�nd#t|	�}
|
s�tjd|�gS|
d	d
d}ntd|d
|d|d|�}g}|}
|}d#}t}xft	rX|r|Si|d6}	|
r2|	jit
|
�d6�nd#|
rX|rX|	ji|d6�nd#|rx|	ji|d6�nd#yy|j|	�}|d}|jd�}
|jd�}|jd�}x|D]}t
|d�|d<d|kr]d	}xb|t|d�krYd|d|krLt
|d|d�|d|d<n|d7}q�Wnd|kr�t
|dd�|dd<n|r�|d|kr�t	}Pn|r�|d|kr�|r�t	}Pq�q�n||g7}q�W|
s�t	}nWq�tk
rT}|jjdi�jd�d krKtjd!�tjd"�q�n|�q�Xq�Wd#S($u9
    Get all resource records from a given zone matching the provided StartRecordName (if given) or all
    records in the zone (if not), optionally filtered by a specific StartRecordType.  This will return
    any and all RRs matching, regardless of their special AWS flavors (weighted, geolocation, alias,
    etc.) so your code should be prepared for potentially large numbers of records back from this
    function - for example, if you've created a complex geolocation mapping with lots of entries all
    over the world providing the same server name to many different regional clients.

    If you want EXACTLY ONE record to operate on, you'll need to implement any logic required to
    pick the specific RR you care about from those returned.

    Note that if you pass in Name without providing a value for PrivateZone (either True or
    False), CommandExecutionError can be raised in the case of both public and private zones
    matching the domain. XXX FIXME DOCU

    CLI example::

        salt myminion boto3_route53.get_records test.example.org example.org A
    u<Exactly one of either HostedZoneId or Name must be provided.uNameuregionukeyukeyiduprofileuPrivateZoneu4Couldn't resolve domain name %s to a hosted zone ID.iu
HostedZoneuIdR7R8R9R:uHostedZoneIduStartRecordNameuStartRecordTypeuStartRecordIdentifieruResourceRecordSetsuNextRecordNameuNextRecordTypeuNextRecordIdentifieruResourceRecordsuValueiuAliasTargetuDNSNameuTypeuErroruCodeu
ThrottlinguThrottled by AWS API.iN(R;RRRRDRRRER1R0RGtlist_resource_record_setsRRmR?RRRRR(R]R@tStartRecordNametStartRecordTypeRAR7R8R9R:R"RZR3R%tnext_rr_nametnext_rr_typet
next_rr_idtdoneR(trrstrrRgR)((s>/usr/lib/python2.7/site-packages/salt/modules/boto3_route53.pytget_resource_records.sr
&!	
&& 

'
$

c	C@s�t||f�s!td��n|r�i|d6|d6|d6|d6|d6}|dk	rr|ji|d6�ndt|�}	|	s�tjd|�gS|	d	d
d}ni|d6t|�d
6}td|d|d|d|�}
d}x�|r�y+|
j	|�}t
|dd|
d�SWq�tk
r�}
|r�|
jj
di�j
d�dkr�tjd�tjd�|d8}q�ntjd|p�|tj|
��|
�q�Xq�WtS(u�

    See the `AWS Route53 API docs`__ as well as the `Boto3 documentation`__ for all the details...

    .. __: https://docs.aws.amazon.com/Route53/latest/APIReference/API_ChangeResourceRecordSets.html
    .. __: http://boto3.readthedocs.io/en/latest/reference/services/route53.html#Route53.Client.change_resource_record_sets

    The syntax for a ChangeBatch parameter is as follows, but note that the permutations of allowed
    parameters and combinations thereof are quite varied, so perusal of the above linked docs is
    highly recommended for any non-trival configurations.

    .. code-block:: text

        {
            "Comment": "string",
            "Changes": [
                {
                    "Action": "CREATE"|"DELETE"|"UPSERT",
                    "ResourceRecordSet": {
                        "Name": "string",
                        "Type": "SOA"|"A"|"TXT"|"NS"|"CNAME"|"MX"|"NAPTR"|"PTR"|"SRV"|"SPF"|"AAAA",
                        "SetIdentifier": "string",
                        "Weight": 123,
                        "Region": "us-east-1"|"us-east-2"|"us-west-1"|"us-west-2"|"ca-central-1"|"eu-west-1"|"eu-west-2"|"eu-central-1"|"ap-southeast-1"|"ap-southeast-2"|"ap-northeast-1"|"ap-northeast-2"|"sa-east-1"|"cn-north-1"|"ap-south-1",
                        "GeoLocation": {
                            "ContinentCode": "string",
                            "CountryCode": "string",
                            "SubdivisionCode": "string"
                        },
                        "Failover": "PRIMARY"|"SECONDARY",
                        "TTL": 123,
                        "ResourceRecords": [
                            {
                                "Value": "string"
                            },
                        ],
                        "AliasTarget": {
                            "HostedZoneId": "string",
                            "DNSName": "string",
                            "EvaluateTargetHealth": True|False
                        },
                        "HealthCheckId": "string",
                        "TrafficPolicyInstanceId": "string"
                    }
                },
            ]
        }

    CLI Example:

    .. code-block:: bash

        foo='{
               "Name": "my-cname.example.org.",
               "TTL": 600,
               "Type": "CNAME",
               "ResourceRecords": [
                 {
                   "Value": "my-host.example.org"
                 }
               ]
             }'
        foo=`echo $foo`  # Remove newlines
        salt myminion boto3_route53.change_resource_record_sets DomainName=example.org.                 keyid=A1234567890ABCDEF123 key=xblahblahblah                 ChangeBatch="{'Changes': [{'Action': 'UPSERT', 'ResourceRecordSet': $foo}]}"
    u:Exactly one of either HostZoneId or Name must be provided.uNameuregionukeyukeyiduprofileuPrivateZoneu4Couldn't resolve domain name %s to a hosted zone ID.iu
HostedZoneuIduHostedZoneIduChangeBatchR7R8R9R:iu
ChangeInfoiuErroruCodeu
ThrottlinguThrottled by AWS API.iiu;Failed to apply requested changes to the hosted zone %s: %sN(R;RRRRDRRRkREtchange_resource_record_setsR6RRRRRRRt	text_typeR1(R]R@RAtChangeBatchR7R8R9R:R"RZR3R'R(R)((s>/usr/lib/python2.7/site-packages/salt/modules/boto3_route53.pyR}�s8E
&!	*


	(1t__doc__t
__future__RRRtloggingRRbtsalt.utils.compatRtsalt.utils.versionstsalt.exceptionsRRtsalt.extRt	getLoggerRRtboto3tbotocore.exceptionsRtsetLeveltCRITICALR0RtImportErrorR1RRR+R6RRDR=R>RFRORYR\R^R_R`RGRkRmRdR|R}(((s>/usr/lib/python2.7/site-packages/salt/modules/boto3_route53.pyt<module>.sb


			6% 	~1		g		r	!			
	X

Zerion Mini Shell 1.0