2014-12-30 17:25:09 -05:00
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
class DynamoDB
|
|
|
|
class Real
|
|
|
|
# Delete DynamoDB item
|
|
|
|
#
|
|
|
|
# ==== Parameters
|
|
|
|
# * 'table_name'<~String> - name of table for item
|
2015-12-19 10:08:53 -05:00
|
|
|
# * 'key'<~Hash> - hash of attributes
|
2014-12-30 17:25:09 -05:00
|
|
|
#
|
|
|
|
# ==== Returns
|
|
|
|
# * response<~Excon::Response>:
|
|
|
|
# * body<~Hash>:
|
|
|
|
# varies based on ReturnValues param, see: http://docs.amazonwebservices.com/amazondynamodb/latest/developerguide/API_UpdateItem.html
|
2015-12-19 10:08:53 -05:00
|
|
|
#
|
|
|
|
# See DynamoDB Documentation: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteItem.html
|
|
|
|
#
|
2014-12-30 17:25:09 -05:00
|
|
|
def delete_item(table_name, key, options = {})
|
|
|
|
body = {
|
|
|
|
'Key' => key,
|
|
|
|
'TableName' => table_name
|
|
|
|
}.merge(options)
|
|
|
|
|
|
|
|
request(
|
|
|
|
:body => Fog::JSON.encode(body),
|
2015-12-19 10:08:53 -05:00
|
|
|
:headers => {'x-amz-target' => 'DynamoDB_20120810.DeleteItem'},
|
2014-12-30 17:25:09 -05:00
|
|
|
:idempotent => true
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|