OLD | NEW |
1 # Copyright (c) 2006-2008 Mitch Garnaat http://garnaat.org/ | 1 # Copyright (c) 2006-2008 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 21 matching lines...) Expand all Loading... |
32 object's constructor as keyword arguments and they will be | 32 object's constructor as keyword arguments and they will be |
33 passed along to the EC2Connection object. | 33 passed along to the EC2Connection object. |
34 | 34 |
35 :rtype: list | 35 :rtype: list |
36 :return: A list of :class:`boto.ec2.regioninfo.RegionInfo` | 36 :return: A list of :class:`boto.ec2.regioninfo.RegionInfo` |
37 """ | 37 """ |
38 c = EC2Connection(**kw_params) | 38 c = EC2Connection(**kw_params) |
39 return c.get_all_regions() | 39 return c.get_all_regions() |
40 | 40 |
41 def connect_to_region(region_name, **kw_params): | 41 def connect_to_region(region_name, **kw_params): |
| 42 """ |
| 43 Given a valid region name, return a |
| 44 :class:`boto.ec2.connection.EC2Connection`. |
| 45 Any additional parameters after the region_name are passed on to |
| 46 the connect method of the region object. |
| 47 |
| 48 :type: str |
| 49 :param region_name: The name of the region to connect to. |
| 50 |
| 51 :rtype: :class:`boto.ec2.connection.EC2Connection` or ``None`` |
| 52 :return: A connection to the given region, or None if an invalid region |
| 53 name is given |
| 54 """ |
42 for region in regions(**kw_params): | 55 for region in regions(**kw_params): |
43 if region.name == region_name: | 56 if region.name == region_name: |
44 return region.connect(**kw_params) | 57 return region.connect(**kw_params) |
45 return None | 58 return None |
46 | 59 |
47 def get_region(region_name, **kw_params): | 60 def get_region(region_name, **kw_params): |
| 61 """ |
| 62 Find and return a :class:`boto.ec2.regioninfo.RegionInfo` object |
| 63 given a region name. |
| 64 |
| 65 :type: str |
| 66 :param: The name of the region. |
| 67 |
| 68 :rtype: :class:`boto.ec2.regioninfo.RegionInfo` |
| 69 :return: The RegionInfo object for the given region or None if |
| 70 an invalid region name is provided. |
| 71 """ |
48 for region in regions(**kw_params): | 72 for region in regions(**kw_params): |
49 if region.name == region_name: | 73 if region.name == region_name: |
50 return region | 74 return region |
51 return None | 75 return None |
52 | 76 |
OLD | NEW |