Module: Dynomite::Migration::Dsl::ProvisionedThroughput
- Included in:
- Dynomite::Migration::Dsl
- Defined in:
- lib/dynomite/migration/dsl/provisioned_throughput.rb
Instance Method Summary collapse
- #billing_mode(v) ⇒ Object
-
#provisioned_throughput(*args) ⇒ Object
t.provisioned_throughput(1) # both t.provisioned_throughput(1,1) # read, write t.provisioned_throughput({ read_capacity_units: 1, write_capacity_units: 1 }.
Instance Method Details
#billing_mode(v) ⇒ Object
3 4 5 6 |
# File 'lib/dynomite/migration/dsl/provisioned_throughput.rb', line 3 def billing_mode(v) @billing_mode = v @provisioned_throughput = nil if @billing_mode.to_s.upcase == "PAY_PER_REQUEST" end |
#provisioned_throughput(*args) ⇒ Object
t.provisioned_throughput(1) # both t.provisioned_throughput(1,1) # read, write t.provisioned_throughput(
read_capacity_units: 1,
write_capacity_units: 1
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/dynomite/migration/dsl/provisioned_throughput.rb', line 14 def provisioned_throughput(*args) if args.size == 0 # reader method @provisioned_throughput # early return elsif args.first.is_a?(Hash) # @provisioned_throughput_set_called useful for update_table # only provide a provisioned_throughput settings if explicitly called for update_table @provisioned_throughput_set_called = true # Case: # provisioned_throughput( # read_capacity_units: 1, # write_capacity_units: 1 # ) @provisioned_throughput = arg.first # set directly else # assume parameter is an Integer or [Integer, Integer] # Case: provisioned_throughput(1) # Case: provisioned_throughput(1, 1) read_capacity_units, write_capacity_units = args @provisioned_throughput = { read_capacity_units: read_capacity_units, write_capacity_units: write_capacity_units || read_capacity_units, } end end |