This commit is contained in:
Steve Pulec 2017-02-23 21:37:43 -05:00
commit f37bad0e00
260 changed files with 6363 additions and 3766 deletions

View file

@ -130,7 +130,8 @@ class DynamoHandler(BaseResponse):
throughput = self.body["ProvisionedThroughput"]
new_read_units = throughput["ReadCapacityUnits"]
new_write_units = throughput["WriteCapacityUnits"]
table = dynamodb_backend.update_table_throughput(name, new_read_units, new_write_units)
table = dynamodb_backend.update_table_throughput(
name, new_read_units, new_write_units)
return dynamo_json_dump(table.describe)
def describe_table(self):
@ -169,7 +170,8 @@ class DynamoHandler(BaseResponse):
key = request['Key']
hash_key = key['HashKeyElement']
range_key = key.get('RangeKeyElement')
item = dynamodb_backend.delete_item(table_name, hash_key, range_key)
item = dynamodb_backend.delete_item(
table_name, hash_key, range_key)
response = {
"Responses": {
@ -221,11 +223,13 @@ class DynamoHandler(BaseResponse):
for key in keys:
hash_key = key["HashKeyElement"]
range_key = key.get("RangeKeyElement")
item = dynamodb_backend.get_item(table_name, hash_key, range_key)
item = dynamodb_backend.get_item(
table_name, hash_key, range_key)
if item:
item_describe = item.describe_attrs(attributes_to_get)
items.append(item_describe)
results["Responses"][table_name] = {"Items": items, "ConsumedCapacityUnits": 1}
results["Responses"][table_name] = {
"Items": items, "ConsumedCapacityUnits": 1}
return dynamo_json_dump(results)
def query(self):
@ -239,7 +243,8 @@ class DynamoHandler(BaseResponse):
range_comparison = None
range_values = []
items, last_page = dynamodb_backend.query(name, hash_key, range_comparison, range_values)
items, last_page = dynamodb_backend.query(
name, hash_key, range_comparison, range_values)
if items is None:
er = 'com.amazonaws.dynamodb.v20111205#ResourceNotFoundException'
@ -265,7 +270,8 @@ class DynamoHandler(BaseResponse):
filters = {}
scan_filters = self.body.get('ScanFilter', {})
for attribute_name, scan_filter in scan_filters.items():
# Keys are attribute names. Values are tuples of (comparison, comparison_value)
# Keys are attribute names. Values are tuples of (comparison,
# comparison_value)
comparison_operator = scan_filter["ComparisonOperator"]
comparison_values = scan_filter.get("AttributeValueList", [])
filters[attribute_name] = (comparison_operator, comparison_values)