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

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

Issue 12042069: Scripts to download files from google storage based on sha1 sums (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Removed gsutil/tests and gsutil/docs Created 7 years, 10 months 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
OLDNEW
(Empty)
1 # Copyright (c) 2010-2012 Mitch Garnaat http://garnaat.org/
2 # Copyright (c) 2010-2011, Eucalyptus Systems, Inc.
3 #
4 # Permission is hereby granted, free of charge, to any person obtaining a
5 # copy of this software and associated documentation files (the
6 # "Software"), to deal in the Software without restriction, including
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
9 # persons to whom the Software is furnished to do so, subject to the fol-
10 # lowing conditions:
11 #
12 # The above copyright notice and this permission notice shall be included
13 # in all copies or substantial portions of the Software.
14 #
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-
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,
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
21 # IN THE SOFTWARE.
22
23 # this is here for backward compatibility
24 # originally, the SNSConnection class was defined here
25 from connection import SNSConnection
26 from boto.regioninfo import RegionInfo
27
28
29 def regions():
30 """
31 Get all available regions for the SNS service.
32
33 :rtype: list
34 :return: A list of :class:`boto.regioninfo.RegionInfo` instances
35 """
36 return [RegionInfo(name='us-east-1',
37 endpoint='sns.us-east-1.amazonaws.com',
38 connection_cls=SNSConnection),
39 RegionInfo(name='eu-west-1',
40 endpoint='sns.eu-west-1.amazonaws.com',
41 connection_cls=SNSConnection),
42 RegionInfo(name='us-west-1',
43 endpoint='sns.us-west-1.amazonaws.com',
44 connection_cls=SNSConnection),
45 RegionInfo(name='sa-east-1',
46 endpoint='sns.sa-east-1.amazonaws.com',
47 connection_cls=SNSConnection),
48 RegionInfo(name='us-west-2',
49 endpoint='sns.us-west-2.amazonaws.com',
50 connection_cls=SNSConnection),
51 RegionInfo(name='ap-northeast-1',
52 endpoint='sns.ap-northeast-1.amazonaws.com',
53 connection_cls=SNSConnection),
54 RegionInfo(name='ap-southeast-1',
55 endpoint='sns.ap-southeast-1.amazonaws.com',
56 connection_cls=SNSConnection),
57 RegionInfo(name='ap-southeast-2',
58 endpoint='sns.ap-southeast-2.amazonaws.com',
59 connection_cls=SNSConnection),
60 ]
61
62
63 def connect_to_region(region_name, **kw_params):
64 """
65 Given a valid region name, return a
66 :class:`boto.sns.connection.SNSConnection`.
67
68 :type: str
69 :param region_name: The name of the region to connect to.
70
71 :rtype: :class:`boto.sns.connection.SNSConnection` or ``None``
72 :return: A connection to the given region, or None if an invalid region
73 name is given
74 """
75 for region in regions():
76 if region.name == region_name:
77 return region.connect(**kw_params)
78 return None
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698