2012-04-20 15:23:57 -04:00
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
class DynamoDB
|
|
|
|
class Real
|
|
|
|
|
2012-04-29 17:31:28 -04:00
|
|
|
def batch_put_item(request_items)
|
|
|
|
Fog::Logger.deprecation("batch_put_item is deprecated, use batch_write_item instead")
|
|
|
|
batch_write_item(request_items)
|
|
|
|
end
|
|
|
|
|
2012-04-20 15:23:57 -04:00
|
|
|
#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
|
2012-04-29 17:31:28 -04:00
|
|
|
def batch_write_item(request_items)
|
2012-04-20 15:23:57 -04:00
|
|
|
body = {
|
|
|
|
'RequestItems' => request_items
|
|
|
|
}
|
|
|
|
|
|
|
|
request(
|
2012-04-25 10:31:28 -04:00
|
|
|
:body => Fog::JSON.encode(body),
|
2012-04-20 15:23:57 -04:00
|
|
|
:headers => {'x-amz-target' => 'DynamoDB_20111205.BatchWriteItem'}
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|