Sha256: 38063773a76ca855744807e3643dcb671fc212e2a7c5db34e14d91d183a5131f

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

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")
        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}"
      end

      def delete_rule(security_group_rule_id)
        puts "Delete Rule: #{security_group_rule_id}"
      end

      def create_security_group(attributes)
        data = {}
        attributes.each{|k,v| data[k.to_sym] = v}
        puts "Create Security Group: #{data}"
        "[Mock] #{attributes[:name]} ID"
      end

      def delete_security_group(security_group_id)
        puts "Delete Security Group: #{security_group_id}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kakine-0.2.0 lib/kakine/adapter/mock.rb
kakine-0.1.0 lib/kakine/adapter/mock.rb