class Dyna::DynamoDBWrapper

Public Class Methods

new(ddb, options) click to toggle source
# File lib/dyna/wrapper/dynamo_db_wrapper.rb, line 5
def initialize(ddb, options)
  @ddb = ddb
  @options = options.dup
end

Public Instance Methods

create(dsl) click to toggle source
# File lib/dyna/wrapper/dynamo_db_wrapper.rb, line 19
def create(dsl)
  log(:info, 'Create Table', :cyan, "#{dsl.table_name}")

  unless @options.dry_run
    params = dsl.symbolize_keys
    params.delete(:scalable_targets)
    params.delete(:scaling_policies)
    params.delete(:time_to_live_specification)
    result = @ddb.create_table(params)
    @options.updated = true
    result
  end
end
tables() click to toggle source
# File lib/dyna/wrapper/dynamo_db_wrapper.rb, line 10
def tables
  @ddb.list_tables.map { |tables|
    tables.table_names.map do |table_name|
      describe_table = @ddb.describe_table(table_name: table_name).table
      Table.new(@ddb, describe_table, @options)
    end
  }.flatten
end
updated?() click to toggle source
# File lib/dyna/wrapper/dynamo_db_wrapper.rb, line 33
def updated?
  !!@options.updated
end