Class: Dyna::Client
- Inherits:
-
Object
- Object
- Dyna::Client
- Includes:
- Filterable, Logger::ClientHelper
- Defined in:
- lib/dyna/client.rb
Instance Method Summary collapse
- #apply(file) ⇒ Object
- #export(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
Methods included from Filterable
Methods included from Logger::ClientHelper
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/dyna/client.rb', line 6 def initialize( = {}) = OpenStruct.new() = if .use_local .ddb = Aws::DynamoDB::Client.new( endpoint: .dynamo_endpoint || 'http://127.0.0.1:8000', region: .region || 'ap-northeast-1', access_key_id: .access_key_id || 'dummy', secret_access_key: .secret_access_key || 'dummy', ) else .ddb = Aws::DynamoDB::Client.new .aas = Aws::ApplicationAutoScaling::Client.new Exporter.aas(.aas) end end |
Instance Method Details
#apply(file) ⇒ Object
23 24 25 |
# File 'lib/dyna/client.rb', line 23 def apply(file) walk(file) end |
#export(options = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/dyna/client.rb', line 27 def export( = {}) exported = Exporter.export(.ddb, ) converter = proc do |src| DSL.convert(.ddb.config.region, src) end if block_given? yield(exported, converter) else converter.call(exported) end end |