lib/kakine/adapter/mock.rb in kakine-0.2.0 vs lib/kakine/adapter/mock.rb in kakine-0.3.0

- old
+ new

@@ -1,19 +1,17 @@ module Kakine class Adapter class Mock - def create_rule(security_group_id, direction, attributes) - attributes.delete("direction") - if attributes["port"] - attributes["port_range_max"] = attributes["port_range_min"] = attributes.delete("port") + def create_rule(security_group_id, direction, security_rule) + attributes = {} + %w(protocol port_range_max port_range_min remote_ip ethertype).each do |k| + attributes[k] = eval("security_rule.#{k}") end if attributes["remote_ip"] attributes["remote_ip_prefix"] = attributes.delete("remote_ip") end - data = {} - attributes.each{|k,v| data[k.to_sym] = v} - puts "Create Rule: #{security_group_id} - #{direction}: #{attributes}" + puts "Create Rule: #{security_group_id} - #{security_rule.direction}: #{attributes}" end def delete_rule(security_group_rule_id) puts "Delete Rule: #{security_group_rule_id}" end