Sha256: 2f8d9e7f65ae6a6d0a3311cdeda7cf99fae01039bd3f15e56118c53e43211985

Contents?: true

Size: 665 Bytes

Versions: 9

Compression:

Stored size: 665 Bytes

Contents

module Dyna
  class DynamoDBWrapper
    include Logger::ClientHelper

    def initialize(ddb, options)
      @ddb = ddb
      @options = options.dup
    end

    def tables
      @ddb.list_tables.table_names.map do |table_name|
        describe_table = @ddb.describe_table(table_name: table_name).table
        Table.new(@ddb, describe_table, @options)
      end
    end

    def create(dsl)
      log(:info, 'Create Table', :cyan, "#{dsl.table_name}")

      unless @options.dry_run
        result = @ddb.create_table(dsl.symbolize_keys)
        @options.updated = true
        result
      end
    end

    def updated?
      !!@options.updated
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
dyna-0.1.9 lib/dyna/wrapper/dynamo_db_wrapper.rb
dyna-0.1.8 lib/dyna/wrapper/dynamo_db_wrapper.rb
dyna-0.1.7 lib/dyna/wrapper/dynamo_db_wrapper.rb
dyna-0.1.6 lib/dyna/wrapper/dynamo_db_wrapper.rb
dyna-0.1.5 lib/dyna/wrapper/dynamo_db_wrapper.rb
dyna-0.1.4 lib/dyna/wrapper/dynamo_db_wrapper.rb
dyna-0.1.3 lib/dyna/wrapper/dynamo_db_wrapper.rb
dyna-0.1.2 lib/dyna/wrapper/dynamo_db_wrapper.rb
dyna-0.1.1 lib/dyna/wrapper/dynamo_db_wrapper.rb