Sha256: f4c117dde4d85b546d38f9b0d6c1d1576f6c70c5b471826c4c13245d6cae98d1

Contents?: true

Size: 1.02 KB

Versions: 43

Compression:

Stored size: 1.02 KB

Contents

require "pp"
module Brightbox
  class FirewallRule < Api
    def self.require_account?; true; end
    attr_writer :attributes

    def self.create(options)
      new(conn.firewall_rules.create(options))
    end

    def self.get(id)
      conn.firewall_rules.get(id)
    end

    def update(params)
      self.class.conn.update_firewall_rule id, params
      reload
      self
    end

    def attributes
      t = @attributes || fog_model.attributes
      t[:sport] = t[:source_port]
      t[:dport] = t[:destination_port]
      t[:firewall_policy] = t[:firewall_policy_id]
      t[:icmp_type] = t[:icmp_type_name]
      t
    end

    def to_row
      attrs = attributes.dup
      [:protocol, :source, :sport, :destination, :dport, :icmp_type].each do |key|
        attrs[key] = attributes[key] || '-'
      end
      attrs
    end

    def ret_val(attributes, key)
      attributes[key] || "-"
    end

    def self.default_field_order
      [:id, :protocol, :source, :sport, :destination, :dport, :icmp_type, :description]
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
brightbox-cli-3.3.0 lib/brightbox-cli/firewall_rule.rb
brightbox-cli-3.2.0 lib/brightbox-cli/firewall_rule.rb
brightbox-cli-3.1.0 lib/brightbox-cli/firewall_rule.rb
brightbox-cli-3.0.1 lib/brightbox-cli/firewall_rule.rb
brightbox-cli-3.0.0 lib/brightbox-cli/firewall_rule.rb
brightbox-cli-2.12.0 lib/brightbox-cli/firewall_rule.rb
brightbox-cli-2.11.2 lib/brightbox-cli/firewall_rule.rb
brightbox-cli-2.11.1 lib/brightbox-cli/firewall_rule.rb
brightbox-cli-2.11.0 lib/brightbox-cli/firewall_rule.rb
brightbox-cli-2.10.0 lib/brightbox-cli/firewall_rule.rb
brightbox-cli-2.9.3 lib/brightbox-cli/firewall_rule.rb
brightbox-cli-2.9.2 lib/brightbox-cli/firewall_rule.rb
brightbox-cli-2.9.1 lib/brightbox-cli/firewall_rule.rb
brightbox-cli-2.9.0 lib/brightbox-cli/firewall_rule.rb
brightbox-cli-2.8.2 lib/brightbox-cli/firewall_rule.rb
brightbox-cli-2.8.1 lib/brightbox-cli/firewall_rule.rb
brightbox-cli-2.8.0 lib/brightbox-cli/firewall_rule.rb
brightbox-cli-2.7.1 lib/brightbox-cli/firewall_rule.rb
brightbox-cli-2.7.0 lib/brightbox-cli/firewall_rule.rb
brightbox-cli-2.6.0 lib/brightbox-cli/firewall_rule.rb