Files
ubicloud/model/firewall_rule.rb
Jeremy Evans 30247a3800 Include model annotations at the bottom of all model files
This makes it easier for developers new to the codebase to
easily get important information on the model's table in the
same file as the model code.

To ensure the model annotations stay accurate, run them on
test_up/test_down.  In CI, regenerate the annotations, and
check for no changes, similar to how the linters work.
2024-11-13 09:13:30 -08:00

28 lines
801 B
Ruby

# frozen_string_literal: true
require_relative "../model"
class FirewallRule < Sequel::Model
many_to_one :firewall, key: :firewall_id
include ResourceMethods
def ip6?
cidr.to_s.include?(":")
end
end
# Table: firewall_rule
# Columns:
# id | uuid | PRIMARY KEY
# cidr | cidr |
# port_range | int4range | DEFAULT '[0,65536)'::int4range
# firewall_id | uuid | NOT NULL
# Indexes:
# firewall_rule_pkey | PRIMARY KEY btree (id)
# firewall_rule_cidr_port_range_firewall_id_key | UNIQUE btree (cidr, port_range, firewall_id)
# Check constraints:
# port_range_min_max | (lower(port_range) >= 0 AND upper(port_range) <= 65536)
# Foreign key constraints:
# firewall_rule_firewall_id_fkey | (firewall_id) REFERENCES firewall(id)