Allow plugin to take an etc_type keyword argument for using the TYPE_ETC ubid type, and remove the separate definitions in every model that uses the TYPE_ETC ubid type. This was the cleanest way to DRY things up. You cannot extend the models with a module to do this before including ResourceMethods, because then ResourceMethods::ClassMethods will override it, and you cannot extend the models with a module to do this after including ResourceMethods, because the inclusion will not work correctly due to the eager definition of @ubid_format. Best reviewed without whitespace differences.
27 lines
941 B
Ruby
27 lines
941 B
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative "../model"
|
|
|
|
class LoadBalancerPort < Sequel::Model
|
|
many_to_one :load_balancer
|
|
plugin ResourceMethods
|
|
include HealthMonitorMethods
|
|
end
|
|
|
|
# Table: load_balancer_port
|
|
# Columns:
|
|
# id | uuid | PRIMARY KEY
|
|
# load_balancer_id | uuid | NOT NULL
|
|
# src_port | integer | NOT NULL
|
|
# dst_port | integer | NOT NULL
|
|
# Indexes:
|
|
# load_balancer_port_pkey | PRIMARY KEY btree (id)
|
|
# lb_port_unique_index | UNIQUE btree (load_balancer_id, src_port)
|
|
# Check constraints:
|
|
# dst_port_range | (dst_port >= 1 AND dst_port <= 65535)
|
|
# src_port_range | (src_port >= 1 AND src_port <= 65535)
|
|
# Foreign key constraints:
|
|
# load_balancer_port_load_balancer_id_fkey | (load_balancer_id) REFERENCES load_balancer(id)
|
|
# Referenced By:
|
|
# load_balancer_vm_port | load_balancer_vm_port_load_balancer_port_id_fkey | (load_balancer_port_id) REFERENCES load_balancer_port(id)
|