mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
adds batch_put_item functionality to AWS dynamodb + test
This commit is contained in:
parent
a36c3aaf67
commit
241ac21910
3 changed files with 51 additions and 0 deletions
30
lib/fog/aws/requests/dynamodb/batch_put_item.rb
Normal file
30
lib/fog/aws/requests/dynamodb/batch_put_item.rb
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class DynamoDB
|
||||
class Real
|
||||
|
||||
#request_items has form:
|
||||
#{"table_name"=>
|
||||
# [{"PutRequest"=>
|
||||
# {"Item"=>
|
||||
# {"hash_key"=>{"N"=>"99"},
|
||||
# "range_key"=>{"N"=>"99"},
|
||||
# "attribute"=>{"S"=>"hi"}
|
||||
# }}}, ... ]}
|
||||
# For more information:
|
||||
# http://docs.amazonwebservices.com/amazondynamodb/latest/developerguide/API_BatchWriteItems.html
|
||||
def batch_put_item(request_items)
|
||||
body = {
|
||||
'RequestItems' => request_items
|
||||
}
|
||||
|
||||
request(
|
||||
:body => MultiJson.encode(body),
|
||||
:headers => {'x-amz-target' => 'DynamoDB_20111205.BatchWriteItem'}
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue