| OLD | NEW |
| 1 # Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ | 1 # Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ |
| 2 # | 2 # |
| 3 # Permission is hereby granted, free of charge, to any person obtaining a | 3 # Permission is hereby granted, free of charge, to any person obtaining a |
| 4 # copy of this software and associated documentation files (the | 4 # copy of this software and associated documentation files (the |
| 5 # "Software"), to deal in the Software without restriction, including | 5 # "Software"), to deal in the Software without restriction, including |
| 6 # without limitation the rights to use, copy, modify, merge, publish, dis- | 6 # without limitation the rights to use, copy, modify, merge, publish, dis- |
| 7 # tribute, sublicense, and/or sell copies of the Software, and to permit | 7 # tribute, sublicense, and/or sell copies of the Software, and to permit |
| 8 # persons to whom the Software is furnished to do so, subject to the fol- | 8 # persons to whom the Software is furnished to do so, subject to the fol- |
| 9 # lowing conditions: | 9 # lowing conditions: |
| 10 # | 10 # |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 :rtype: list | 29 :rtype: list |
| 30 :return: A list of :class:`boto.sdb.regioninfo.RegionInfo` instances | 30 :return: A list of :class:`boto.sdb.regioninfo.RegionInfo` instances |
| 31 """ | 31 """ |
| 32 return [SDBRegionInfo(name='us-east-1', | 32 return [SDBRegionInfo(name='us-east-1', |
| 33 endpoint='sdb.amazonaws.com'), | 33 endpoint='sdb.amazonaws.com'), |
| 34 SDBRegionInfo(name='eu-west-1', | 34 SDBRegionInfo(name='eu-west-1', |
| 35 endpoint='sdb.eu-west-1.amazonaws.com'), | 35 endpoint='sdb.eu-west-1.amazonaws.com'), |
| 36 SDBRegionInfo(name='us-west-1', | 36 SDBRegionInfo(name='us-west-1', |
| 37 endpoint='sdb.us-west-1.amazonaws.com'), | 37 endpoint='sdb.us-west-1.amazonaws.com'), |
| 38 SDBRegionInfo(name='ap-northeast-1', |
| 39 endpoint='sdb.ap-northeast-1.amazonaws.com'), |
| 38 SDBRegionInfo(name='ap-southeast-1', | 40 SDBRegionInfo(name='ap-southeast-1', |
| 39 endpoint='sdb.ap-southeast-1.amazonaws.com') | 41 endpoint='sdb.ap-southeast-1.amazonaws.com') |
| 40 ] | 42 ] |
| 41 | 43 |
| 42 def connect_to_region(region_name): | 44 def connect_to_region(region_name, **kw_params): |
| 43 """ | 45 """ |
| 44 Given a valid region name, return a | 46 Given a valid region name, return a |
| 45 :class:`boto.sdb.connection.SDBConnection`. | 47 :class:`boto.sdb.connection.SDBConnection`. |
| 46 | 48 |
| 47 :param str region_name: The name of the region to connect to. | 49 :type: str |
| 50 :param region_name: The name of the region to connect to. |
| 48 | 51 |
| 49 :rtype: :class:`boto.sdb.connection.SDBConnection` or ``None`` | 52 :rtype: :class:`boto.sdb.connection.SDBConnection` or ``None`` |
| 50 :return: A connection to the given region, or None if an invalid region | 53 :return: A connection to the given region, or None if an invalid region |
| 51 name is given | 54 name is given |
| 52 """ | 55 """ |
| 53 for region in regions(): | 56 for region in regions(): |
| 54 if region.name == region_name: | 57 if region.name == region_name: |
| 55 return region.connect() | 58 return region.connect(**kw_params) |
| 56 return None | 59 return None |
| 60 |
| 61 def get_region(region_name, **kw_params): |
| 62 """ |
| 63 Find and return a :class:`boto.sdb.regioninfo.RegionInfo` object |
| 64 given a region name. |
| 65 |
| 66 :type: str |
| 67 :param: The name of the region. |
| 68 |
| 69 :rtype: :class:`boto.sdb.regioninfo.RegionInfo` |
| 70 :return: The RegionInfo object for the given region or None if |
| 71 an invalid region name is provided. |
| 72 """ |
| 73 for region in regions(**kw_params): |
| 74 if region.name == region_name: |
| 75 return region |
| 76 return None |
| OLD | NEW |