Index: boto/rds/__init__.py |
diff --git a/boto/rds/__init__.py b/boto/rds/__init__.py |
index 940815d0668a7e33467ab4818e4a9c49934122bb..f271cf3438e0bd39fe31ed108fe69557a3514dbd 100644 |
--- a/boto/rds/__init__.py |
+++ b/boto/rds/__init__.py |
@@ -38,19 +38,34 @@ def regions(): |
:return: A list of :class:`boto.rds.regioninfo.RDSRegionInfo` |
""" |
return [RDSRegionInfo(name='us-east-1', |
- endpoint='rds.amazonaws.com'), |
+ endpoint='rds.us-east-1.amazonaws.com'), |
RDSRegionInfo(name='eu-west-1', |
- endpoint='eu-west-1.rds.amazonaws.com'), |
+ endpoint='rds.eu-west-1.amazonaws.com'), |
RDSRegionInfo(name='us-west-1', |
- endpoint='us-west-1.rds.amazonaws.com'), |
+ endpoint='rds.us-west-1.amazonaws.com'), |
+ RDSRegionInfo(name='ap-northeast-1', |
+ endpoint='rds.ap-northeast-1.amazonaws.com'), |
RDSRegionInfo(name='ap-southeast-1', |
- endpoint='ap-southeast-1.rds.amazonaws.com') |
+ endpoint='rds.ap-southeast-1.amazonaws.com') |
] |
-def connect_to_region(region_name): |
+def connect_to_region(region_name, **kw_params): |
+ """ |
+ Given a valid region name, return a |
+ :class:`boto.ec2.connection.EC2Connection`. |
+ Any additional parameters after the region_name are passed on to |
+ the connect method of the region object. |
+ |
+ :type: str |
+ :param region_name: The name of the region to connect to. |
+ |
+ :rtype: :class:`boto.ec2.connection.EC2Connection` or ``None`` |
+ :return: A connection to the given region, or None if an invalid region |
+ name is given |
+ """ |
for region in regions(): |
if region.name == region_name: |
- return region.connect() |
+ return region.connect(**kw_params) |
return None |
#boto.set_stream_logger('rds') |
@@ -59,7 +74,7 @@ class RDSConnection(AWSQueryConnection): |
DefaultRegionName = 'us-east-1' |
DefaultRegionEndpoint = 'rds.amazonaws.com' |
- APIVersion = '2009-10-16' |
+ APIVersion = '2011-04-01' |
def __init__(self, aws_access_key_id=None, aws_secret_access_key=None, |
is_secure=True, port=None, proxy=None, proxy_port=None, |
@@ -69,9 +84,11 @@ class RDSConnection(AWSQueryConnection): |
region = RDSRegionInfo(self, self.DefaultRegionName, |
self.DefaultRegionEndpoint) |
self.region = region |
- AWSQueryConnection.__init__(self, aws_access_key_id, aws_secret_access_key, |
- is_secure, port, proxy, proxy_port, proxy_user, |
- proxy_pass, self.region.endpoint, debug, |
+ AWSQueryConnection.__init__(self, aws_access_key_id, |
+ aws_secret_access_key, |
+ is_secure, port, proxy, proxy_port, |
+ proxy_user, proxy_pass, |
+ self.region.endpoint, debug, |
https_connection_factory, path) |
def _required_auth_capability(self): |
@@ -85,9 +102,10 @@ class RDSConnection(AWSQueryConnection): |
Retrieve all the DBInstances in your account. |
:type instance_id: str |
- :param instance_id: DB Instance identifier. If supplied, only information |
- this instance will be returned. Otherwise, info |
- about all DB Instances will be returned. |
+ :param instance_id: DB Instance identifier. If supplied, only |
+ information this instance will be returned. |
+ Otherwise, info about all DB Instances will |
+ be returned. |
:type max_records: int |
:param max_records: The maximum number of records to be returned. |
@@ -108,7 +126,8 @@ class RDSConnection(AWSQueryConnection): |
params['MaxRecords'] = max_records |
if marker: |
params['Marker'] = marker |
- return self.get_list('DescribeDBInstances', params, [('DBInstance', DBInstance)]) |
+ return self.get_list('DescribeDBInstances', params, |
+ [('DBInstance', DBInstance)]) |
def create_dbinstance(self, id, allocated_storage, instance_class, |
master_username, master_password, port=3306, |
@@ -134,9 +153,8 @@ class RDSConnection(AWSQueryConnection): |
Valid values are [5-1024] |
:type instance_class: str |
- :param instance_class: The compute and memory capacity of the DBInstance. |
- |
- Valid values are: |
+ :param instance_class: The compute and memory capacity of |
+ the DBInstance. Valid values are: |
* db.m1.small |
* db.m1.large |
@@ -235,7 +253,7 @@ class RDSConnection(AWSQueryConnection): |
params['AvailabilityZone'] = availability_zone |
if preferred_maintenance_window: |
params['PreferredMaintenanceWindow'] = preferred_maintenance_window |
- if backup_retention_period: |
+ if backup_retention_period is not None: |
params['BackupRetentionPeriod'] = backup_retention_period |
if preferred_backup_window: |
params['PreferredBackupWindow'] = preferred_backup_window |
@@ -406,7 +424,7 @@ class RDSConnection(AWSQueryConnection): |
params['AllocatedStorage'] = allocated_storage |
if instance_class: |
params['DBInstanceClass'] = instance_class |
- if backup_retention_period: |
+ if backup_retention_period is not None: |
params['BackupRetentionPeriod'] = backup_retention_period |
if preferred_backup_window: |
params['PreferredBackupWindow'] = preferred_backup_window |
@@ -428,9 +446,9 @@ class RDSConnection(AWSQueryConnection): |
:type skip_final_snapshot: bool |
:param skip_final_snapshot: This parameter determines whether a final |
db snapshot is created before the instance |
- is deleted. If True, no snapshot is created. |
- If False, a snapshot is created before |
- deleting the instance. |
+ is deleted. If True, no snapshot |
+ is created. If False, a snapshot |
+ is created before deleting the instance. |
:type final_snapshot_id: str |
:param final_snapshot_id: If a final snapshot is requested, this |
@@ -568,9 +586,11 @@ class RDSConnection(AWSQueryConnection): |
for i in range(0, len(parameters)): |
parameter = parameters[i] |
parameter.merge(params, i+1) |
- return self.get_list('ModifyDBParameterGroup', params, ParameterGroup) |
+ return self.get_list('ModifyDBParameterGroup', params, |
+ ParameterGroup, verb='POST') |
- def reset_parameter_group(self, name, reset_all_params=False, parameters=None): |
+ def reset_parameter_group(self, name, reset_all_params=False, |
+ parameters=None): |
""" |
Resets some or all of the parameters of a ParameterGroup to the |
default value |
@@ -579,8 +599,8 @@ class RDSConnection(AWSQueryConnection): |
:param key_name: The name of the ParameterGroup to reset |
:type parameters: list of :class:`boto.rds.parametergroup.Parameter` |
- :param parameters: The parameters to reset. If not supplied, all parameters |
- will be reset. |
+ :param parameters: The parameters to reset. If not supplied, |
+ all parameters will be reset. |
""" |
params = {'DBParameterGroupName':name} |
if reset_all_params: |
@@ -611,7 +631,8 @@ class RDSConnection(AWSQueryConnection): |
:type groupnames: list |
:param groupnames: A list of the names of security groups to retrieve. |
- If not provided, all security groups will be returned. |
+ If not provided, all security groups will |
+ be returned. |
:type max_records: int |
:param max_records: The maximum number of records to be returned. |
@@ -653,7 +674,8 @@ class RDSConnection(AWSQueryConnection): |
params = {'DBSecurityGroupName':name} |
if description: |
params['DBSecurityGroupDescription'] = description |
- group = self.get_object('CreateDBSecurityGroup', params, DBSecurityGroup) |
+ group = self.get_object('CreateDBSecurityGroup', params, |
+ DBSecurityGroup) |
group.name = name |
group.description = description |
return group |
@@ -681,12 +703,13 @@ class RDSConnection(AWSQueryConnection): |
the rule to. |
:type ec2_security_group_name: string |
- :param ec2_security_group_name: The name of the EC2 security group you are |
- granting access to. |
+ :param ec2_security_group_name: The name of the EC2 security group |
+ you are granting access to. |
:type ec2_security_group_owner_id: string |
- :param ec2_security_group_owner_id: The ID of the owner of the EC2 security |
- group you are granting access to. |
+ :param ec2_security_group_owner_id: The ID of the owner of the EC2 |
+ security group you are granting |
+ access to. |
:type cidr_ip: string |
:param cidr_ip: The CIDR block you are providing access to. |
@@ -702,7 +725,8 @@ class RDSConnection(AWSQueryConnection): |
params['EC2SecurityGroupOwnerId'] = ec2_security_group_owner_id |
if cidr_ip: |
params['CIDRIP'] = urllib.quote(cidr_ip) |
- return self.get_object('AuthorizeDBSecurityGroupIngress', params, DBSecurityGroup) |
+ return self.get_object('AuthorizeDBSecurityGroupIngress', params, |
+ DBSecurityGroup) |
def revoke_dbsecurity_group(self, group_name, ec2_security_group_name=None, |
ec2_security_group_owner_id=None, cidr_ip=None): |
@@ -716,12 +740,13 @@ class RDSConnection(AWSQueryConnection): |
the rule from. |
:type ec2_security_group_name: string |
- :param ec2_security_group_name: The name of the EC2 security group from which |
- you are removing access. |
+ :param ec2_security_group_name: The name of the EC2 security group |
+ from which you are removing access. |
:type ec2_security_group_owner_id: string |
- :param ec2_security_group_owner_id: The ID of the owner of the EC2 security |
- from which you are removing access. |
+ :param ec2_security_group_owner_id: The ID of the owner of the EC2 |
+ security from which you are |
+ removing access. |
:type cidr_ip: string |
:param cidr_ip: The CIDR block from which you are removing access. |
@@ -737,7 +762,8 @@ class RDSConnection(AWSQueryConnection): |
params['EC2SecurityGroupOwnerId'] = ec2_security_group_owner_id |
if cidr_ip: |
params['CIDRIP'] = cidr_ip |
- return self.get_object('RevokeDBSecurityGroupIngress', params, DBSecurityGroup) |
+ return self.get_object('RevokeDBSecurityGroupIngress', params, |
+ DBSecurityGroup) |
# For backwards compatibility. This method was improperly named |
# in previous versions. I have renamed it to match the others. |
@@ -827,8 +853,8 @@ class RDSConnection(AWSQueryConnection): |
which the snapshot is created. |
:type instance_class: str |
- :param instance_class: The compute and memory capacity of the DBInstance. |
- Valid values are: |
+ :param instance_class: The compute and memory capacity of the |
+ DBInstance. Valid values are: |
db.m1.small | db.m1.large | db.m1.xlarge | |
db.m2.2xlarge | db.m2.4xlarge |
@@ -879,8 +905,8 @@ class RDSConnection(AWSQueryConnection): |
used if use_latest is False. |
:type instance_class: str |
- :param instance_class: The compute and memory capacity of the DBInstance. |
- Valid values are: |
+ :param instance_class: The compute and memory capacity of the |
+ DBInstance. Valid values are: |
db.m1.small | db.m1.large | db.m1.xlarge | |
db.m2.2xlarge | db.m2.4xlarge |