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

Side by Side Diff: third_party/gsutil/boto/boto/cloudformation/__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: Review fixes, updated gsutil 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-2011 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 from connection import CloudFormationConnection
24 from boto.regioninfo import RegionInfo
25
26 RegionData = {
27 'us-east-1': 'cloudformation.us-east-1.amazonaws.com',
28 'us-west-1': 'cloudformation.us-west-1.amazonaws.com',
29 'us-west-2': 'cloudformation.us-west-2.amazonaws.com',
30 'sa-east-1': 'cloudformation.sa-east-1.amazonaws.com',
31 'eu-west-1': 'cloudformation.eu-west-1.amazonaws.com',
32 'ap-northeast-1': 'cloudformation.ap-northeast-1.amazonaws.com',
33 'ap-southeast-1': 'cloudformation.ap-southeast-1.amazonaws.com',
34 'ap-southeast-2': 'cloudformation.ap-southeast-2.amazonaws.com',
35 }
36
37
38 def regions():
39 """
40 Get all available regions for the CloudFormation service.
41
42 :rtype: list
43 :return: A list of :class:`boto.RegionInfo` instances
44 """
45 regions = []
46 for region_name in RegionData:
47 region = RegionInfo(name=region_name,
48 endpoint=RegionData[region_name],
49 connection_cls=CloudFormationConnection)
50 regions.append(region)
51 return regions
52
53
54 def connect_to_region(region_name, **kw_params):
55 """
56 Given a valid region name, return a
57 :class:`boto.cloudformation.CloudFormationConnection`.
58
59 :param str region_name: The name of the region to connect to.
60
61 :rtype: :class:`boto.cloudformation.CloudFormationConnection` or ``None``
62 :return: A connection to the given region, or None if an invalid region
63 name is given
64 """
65 for region in regions():
66 if region.name == region_name:
67 return region.connect(**kw_params)
68 return None
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698