FRTc@sddlmZddlmZddlmZddlmZmZddl m Z ddl m Z ddl mZddlmZd efd YZd efd YZd efdYZdS(i(t HealthCheck(tListener(t ListElement(tPoliciest OtherPolicy(t SecurityGroup(t InstanceInfo(t ResultSet(tsixtBackendcBs5eZdZddZdZdZdZRS(sBackend server descriptioncCs||_d|_d|_dS(N(t connectiontNonet instance_porttpolicies(tselfR ((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyt__init__$s  cCsd|j|jfS(NsBackend(%r:%r)(R R (R((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyt__repr__)scCs/|dkr+tdtfg|_|jSdS(Nt PolicyNamestmember(RRR (RtnametattrsR ((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyt startElement,s cCs"|dkrt||_ndS(Nt InstancePort(tintR (RRtvalueR ((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyt endElement1s N(t__name__t __module__t__doc__R RRRR(((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyR !s    tLoadBalancerZonescBs,eZdZddZdZdZRS(sj Used to collect the zones for a Load Balancer when enable_zones or disable_zones are called. cCs||_t|_dS(N(R Rtzones(RR ((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyR<s cCs|dkr|jSdS(NtAvailabilityZones(R(RRRR ((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyR@s cCsdS(N((RRRR ((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyRDsN(RRRR RRR(((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyR7s  t LoadBalancercBs+eZdZddddZdZdZdZdZdZ e dZ e dZ d Z d Zd Zd Zd ZdZddZdZdddZdZdZdZdZdZdZdZdZdZdZdZ dZ!RS( s* Represents an EC2 Load Balancer. cCs||_||_d|_d|_d|_d|_d|_d|_t |_ d|_ d|_ d|_ t |_t |_d|_d|_d|_d|_dS(s :ivar boto.ec2.elb.ELBConnection connection: The connection this load balancer was instance was instantiated from. :ivar list listeners: A list of tuples in the form of ``(, , )`` :ivar boto.ec2.elb.healthcheck.HealthCheck health_check: The health check policy for this load balancer. :ivar boto.ec2.elb.policies.Policies policies: Cookie stickiness and other policies. :ivar str name: The name of the Load Balancer. :ivar str dns_name: The external DNS name for the balancer. :ivar str created_time: A date+time string showing when the load balancer was created. :ivar list instances: A list of :py:class:`boto.ec2.instanceinfo.InstanceInfo` instances, representing the EC2 instances this load balancer is distributing requests to. :ivar list availability_zones: The availability zones this balancer covers. :ivar str canonical_hosted_zone_name: Current CNAME for the balancer. :ivar str canonical_hosted_zone_name_id: The Route 53 hosted zone ID of this balancer. Needed when creating an Alias record in a Route 53 hosted zone. :ivar boto.ec2.elb.securitygroup.SecurityGroup source_security_group: The security group that you can use as part of your inbound rules for your load balancer back-end instances to disallow traffic from sources other than your load balancer. :ivar list subnets: A list of subnets this balancer is on. :ivar list security_groups: A list of additional security groups that have been applied. :ivar str vpc_id: The ID of the VPC that this ELB resides within. :ivar list backends: A list of :py:class:`boto.ec2.elb.loadbalancer.Backend back-end server descriptions. N(R RR t listenerst health_checkR tdns_namet created_timet instancesRtavailability_zonestcanonical_hosted_zone_nametcanonical_hosted_zone_name_idtsource_security_grouptsubnetstsecurity_groupstvpc_idtschemetbackendst _attributes(RR Rt endpoints((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyRMs$"                 cCs d|jS(NsLoadBalancer:%s(R(R((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyRscCs4|dkr"t||_|jS|dkrMtdtfg|_|jS|dkr`|jS|dkrtdtfg|_|jS|dkrt||_ |j S|dkrt |_ |j S|dkr|j S|d kr|j S|d krn/|d kr,tdtfg|_|jSdSdS( NRtListenerDescriptionsRRt InstancesRtSourceSecurityGrouptSubnetstSecurityGroupstVPCIdtBackendServerDescriptions(RR"RRR!R&RR%RR RR)R*R+R R.R (RRRR ((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyRs6           cCs|dkr||_n|dkr0||_n|dkrH||_n|dkrg|jj|np|dkr||_nX|dkr||_n@|dkr||_n(|dkr||_nt |||dS( NtLoadBalancerNametDNSNamet CreatedTimet InstanceIdtCanonicalHostedZoneNametCanonicalHostedZoneNameIDR6tScheme( RR#R$R%tappendR'R(R,R-tsetattr(RRRR ((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyRs"               cCsCt|tjr|g}n|jj|j|}||_dS(s Enable availability zones to this Access Point. All zones must be in the same region as the Access Point. :type zones: string or List of strings :param zones: The name of the zone(s) to add. N(t isinstanceRt string_typesR tenable_availability_zonesRR&(RRt new_zones((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyt enable_zoness  cCsCt|tjr|g}n|jj|j|}||_dS(s Disable availability zones from this Access Point. :type zones: string or List of strings :param zones: The name of the zone(s) to add. N(RARRBR tdisable_availability_zonesRR&(RRRD((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyt disable_zoness   cCs2|j s|r+|jj|j|_n|jS(s Gets the LbAttributes. The Attributes will be cached. :type force: bool :param force: Ignore cache value and reload. :rtype: boto.ec2.elb.attributes.LbAttributes :return: The LbAttribues object (R/R tget_all_lb_attributesR(Rtforce((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pytget_attributess cCs|j|jjS(s Identifies if the ELB is current configured to do CrossZone Balancing. :type force: bool :param force: Ignore cache value and reload. :rtype: bool :return: True if balancing is enabled, False if not. (RJtcross_zone_load_balancingtenabled(RRI((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pytis_cross_zone_load_balancings cCs@|jj|jdt}|r<|jr<t|jj_n|S(s Turns on CrossZone Load Balancing for this ELB. :rtype: bool :return: True if successful, False if not. tcrossZoneLoadBalancing(R tmodify_lb_attributeRtTrueR/RKRL(Rtsuccess((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyt enable_cross_zone_load_balancings  cCs@|jj|jdt}|r<|jr<t|jj_n|S(s Turns off CrossZone Load Balancing for this ELB. :rtype: bool :return: True if successful, False if not. RN(R RORtFalseR/RKRL(RRQ((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyt!disable_cross_zone_load_balancings  cCsCt|tjr|g}n|jj|j|}||_dS(sS Adds instances to this load balancer. All instances must be in the same region as the load balancer. Adding endpoints that are already registered with the load balancer has no effect. :param list instances: List of instance IDs (strings) that you'd like to add to this load balancer. N(RARRBR tregister_instancesRR%(RR%t new_instances((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyRUs   cCsCt|tjr|g}n|jj|j|}||_dS(s Remove instances from this load balancer. Removing instances that are not registered with the load balancer has no effect. :param list instances: List of instance IDs (strings) that you'd like to remove from this load balancer. N(RARRBR tderegister_instancesRR%(RR%RV((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyRWs   cCs|jj|jS(s, Delete this load balancer. (R tdelete_load_balancerR(R((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pytdelete&scCs|jj|j|S(sf Configures the health check behavior for the instances behind this load balancer. See :ref:`elb-configuring-a-health-check` for a walkthrough. :param boto.ec2.elb.healthcheck.HealthCheck health_check: A HealthCheck instance that tells the load balancer how to check its instances for health. (R tconfigure_health_checkR(RR"((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyRZ,s cCs|jj|j|S(s Returns a list of :py:class:`boto.ec2.elb.instancestate.InstanceState` objects, which show the health of the instances attached to this load balancer. :rtype: list :returns: A list of :py:class:`InstanceState ` instances, representing the instances attached to this load balancer. (R tdescribe_instance_healthR(RR%((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pytget_instance_health8s cCs|jj|j|S(N(R tcreate_load_balancer_listenersR(RR!((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pytcreate_listenersFsttcpcCs.|dkr|}n|j|||fgS(N(R R^(RtinPorttoutPorttproto((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pytcreate_listenerJs  cCs|jj|j|S(N(R tdelete_load_balancer_listenersR(RR!((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pytdelete_listenersOscCs|j|gS(N(Re(RR`((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pytdelete_listenerSscCs|jj|j|S(s} Deletes a policy from the LoadBalancer. The specified policy must not be enabled for any listeners. (R tdelete_lb_policyR(Rt policy_name((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyt delete_policyVscCs|jj|j||S(N(R tset_lb_policies_of_listenerR(Rtlb_portR ((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pytset_policies_of_listener]scCs|jj|j||S(N(R t!set_lb_policies_of_backend_serverR(RR R ((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pytset_policies_of_backend_serverbs cCs|jj||j|S(N(R t"create_lb_cookie_stickiness_policyR(Rtcookie_expiration_periodRh((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pytcreate_cookie_stickiness_policyfs cCs|jj||j|S(N(R t#create_app_cookie_stickiness_policyR(RRRh((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyRrks cCs|jj|j||S(N(R tset_lb_listener_SSL_certificateR(RRktssl_certificate_id((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pytset_listener_SSL_certificateps cCs|jj|j|||S(N(R tcreate_lb_policyR(RRht policy_typetpolicy_attribute((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyRvts cCsCt|tjr|g}n|jj|j|}||_dS(s Attaches load balancer to one or more subnets. Attaching subnets that are already registered with the Load Balancer has no effect. :type subnets: string or List of strings :param subnets: The name of the subnet(s) to add. N(RARRBR tattach_lb_to_subnetsRR*(RR*t new_subnets((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pytattach_subnetsxs  cCsCt|tjr|g}n|jj|j|}||_dS(s Detaches load balancer from one or more subnets. :type subnets: string or List of strings :param subnets: The name of the subnet(s) to detach. N(RARRBR tdetach_lb_from_subnetsRR*(RR*Rz((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pytdetach_subnetss   cCsCt|tjr|g}n|jj|j|}||_dS(s/ Applies security groups to the load balancer. Applying security groups that are already registered with the Load Balancer has no effect. :type security_groups: string or List of strings :param security_groups: The name of the security group(s) to add. N(RARRBR tapply_security_groups_to_lbRR+(RR+tnew_sgs((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pytapply_security_groupss   N("RRRR RRRRRERGRSRJRMRRRTRURWRYRZR\R^RcReRfRiRlRnRqRrRuRvR{R}R(((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyR Hs<5                      N(tboto.ec2.elb.healthcheckRtboto.ec2.elb.listenerRtboto.ec2.elb.listelementRtboto.ec2.elb.policiesRRtboto.ec2.elb.securitygroupRtboto.ec2.instanceinfoRtboto.resultsetRt boto.compatRtobjectR RR (((sF/opt/freeware/lib/python2.7/site-packages/boto/ec2/elb/loadbalancer.pyts