Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: third_party/boto/boto/ec2/elb/__init__.py

Issue 698893003: Update checked in version of gsutil to version 4.6 (Closed) Base URL: http://dart.googlecode.com/svn/third_party/gsutil/
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/boto/boto/ec2/ec2object.py ('k') | third_party/boto/boto/ec2/elb/attributes.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/boto/boto/ec2/elb/__init__.py
===================================================================
--- third_party/boto/boto/ec2/elb/__init__.py (revision 33376)
+++ third_party/boto/boto/ec2/elb/__init__.py (working copy)
@@ -31,21 +31,10 @@
from boto.ec2.elb.instancestate import InstanceState
from boto.ec2.elb.healthcheck import HealthCheck
from boto.ec2.elb.listelement import ListElement
-from boto.regioninfo import RegionInfo
+from boto.regioninfo import RegionInfo, get_regions, load_regions
import boto
-RegionData = {
- 'us-east-1': 'elasticloadbalancing.us-east-1.amazonaws.com',
- 'us-gov-west-1': 'elasticloadbalancing.us-gov-west-1.amazonaws.com',
- 'us-west-1': 'elasticloadbalancing.us-west-1.amazonaws.com',
- 'us-west-2': 'elasticloadbalancing.us-west-2.amazonaws.com',
- 'sa-east-1': 'elasticloadbalancing.sa-east-1.amazonaws.com',
- 'eu-west-1': 'elasticloadbalancing.eu-west-1.amazonaws.com',
- 'ap-northeast-1': 'elasticloadbalancing.ap-northeast-1.amazonaws.com',
- 'ap-southeast-1': 'elasticloadbalancing.ap-southeast-1.amazonaws.com',
- 'ap-southeast-2': 'elasticloadbalancing.ap-southeast-2.amazonaws.com',
- 'cn-north-1': 'elasticloadbalancing.cn-north-1.amazonaws.com.cn',
-}
+RegionData = load_regions().get('elasticloadbalancing', {})
def regions():
@@ -55,13 +44,7 @@
:rtype: list
:return: A list of :class:`boto.RegionInfo` instances
"""
- regions = []
- for region_name in RegionData:
- region = RegionInfo(name=region_name,
- endpoint=RegionData[region_name],
- connection_cls=ELBConnection)
- regions.append(region)
- return regions
+ return get_regions('elasticloadbalancing', connection_cls=ELBConnection)
def connect_to_region(region_name, **kw_params):
@@ -92,7 +75,7 @@
is_secure=True, port=None, proxy=None, proxy_port=None,
proxy_user=None, proxy_pass=None, debug=0,
https_connection_factory=None, region=None, path='/',
- security_token=None, validate_certs=True):
+ security_token=None, validate_certs=True, profile_name=None):
"""
Init method to create a new connection to EC2 Load Balancing Service.
@@ -110,7 +93,8 @@
self.region.endpoint, debug,
https_connection_factory, path,
security_token,
- validate_certs=validate_certs)
+ validate_certs=validate_certs,
+ profile_name=profile_name)
def _required_auth_capability(self):
return ['ec2']
@@ -401,6 +385,8 @@
:param attribute: The attribute you wish to change.
* crossZoneLoadBalancing - Boolean (true)
+ * accessLog - :py:class:`AccessLogAttribute` instance
+ * connectionDraining - :py:class:`ConnectionDrainingAttribute` instance
:type value: string
:param value: The new value for the attribute
@@ -421,6 +407,20 @@
if attribute.lower() == 'crosszoneloadbalancing':
params['LoadBalancerAttributes.CrossZoneLoadBalancing.Enabled'
] = value
+ elif attribute.lower() == 'accesslog':
+ params['LoadBalancerAttributes.AccessLog.Enabled'] = \
+ value.enabled and 'true' or 'false'
+ params['LoadBalancerAttributes.AccessLog.S3BucketName'] = \
+ value.s3_bucket_name
+ params['LoadBalancerAttributes.AccessLog.S3BucketPrefix'] = \
+ value.s3_bucket_prefix
+ params['LoadBalancerAttributes.AccessLog.EmitInterval'] = \
+ value.emit_interval
+ elif attribute.lower() == 'connectiondraining':
+ params['LoadBalancerAttributes.ConnectionDraining.Enabled'] = \
+ value.enabled and 'true' or 'false'
+ params['LoadBalancerAttributes.ConnectionDraining.Timeout'] = \
+ value.timeout
else:
raise ValueError('InvalidAttribute', attribute)
return self.get_status('ModifyLoadBalancerAttributes', params,
@@ -451,14 +451,20 @@
:type attribute: string
:param attribute: The attribute you wish to see.
+ * accessLog - :py:class:`AccessLogAttribute` instance
* crossZoneLoadBalancing - Boolean
+ * connectionDraining - :py:class:`ConnectionDrainingAttribute` instance
:rtype: Attribute dependent
:return: The new value for the attribute
"""
attributes = self.get_all_lb_attributes(load_balancer_name)
+ if attribute.lower() == 'accesslog':
+ return attributes.access_log
if attribute.lower() == 'crosszoneloadbalancing':
return attributes.cross_zone_load_balancing.enabled
+ if attribute.lower() == 'connectiondraining':
+ return attributes.connection_draining
return None
def register_instances(self, load_balancer_name, instances):
@@ -609,7 +615,7 @@
def create_lb_policy(self, lb_name, policy_name, policy_type, policy_attributes):
"""
- Creates a new policy that contais the necessary attributes depending on
+ Creates a new policy that contains the necessary attributes depending on
the policy type. Policies are settings that are saved for your load
balancer and that can be applied to the front-end listener, or
the back-end application server.
@@ -641,7 +647,10 @@
"""
params = {'LoadBalancerName': lb_name,
'LoadBalancerPort': lb_port}
- self.build_list_params(params, policies, 'PolicyNames.member.%d')
+ if len(policies):
+ self.build_list_params(params, policies, 'PolicyNames.member.%d')
+ else:
+ params['PolicyNames'] = ''
return self.get_status('SetLoadBalancerPoliciesOfListener', params)
def set_lb_policies_of_backend_server(self, lb_name, instance_port, policies):
« no previous file with comments | « third_party/boto/boto/ec2/ec2object.py ('k') | third_party/boto/boto/ec2/elb/attributes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698