aws class

class AwsStuff
@@region = ""
@@dbResult = ""
def self.get_dynamodb_data(dbtable, dbkey)
 dynamodb = Aws::DynamoDB::Client.new(region: @@region) 
params = {    
table_name: dbtable, 
key: {    uuid: dbkey }
}
begin
result = dynamodb.get_item(params)
if result.item == nil
debug_code "Could not find item '#{dbkey}' in db table '#{dbtable}' "
exit 0
end
debug_code result
# save the response to the response class
Response.new(result['item'])
return result['item']
rescue Aws::DynamoDB::Errors::ServiceError => error
debug_code "Could not find item '#{dbkey}' in table '#{dbtable}' "
debug_code error.message
fail error.message
end
end
end

Leave a Reply

Your email address will not be published. Required fields are marked *