| OLD | NEW |
| 1 # Copyright (c) 2010 Spotify AB | 1 # Copyright (c) 2010 Spotify AB |
| 2 # Copyright (c) 2012 Mitch Garnaat http://garnaat.org/ | 2 # Copyright (c) 2012 Mitch Garnaat http://garnaat.org/ |
| 3 # Copyright (c) 2012 Amazon.com, Inc. or its affiliates. | 3 # Copyright (c) 2012 Amazon.com, Inc. or its affiliates. |
| 4 # All Rights Reserved | 4 # All Rights Reserved |
| 5 # | 5 # |
| 6 # Permission is hereby granted, free of charge, to any person obtaining a | 6 # Permission is hereby granted, free of charge, to any person obtaining a |
| 7 # copy of this software and associated documentation files (the | 7 # copy of this software and associated documentation files (the |
| 8 # "Software"), to deal in the Software without restriction, including | 8 # "Software"), to deal in the Software without restriction, including |
| 9 # without limitation the rights to use, copy, modify, merge, publish, dis- | 9 # without limitation the rights to use, copy, modify, merge, publish, dis- |
| 10 # tribute, sublicense, and/or sell copies of the Software, and to permit | 10 # tribute, sublicense, and/or sell copies of the Software, and to permit |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | 22 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 23 # IN THE SOFTWARE. | 23 # IN THE SOFTWARE. |
| 24 | 24 |
| 25 """ | 25 """ |
| 26 This module provies an interface to the Elastic MapReduce (EMR) | 26 This module provies an interface to the Elastic MapReduce (EMR) |
| 27 service from AWS. | 27 service from AWS. |
| 28 """ | 28 """ |
| 29 from connection import EmrConnection | 29 from connection import EmrConnection |
| 30 from step import Step, StreamingStep, JarStep | 30 from step import Step, StreamingStep, JarStep |
| 31 from bootstrap_action import BootstrapAction | 31 from bootstrap_action import BootstrapAction |
| 32 from boto.regioninfo import RegionInfo | 32 from boto.regioninfo import RegionInfo, get_regions |
| 33 | 33 |
| 34 | 34 |
| 35 def regions(): | 35 def regions(): |
| 36 """ | 36 """ |
| 37 Get all available regions for the Amazon Elastic MapReduce service. | 37 Get all available regions for the Amazon Elastic MapReduce service. |
| 38 | 38 |
| 39 :rtype: list | 39 :rtype: list |
| 40 :return: A list of :class:`boto.regioninfo.RegionInfo` | 40 :return: A list of :class:`boto.regioninfo.RegionInfo` |
| 41 """ | 41 """ |
| 42 return [RegionInfo(name='us-east-1', | 42 return get_regions('elasticmapreduce', connection_cls=EmrConnection) |
| 43 endpoint='elasticmapreduce.us-east-1.amazonaws.com', | |
| 44 connection_cls=EmrConnection), | |
| 45 RegionInfo(name='us-west-1', | |
| 46 endpoint='us-west-1.elasticmapreduce.amazonaws.com', | |
| 47 connection_cls=EmrConnection), | |
| 48 RegionInfo(name='us-west-2', | |
| 49 endpoint='us-west-2.elasticmapreduce.amazonaws.com', | |
| 50 connection_cls=EmrConnection), | |
| 51 RegionInfo(name='ap-northeast-1', | |
| 52 endpoint='ap-northeast-1.elasticmapreduce.amazonaws.com', | |
| 53 connection_cls=EmrConnection), | |
| 54 RegionInfo(name='ap-southeast-1', | |
| 55 endpoint='ap-southeast-1.elasticmapreduce.amazonaws.com', | |
| 56 connection_cls=EmrConnection), | |
| 57 RegionInfo(name='ap-southeast-2', | |
| 58 endpoint='ap-southeast-2.elasticmapreduce.amazonaws.com', | |
| 59 connection_cls=EmrConnection), | |
| 60 RegionInfo(name='eu-west-1', | |
| 61 endpoint='eu-west-1.elasticmapreduce.amazonaws.com', | |
| 62 connection_cls=EmrConnection), | |
| 63 RegionInfo(name='sa-east-1', | |
| 64 endpoint='sa-east-1.elasticmapreduce.amazonaws.com', | |
| 65 connection_cls=EmrConnection), | |
| 66 RegionInfo(name='cn-north-1', | |
| 67 endpoint='elasticmapreduce.cn-north-1.amazonaws.com.cn', | |
| 68 connection_cls=EmrConnection), | |
| 69 ] | |
| 70 | 43 |
| 71 | 44 |
| 72 def connect_to_region(region_name, **kw_params): | 45 def connect_to_region(region_name, **kw_params): |
| 73 for region in regions(): | 46 for region in regions(): |
| 74 if region.name == region_name: | 47 if region.name == region_name: |
| 75 return region.connect(**kw_params) | 48 return region.connect(**kw_params) |
| 76 return None | 49 return None |
| OLD | NEW |