module Alephant::Harness::Service::DynamoDB
Public Class Methods
create(table_name, schema)
click to toggle source
# File lib/alephant/harness/service/dynamo_db.rb, line 8 def self.create(table_name, schema) schema.tap { |s| s[:table_name] = table_name } client.create_table(schema) end
load_schema(schema_name)
click to toggle source
# File lib/alephant/harness/service/dynamo_db.rb, line 19 def self.load_schema(schema_name) YAML::load_file(File.join([File.dirname(__FILE__), *(%w'..' * 4), 'schema', "#{schema_name}.yaml"])) end
remove(table_name)
click to toggle source
# File lib/alephant/harness/service/dynamo_db.rb, line 13 def self.remove(table_name) client.delete_table({ :table_name => table_name }) rescue Aws::DynamoDB::Errors::ResourceNotFoundException => e # If table doesn't exist fail silently end
Private Class Methods
client()
click to toggle source
# File lib/alephant/harness/service/dynamo_db.rb, line 25 def self.client @@client ||= ::Aws::DynamoDB::Client.new(AWS.dynamo_config) end