Sha256: f50fb7c96081b336579f4249414b59fc37cbeb083af0fba62b20b8273ebf29e4

Contents?: true

Size: 969 Bytes

Versions: 1

Compression:

Stored size: 969 Bytes

Contents

module Kakine
  class Adapter
    class Mock
      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

        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

      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

1 entries across 1 versions & 1 rubygems

Version Path
kakine-0.3.0 lib/kakine/adapter/mock.rb