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

Side by Side Diff: third_party/gsutil/boto/dynamodb/schema.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) 2011 Mitch Garnaat http://garnaat.org/
2 # Copyright (c) 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved
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
24
25 class Schema(object):
26 """
27 Represents a DynamoDB schema.
28
29 :ivar hash_key_name: The name of the hash key of the schema.
30 :ivar hash_key_type: The DynamoDB type specification for the
31 hash key of the schema.
32 :ivar range_key_name: The name of the range key of the schema
33 or None if no range key is defined.
34 :ivar range_key_type: The DynamoDB type specification for the
35 range key of the schema or None if no range key is defined.
36 :ivar dict: The underlying Python dictionary that needs to be
37 passed to Layer1 methods.
38 """
39
40 def __init__(self, schema_dict):
41 self._dict = schema_dict
42
43 def __repr__(self):
44 if self.range_key_name:
45 s = 'Schema(%s:%s)' % (self.hash_key_name, self.range_key_name)
46 else:
47 s = 'Schema(%s)' % self.hash_key_name
48 return s
49
50 @property
51 def dict(self):
52 return self._dict
53
54 @property
55 def hash_key_name(self):
56 return self._dict['HashKeyElement']['AttributeName']
57
58 @property
59 def hash_key_type(self):
60 return self._dict['HashKeyElement']['AttributeType']
61
62 @property
63 def range_key_name(self):
64 name = None
65 if 'RangeKeyElement' in self._dict:
66 name = self._dict['RangeKeyElement']['AttributeName']
67 return name
68
69 @property
70 def range_key_type(self):
71 type = None
72 if 'RangeKeyElement' in self._dict:
73 type = self._dict['RangeKeyElement']['AttributeType']
74 return type
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698