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

Side by Side Diff: boto/sns/__init__.py

Issue 8386013: Merging in latest boto. (Closed) Base URL: svn://svn.chromium.org/boto
Patch Set: Redoing vendor drop by deleting and then merging. Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « boto/ses/connection.py ('k') | boto/sns/connection.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2010-2011 Mitch Garnaat http://garnaat.org/ 1 # Copyright (c) 2010-2011 Mitch Garnaat http://garnaat.org/
2 # Copyright (c) 2010-2011, Eucalyptus Systems, Inc. 2 # Copyright (c) 2010-2011, Eucalyptus Systems, Inc.
3 # 3 #
4 # Permission is hereby granted, free of charge, to any person obtaining a 4 # Permission is hereby granted, free of charge, to any person obtaining a
5 # copy of this software and associated documentation files (the 5 # copy of this software and associated documentation files (the
6 # "Software"), to deal in the Software without restriction, including 6 # "Software"), to deal in the Software without restriction, including
7 # without limitation the rights to use, copy, modify, merge, publish, dis- 7 # without limitation the rights to use, copy, modify, merge, publish, dis-
8 # tribute, sublicense, and/or sell copies of the Software, and to permit 8 # tribute, sublicense, and/or sell copies of the Software, and to permit
9 # persons to whom the Software is furnished to do so, subject to the fol- 9 # persons to whom the Software is furnished to do so, subject to the fol-
10 # lowing conditions: 10 # lowing conditions:
11 # 11 #
12 # The above copyright notice and this permission notice shall be included 12 # The above copyright notice and this permission notice shall be included
13 # in all copies or substantial portions of the Software. 13 # in all copies or substantial portions of the Software.
14 # 14 #
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
17 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
18 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 # IN THE SOFTWARE. 21 # IN THE SOFTWARE.
22 22
23 # this is here for backward compatibility 23 # this is here for backward compatibility
24 # originally, the SNSConnection class was defined here 24 # originally, the SNSConnection class was defined here
25 from connection import SNSConnection 25 from connection import SNSConnection
26 from boto.regioninfo import RegionInfo
27
28 def regions():
29 """
30 Get all available regions for the SNS service.
31
32 :rtype: list
33 :return: A list of :class:`boto.regioninfo.RegionInfo` instances
34 """
35 return [RegionInfo(name='us-east-1',
36 endpoint='sns.us-east-1.amazonaws.com',
37 connection_cls=SNSConnection),
38 RegionInfo(name='eu-west-1',
39 endpoint='sns.eu-west-1.amazonaws.com',
40 connection_cls=SNSConnection),
41 RegionInfo(name='us-west-1',
42 endpoint='sns.us-west-1.amazonaws.com',
43 connection_cls=SNSConnection),
44 RegionInfo(name='ap-northeast-1',
45 endpoint='sns.ap-northeast-1.amazonaws.com',
46 connection_cls=SNSConnection),
47 RegionInfo(name='ap-southeast-1',
48 endpoint='sns.ap-southeast-1.amazonaws.com',
49 connection_cls=SNSConnection),
50 ]
51
52 def connect_to_region(region_name, **kw_params):
53 """
54 Given a valid region name, return a
55 :class:`boto.sns.connection.SNSConnection`.
56
57 :type: str
58 :param region_name: The name of the region to connect to.
59
60 :rtype: :class:`boto.sns.connection.SNSConnection` or ``None``
61 :return: A connection to the given region, or None if an invalid region
62 name is given
63 """
64 for region in regions():
65 if region.name == region_name:
66 return region.connect(**kw_params)
67 return None
68
69 def get_region(region_name, **kw_params):
70 """
71 Find and return a :class:`boto.regioninfo.RegionInfo` object
72 given a region name.
73
74 :type: str
75 :param: The name of the region.
76
77 :rtype: :class:`boto.regioninfo.RegionInfo`
78 :return: The RegionInfo object for the given region or None if
79 an invalid region name is provided.
80 """
81 for region in regions(**kw_params):
82 if region.name == region_name:
83 return region
84 return None
OLDNEW
« no previous file with comments | « boto/ses/connection.py ('k') | boto/sns/connection.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698