Sha256: 8fc4229ea20d3d9dc5589ac8c74108a3c596d5045073a2813ba86f37cc3c0715

Contents?: true

Size: 1.26 KB

Versions: 7

Compression:

Stored size: 1.26 KB

Contents

module Kakine
  module Adapter
    class Mock
      include Kakine::Adapter::Base
      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}"
        "Create Rule: #{security_group_id}"
      end

      def delete_rule(security_group_rule_id)
        puts "Delete Rule: #{security_group_rule_id}"
        "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}"
        "Create Security Group: #{attributes[:name]}"
      end

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

      def security_group(tenant_name, sg_name)
        self
      end

      def id(sg_name)
        "#{sg_name}"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
kakine-0.7.0 lib/kakine/adapter/mock.rb
kakine-0.6.5 lib/kakine/adapter/mock.rb
kakine-0.6.4 lib/kakine/adapter/mock.rb
kakine-0.6.2 lib/kakine/adapter/mock.rb
kakine-0.6.1 lib/kakine/adapter/mock.rb
kakine-0.6.0 lib/kakine/adapter/mock.rb
kakine-0.5.0 lib/kakine/adapter/mock.rb