%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_elb.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZeje�Z	ddl
Zddlj
jZddlZddlmZy�ddlZddlZddlmZddlmZddlmZddlmZdd	lmZejd
�jej�eZWnek
r'e ZnXd�Z!ddddd�Z#ddddd
�Z$ddddd�Z%ddddd�Z&d�Z'dddddddd�Z(ddddd�Z)ddddd�Z*ddddd�Z+ddddd�Z,ddddd�Z-ddddd�Z.ddddd�Z/ddddd�Z0ddddd�Z1ddddd�Z2ddddd�Z3ddddd�Z4ddddd�Z5ddddd �Z6e ddddd!�Z7dddddd"�Z8ddddd#�Z9ddddd$�Z:dddddd%�Z;dddddd&�Z<ddddd'�Z=ddddd(�Z>d)�Z?dd*�Z@d+�ZAd,�ZBdS(-u�
Connection module for Amazon ELB

.. versionadded:: 2014.7.0

:configuration: This module accepts explicit elb 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:: text

        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

        elb.keyid: GKTADJGHEIQSXMKKRBJ08H
        elb.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs

    A region may also be specified in the configuration:

    .. code-block:: yaml

        elb.region: us-east-1

    If a region is not specified, the default is 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

:depends: boto >= 2.33.0
i(tabsolute_importtprint_functiontunicode_literalsN(tsix(tHealthCheck(tAccessLogAttribute(tConnectionDrainingAttribute(tConnectionSettingAttribute(tCrossZoneLoadBalancingAttributeubotocC@sNtjjjdddt�}|tkrJtdtddddt�n|S(	u,
    Only load if boto libraries exist.
    tboto_veru2.33.0tcheck_boto3uboto.assign_funcsuelbtmoduleuec2.elbtpack(	tsalttutilstversionstcheck_boto_reqstFalsetTruet	__utils__t__name__t__salt__(t
has_boto_reqs((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pyt__virtual__Ls	 c	C@s�td|d|d|d|�}y7|jd|g�}|rCtStjd|�tSWn'tjjk
r�}tj	|�tSXdS(u�
    Check to see if an ELB exists.

    CLI example:

    .. code-block:: bash

        salt myminion boto_elb.exists myelb region=us-east-1
    tregiontkeytkeyidtprofiletload_balancer_namesu-The load balancer does not exist in region %sN(
t	_get_conntget_all_load_balancersRtlogtdebugRtbotot	exceptiontBotoServerErrortwarning(tnameRRRRtconntelbterror((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pytexistsZs
!
c	C@sptd|d|d|d|�}y!g|j�D]}|^q1SWn'tjjk
rk}tj|�gSXdS(u�
    Return all load balancers associated with an account

    CLI example:

    .. code-block:: bash

        salt myminion boto_elb.get_all_elbs region=us-east-1
    RRRRN(RRR!R"R#RR$(RRRRR&teR(((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pytget_all_elbsrs
!!
c
C@s5gtd|d|d|d|�D]}|j^q"S(u�
    Return names of all load balancers associated with an account

    CLI example:

    .. code-block:: bash

        salt myminion boto_elb.list_elbs region=us-east-1
    RRRR(R+R%(RRRRR*((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pyt	list_elbs�sc	C@s�td|d|d|d|�}d}x^|r�y�|jd|g�}|d}i}|j|d<g}	x~|jD]s}
i}|
j|d	<|
j|d
<|
j|d<|
j|d<|
j|d
<|
j	r�|
j	|d<n|	j
|�quW|	|d<g}xT|jD]I}
i}|
j|d<g|
jD]}|j
^q)|d
<|j
|�qW||d<|j|d<|j|d<|j|d<|j|d<t||�|d<|jj|jj|jjg}g}x.|D]&}|g|D]}|j
^q�7}q�W||d
<|SWq*tjjk
r�}|jdkr\tjd�tjd�|d8}q*ntjd||j�tj|�iSXq*WiS(u�
    Get an ELB configuration.

    CLI example:

    .. code-block:: bash

        salt myminion boto_elb.exists myelb region=us-east-1
    RRRRiRiuavailability_zonesuelb_portuelb_protocolu
instance_portuinstance_protocolupoliciesucertificateu	listenersubackendsusubnetsusecurity_groupsuschemeudns_nameutagsu
Throttlingu.Throttled by AWS API, will retry in 5 seconds.iiu$Error fetching config for ELB %s: %s( RRtavailability_zonest	listenerstload_balancer_porttprotocolt
instance_porttinstance_protocoltpolicy_namestssl_certificate_idtappendtbackendstpoliciestpolicy_nametsubnetstsecurity_groupstschemetdns_namet
_get_all_tagstapp_cookie_stickiness_policiestlb_cookie_stickiness_policiestother_policiesR!R"R#t
error_codeRR ttimetsleepR(tmessage(R%RRRRR&tretriestlbtretR.t	_listenert
listener_dictR6t_backendtbs_dicttptlb_policy_listsR7tpolicy_listR(((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pytget_elb_config�sd
!	






	

#




		
$




	cC@swd|kr|dj�}n|dj�}|d|d|d|g}d|krm|j|d�nt|�S(u
    Convert an ELB listener dict into a listener tuple used by certain parts of
    the AWS ELB API.

    CLI example:

    .. code-block:: bash

        salt myminion boto_elb.listener_dict_to_tuple '{"elb_port":80,"instance_port":80,"elb_protocol":"HTTP"}'
    uinstance_protocoluelb_protocoluelb_portu
instance_portucertificate(tupperR5ttuple(tlistenerR2tlistener_tuple((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pytlistener_dict_to_tuple�suinternet-facingc

C@sctd|d|d|d|	�}
t|||||	�r=tSt|tj�rgtjjj	|�}nt|tj�r�tjjj	|�}ng}x!|D]}|j
t|��q�Wyb|
jd|d|d|d|d	|d
|�}
|
rt
jd|�tSt
jd|�tSWn?tjjk
r^}t
jd
||j|jdtj�tSXdS(u�
    Create an ELB

    CLI example to create an ELB:

    .. code-block:: bash

        salt myminion boto_elb.create myelb '["us-east-1a", "us-east-1e"]' '{"elb_port": 443, "elb_protocol": "HTTPS", ...}' region=us-east-1
    RRRRR%tzonesR9R:R;tcomplex_listenersuCreated ELB %suFailed to create ELB %suFailed to create ELB %s: %s: %stexc_info_on_loglevelN(RR)Rt
isinstanceRtstring_typesR
RtjsontloadsR5RTtcreate_load_balancerRtinfoR(RR!R"R#RARDtloggingtDEBUG(R%R-R.R9R:R;RRRRR&t_complex_listenersRRRFR(((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pytcreate�s0
!
		
c	C@s�td|d|d|d|�}t|||||�s=tSy%|j|�tjd|�tSWn3tjjk
r�}tj	d|dt
j�tSXdS(	u�
    Delete an ELB.

    CLI example to delete an ELB:

    .. code-block:: bash

        salt myminion boto_elb.delete myelb region=us-east-1
    RRRRuDeleted ELB %s.uFailed to delete ELB %sRWN(
RR)Rtdelete_load_balancerRR]R!R"R#R(R^R_R(R%RRRRR&R(((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pytdeletes
!

c
	C@s�td|d|d|d|�}t|tj�rKtjjj|�}ng}x!|D]}|jt	|��qXWy+|j
|g|�tjd|�t
SWn6tjjk
r�}	tjd||	dtj�tSXdS(	u�
    Create listeners on an ELB.

    CLI example:

    .. code-block:: bash

        salt myminion boto_elb.create_listeners myelb '[["HTTPS", "HTTP", 443, 80, "arn:aws:iam::11  11111:server-certificate/mycert"]]'
    RRRRuCreated ELB listeners on %su(Failed to create ELB listeners on %s: %sRWN(RRXRRYR
RRZR[R5RTtcreate_load_balancer_listenersRR]RR!R"R#R(R^R_R(
R%R.RRRRR&R`RRR(((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pytcreate_listeners/s!

c	C@s�td|d|d|d|�}t|tj�rKtjjj|�}ny(|j||�t	j
d|�tSWn6tj
jk
r�}t	jd||dtj�tSXdS(	u�
    Delete listeners on an ELB.

    CLI example:

    .. code-block:: bash

        salt myminion boto_elb.delete_listeners myelb '[80,443]'
    RRRRuDeleted ELB listeners on %su(Failed to delete ELB listeners on %s: %sRWN(RRXRRYR
RRZR[tdelete_load_balancer_listenersRR]RR!R"R#R(R^R_R(R%tportsRRRRR&R(((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pytdelete_listenersLs!
c	C@s�td|d|d|d|�}t|tj�rKtjjj|�}ny(|j||�t	j
d|�tSWn=tj
jk
r�}t	j|�t	jd||j�tSXdS(u�
    Apply security groups to ELB.

    CLI example:

    .. code-block:: bash

        salt myminion boto_elb.apply_security_groups myelb '["mysecgroup1"]'
    RRRRu!Applied security_groups on ELB %su.Failed to appply security_groups on ELB %s: %sN(RRXRRYR
RRZR[tapply_security_groups_to_lbRR]RR!R"R#R R(RDR(R%R:RRRRR&R*((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pytapply_security_groupses!
	
c	C@s�td|d|d|d|�}t|tj�rKtjjj|�}ny(|j||�t	j
d|�tSWn-tj
jk
r�}t	jd||�tSXdS(u�
    Enable availability zones for ELB.

    CLI example:

    .. code-block:: bash

        salt myminion boto_elb.enable_availability_zones myelb '["us-east-1a"]'
    RRRRu$Enabled availability_zones on ELB %su1Failed to enable availability_zones on ELB %s: %sN(RRXRRYR
RRZR[tenable_availability_zonesRR]RR!R"R#R(R(R%R-RRRRR&R(((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pyRks!c	C@s�td|d|d|d|�}t|tj�rKtjjj|�}ny(|j||�t	j
d|�tSWn6tj
jk
r�}t	jd||dtj�tSXdS(	u�
    Disable availability zones for ELB.

    CLI example:

    .. code-block:: bash

        salt myminion boto_elb.disable_availability_zones myelb '["us-east-1a"]'
    RRRRu%Disabled availability_zones on ELB %su2Failed to disable availability_zones on ELB %s: %sRWN(RRXRRYR
RRZR[tdisable_availability_zonesRR]RR!R"R#R(R^R_R(R%R-RRRRR&R(((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pyRl�s!	c	C@s�td|d|d|d|�}t|tj�rKtjjj|�}ny(|j||�t	j
d|�tSWn6tj
jk
r�}t	jd||dtj�tSXdS(	u�
    Attach ELB to subnets.

    CLI example:

    .. code-block:: bash

        salt myminion boto_elb.attach_subnets myelb '["mysubnet"]'
    RRRRuAttached ELB %s on subnets.u&Failed to attach ELB %s on subnets: %sRWN(RRXRRYR
RRZR[tattach_lb_to_subnetsRR]RR!R"R#R(R^R_R(R%R9RRRRR&R(((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pytattach_subnets�s!
c	C@s�td|d|d|d|�}t|tj�rKtjjj|�}ny(|j||�t	j
d|�tSWn6tj
jk
r�}t	jd||dtj�tSXdS(	u�
    Detach ELB from subnets.

    CLI example:

    .. code-block:: bash

        salt myminion boto_elb.detach_subnets myelb '["mysubnet"]'
    RRRRuDetached ELB %s from subnets.u(Failed to detach ELB %s from subnets: %sRWN(RRXRRYR
RRZR[tdetach_lb_from_subnetsRR]RR!R"R#R(R^R_R(R%R9RRRRR&R(((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pytdetach_subnets�s!
c	C@s�td|d|d|d|�}d}x�|r�y|j|�}tj�}tj�|d<tj�|d<tj�|d<tj�|d	<|j}	|j}
|j}|j}|	j|dd
<|	j	|dd<|	j
|dd<|	j|dd
<|
j|dd
<|j|dd
<|j|dd<|j
|d	d<|SWq*tjjk
r�}
|
jdkr�tjd�tjd�|d8}q*ntjd||
j�iSXq*WiS(u�
    Check to see if attributes are set on an ELB.

    CLI example:

    .. code-block:: bash

        salt myminion boto_elb.get_attributes myelb
    RRRRiu
access_logucross_zone_load_balancinguconnection_draininguconnecting_settingsuenabledus3_bucket_nameus3_bucket_prefixu
emit_intervalutimeoutuidle_timeoutu
Throttlingu0Throttled by AWS API, will retry in 5 seconds...iiuELB %s does not exist: %s(Rtget_all_lb_attributestodicttOrderedDictt
access_logtcross_zone_load_balancingtconnection_drainingtconnecting_settingstenabledts3_bucket_namets3_bucket_prefixt
emit_intervalttimeouttidle_timeoutR!R"R#RARR RBRCR(RD(R%RRRRR&REtlbattrsRGtaltczlbtcdtcsR*((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pytget_attributes�s@
!					


	c	C@s�td|d|d|d|�}|jdi�}|jdi�}|jdi�}	|jdi�}
|r�|r�|	r�|
r�tjd	�tS|r^t�}|jd
t�|_|js�d}tj|�tS|jdd�|_|jd
d�|_	|jdd�|_
|j|d|�}
|
rGtjd|�q^tjd|�tSn|r�t
�}|d
|_|j|d|j�}
|
r�tjd|�q�tjd�tSn|	r2t�}|	d
|_|	jdd�|_|j|d|�}
|
rtjd|�q2tjd�tSn|
r�t�}|
jdd�|_|j|d|�}
|
r�tjd|�q�tjd�tSntS( u
    Set attributes on an ELB.

    name (string)
        Name of the ELB instance to set attributes for

    attributes
        A dict of attributes to set.

        Valid attributes are:

        access_log (dict)
            enabled (bool)
                Enable storage of access logs.
            s3_bucket_name (string)
                The name of the S3 bucket to place logs.
            s3_bucket_prefix (string)
                Prefix for the log file name.
            emit_interval (int)
                Interval for storing logs in S3 in minutes. Valid values are
                5 and 60.

        connection_draining (dict)
            enabled (bool)
                Enable connection draining.
            timeout (int)
                Maximum allowed time in seconds for sending existing
                connections to an instance that is deregistering or unhealthy.
                Default is 300.

        cross_zone_load_balancing (dict)
            enabled (bool)
                Enable cross-zone load balancing.

    CLI example to set attributes on an ELB:

    .. code-block:: bash

        salt myminion boto_elb.set_attributes myelb '{"access_log": {"enabled": "true", "s3_bucket_name": "mybucket", "s3_bucket_prefix": "mylogs/", "emit_interval": "5"}}' region=us-east-1
    RRRRu
access_logucross_zone_load_balancinguconnection_draininguconnecting_settingsu No supported attributes for ELB.uenabledu;Access log attribute configured, but enabled config missingus3_bucket_nameus3_bucket_prefixu
emit_intervalu	accessLogu%Added access_log attribute to %s elb.u-Failed to add access_log attribute to %s elb.ucrossZoneLoadBalancingu4Added cross_zone_load_balancing attribute to %s elb.u2Failed to add cross_zone_load_balancing attribute.utimeouti,uconnectionDrainingu.Added connection_draining attribute to %s elb.u,Failed to add connection_draining attribute.uidle_timeouti<uconnectingSettingsu.Added connecting_settings attribute to %s elb.u,Failed to add connecting_settings attribute.N(RtgetRR(RRRxtNoneRyRzR{tmodify_lb_attributeR]RRR|RR}R(R%t
attributesRRRRR&RR�R�R�t_altmsgt
added_attrt_czlbt_cdt_cs((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pytset_attributessd*!
		
	

	

	
c	C@s*td|d|d|d|�}d}x�tr%y}|jd|g�}|d}tj�}|j}	|	j|d<|	j|d	<|	j|d
<|	j	|d<|	j
|d<|SWq*tjj
k
r!}
|r|
jd
krtjd�tjd�|d8}q*ntjd|dtj�iSXq*WdS(u�
    Get the health check configured for this ELB.

    CLI example:

    .. code-block:: bash

        salt myminion boto_elb.get_health_check myelb
    RRRRiRiuintervalutargetuhealthy_thresholdutimeoutuunhealthy_thresholdu
Throttlingu.Throttled by AWS API, will retry in 5 seconds.iiuELB %s not found.texc_info_on_logleveN(RRRRrRsthealth_checktintervalttargetthealthy_thresholdR|tunhealthy_thresholdR!R"R#tcodeRR RBRCR(R^R_(R%RRRRR&RERFRGthcR*((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pytget_health_checkrs.
!	
	








c
	C@s�td|d|d|d|�}d}t|�}x�tr�y(|j||�tjd|�tSWq6tjjk
r�}	|r�t	j
dkr�tjd�tj
d	�|d
8}q6ntjd|�tSXq6WdS(
u�
    Set attributes on an ELB.

    CLI example to set attributes on an ELB:

    .. code-block:: bash

        salt myminion boto_elb.set_health_check myelb '{"target": "HTTP:80/"}'
    RRRRiu!Configured health check on ELB %su
Throttlingu.Throttled by AWS API, will retry in 5 seconds.iiu*Failed to configure health check on ELB %sN(RRRtconfigure_health_checkRR]R!R"R#R*R�R RBRCR(
R%R�RRRRR&RER�R(((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pytset_health_check�s !	


c

C@s�t|tj�s$t|tj�r0|g}ntd|d|d|d|�}y|j||�}Wn'tjjk
r�}t	j
|�tSXg|D]}	|	j^q�}
t
|�jt
|
��}|r�t	j
dt|�|�t}nt}|S(u�
    Register instances with an ELB.  Instances is either a string
    instance id or a list of string instance id's.

    Returns:

    - ``True``: instance(s) registered successfully
    - ``False``: instance(s) failed to be registered

    CLI example:

    .. code-block:: bash

        salt myminion boto_elb.register_instances myelb instance_id
        salt myminion boto_elb.register_instances myelb "[instance_id,instance_id]"
    RRRRu+Instance(s): %s not registered with ELB %s.(RXRRYt	text_typeRtregister_instancesR!R"R#RR$Rtidtsett
differencetlistR(
R%t	instancesRRRRR&tregistered_instancesR(tinstancetregistered_instance_idstregister_failurestregister_result((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pyR��s"$!
		c

C@s#t|tj�s$t|tj�r0|g}ntd|d|d|d|�}y|j||�}WnPtjjk
r�}|j	dkr�t
jd||�dSt
j|�t
SnXg|D]}	|	j^q�}
t|�jt|
��}|rt
jdt|�|�t
}nt}|S(	u
    Deregister instances with an ELB.  Instances is either a string
    instance id or a list of string instance id's.

    Returns:

    - ``True``: instance(s) deregistered successfully
    - ``False``: instance(s) failed to be deregistered
    - ``None``: instance(s) not valid or not registered, no action taken

    CLI example:

    .. code-block:: bash

        salt myminion boto_elb.deregister_instances myelb instance_id
        salt myminion boto_elb.deregister_instances myelb "[instance_id, instance_id]"
    RRRRuInvalidInstanceuYOne or more of instance(s) %s are not part of ELB %s. deregister_instances not performed.u-Instance(s): %s not deregistered from ELB %s.N(RXRRYR�Rtderegister_instancesR!R"R#RARR$R�RR�R�tintersectionR�R(
R%R�RRRRR&R�R(R�R�tderegister_failurestderegister_result((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pyR��s.$!

	c
C@s�t}tgt|||||�D]}|d^q"�}	t|�}
|
|	}|	|
}|rqt|pm|�St|�r�t|t|�||||�tkr�t}q�nt|�r�t|t|�||||�tkr�t}q�n|S(u�
    Set the instances assigned to an ELB to exactly the list given

    CLI example:

    .. code-block:: bash

        salt myminion boto_elb.set_instances myelb region=us-east-1 instances="[instance_id,instance_id]"
    uinstance_id(	RR�tget_instance_healthtbooltlenR�R�RR�(
R%R�ttestRRRRRGtitcurrenttdesiredtaddtremove((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pyt
set_instancess5

''c	C@s�td|d|d|d|�}yf|j||�}g}xC|D];}	|ji|	jd6|	jd6|	jd6|	jd6�qCW|SWn'tjj	k
r�}
t
j|
�gSXd	S(
u
    Get a list of instances and their health state

    CLI example:

    .. code-block:: bash

        salt myminion boto_elb.get_instance_health myelb
        salt myminion boto_elb.get_instance_health myelb region=us-east-1 instances="[instance_id,instance_id]"
    RRRRuinstance_idudescriptionustateureason_codeN(Rtdescribe_instance_healthR5tinstance_idtdescriptiontstatetreason_codeR!R"R#RR (R%RRRRR�R&tinstance_statesRGt	_instanceR(((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pyR�3s!



c	C@s�td|d|d|d|�}t|||||�s=tSyP|j||||�}	|	rutjd||�tStjd||�tSWn<tj	j
k
r�}
tjd|||
jdtj
�tSXd	S(
u�
    Create an ELB policy.

    .. versionadded:: 2016.3.0

    CLI example:

    .. code-block:: bash

        salt myminion boto_elb.create_policy myelb mypolicy LBCookieStickinessPolicyType '{"CookieExpirationPeriod": 3600}'
    RRRRuCreated policy %s on ELB %su$Failed to create policy %s on ELB %su(Failed to create policy %s on ELB %s: %sRWN(RR)Rtcreate_lb_policyRR]RR(R!R"R#RDR^R_(R%R8tpolicy_typetpolicyRRRRR&tsuccessR*((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pyt
create_policyOs
!	
c	C@s�td|d|d|d|�}t|||||�s=tSy+|j||�tjd||�tSWn<tjjk
r�}tj	d|||j
dtj�t
SXdS(	u�
    Delete an ELB policy.

    .. versionadded:: 2016.3.0

    CLI example:

    .. code-block:: bash

        salt myminion boto_elb.delete_policy myelb mypolicy
    RRRRuDeleted policy %s on ELB %su(Failed to delete policy %s on ELB %s: %sRWN(RR)Rtdelete_lb_policyRR]R!R"R#R(RDR^R_R(R%R8RRRRR&R*((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pyt
delete_policyos
!	
c		C@s�td|d|d|d|�}t|||||�s=tS|dkrRg}ny-|j|||�tjd|||�Wn?tjj	k
r�}tjd||||j
dtj�t
SXtS(	u�
    Set the policies of an ELB listener.

    .. versionadded:: 2016.3.0

    CLI example:

    .. code-block:: Bash

        salt myminion boto_elb.set_listener_policy myelb 443 "[policy1,policy2]"
    RRRRu%Set policies %s on ELB %s listener %su1Failed to set policy %s on ELB %s listener %s: %sRWN(RR)RR�tset_lb_policies_of_listenerRR]R!R"R#RDR^R_R(	R%tportR7RRRRR&R*((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pytset_listener_policy�s
!		
c		C@s�td|d|d|d|�}t|||||�s=tS|dkrRg}ny-|j|||�tjd|||�Wn?tjj	k
r�}tjd||||j
dtj�t
SXtS(	u�
    Set the policies of an ELB backend server.

    CLI example:

        salt myminion boto_elb.set_backend_policy myelb 443 "[policy1,policy2]"
    RRRRu+Set policies %s on ELB %s backend server %su7Failed to set policy %s on ELB %s backend server %s: %sRWN(RR)RR�t!set_lb_policies_of_backend_serverRR]R!R"R#RDR^R_R(	R%R�R7RRRRR&R*((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pytset_backend_policy�s	!			
c	C@sWt|||||�rOtd|d|d|d|�}t|||�}|StSdS(u
    Add the tags on an ELB

    .. versionadded:: 2016.3.0

    name
        name of the ELB

    tags
        dict of name/value pair tags

    CLI Example:

    .. code-block:: bash

        salt myminion boto_elb.set_tags my-elb-name "{'Tag1': 'Value', 'Tag2': 'Another Value'}"
    RRRRN(R)Rt	_add_tagsR(R%ttagsRRRRR&RG((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pytset_tags�s
!c	C@sWt|||||�rOtd|d|d|d|�}t|||�}|StSdS(u�
    Add the tags on an ELB

    name
        name of the ELB

    tags
        list of tags to remove

    CLI Example:

    .. code-block:: bash

        salt myminion boto_elb.delete_tags my-elb-name ['TagToRemove1', 'TagToRemove2']
    RRRRN(R)Rt_remove_tagsR(R%R�RRRRR&RG((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pytdelete_tags�s
!cC@svt|j��}d}xW|D]O}||}||dj|�<|dk	rd||dj|�<n|d7}qWdS(u?
    helper function to build a tag parameter list to send
    iuTags.member.{0}.KeyuTags.member.{0}.ValueN(tsortedtkeystformatR�(tparamsR�R�R�Rtvalue((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pyt_build_tag_param_list�s

cC@s^i}|r"|j||d�n|jd|td�dd�}||rV||SdSdS(u
    Retrieve all the metadata tags associated with your ELB(s).

    :type load_balancer_names: list
    :param load_balancer_names: An optional list of load balancer names.

    :rtype: list
    :return: A list of :class:`boto.ec2.elb.tag.Tag` objects
    uLoadBalancerNames.member.%duDescribeTagsu!boto_elb_tag.get_tag_descriptionstverbuPOSTN(tbuild_list_paramst
get_objectRR�(R&RR�R�((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pyR=s


	
cC@s<i}|j||d�t||�|jd|dd�S(u�
    Create new metadata tags for the specified resource ids.

    :type load_balancer_names: list
    :param load_balancer_names: A list of load balancer names.

    :type tags: dict
    :param tags: A dictionary containing the name/value pairs.
                 If you want to create only a tag name, the
                 value for that tag should be the empty string
                 (e.g. '').
    uLoadBalancerNames.member.%duAddTagsR�uPOST(R�R�t
get_status(R&RR�R�((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pyR� s


cC@sBi}|j||d�|j||d�|jd|dd�S(u
    Delete metadata tags for the specified resource ids.

    :type load_balancer_names: list
    :param load_balancer_names: A list of load balancer names.

    :type tags: list
    :param tags: A list containing just tag names for the tags to be
                 deleted.
    uLoadBalancerNames.member.%duTags.member.%d.Keyu
RemoveTagsR�uPOST(R�R�(R&RR�R�((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pyR�4s(Ct__doc__t
__future__RRRR^RBt	getLoggerRRtsalt.utils.jsonR
tsalt.utils.odictRRrtsalt.utils.versionstsalt.extRR!tboto.ec2tboto.ec2.elbRtboto.ec2.elb.attributesRRRRtsetLeveltCRITICALRtHAS_BOTOtImportErrorRRR�R)R+R,RORTRaRcReRhRjRkRlRnRpR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R=R�R�(((s9/usr/lib/python2.7/site-packages/salt/modules/boto_elb.pyt<module>+s�


	A		(				-	b$		*	8					

Zerion Mini Shell 1.0