Files
ubicloud/model/ai/inference_router_target.rb
Jeremy Evans 718370f4c9 Convert ResourceMethods to a plugin
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.
2025-06-04 04:55:45 +09:00

42 lines
1.8 KiB
Ruby

# frozen_string_literal: true
require_relative "../../model"
class InferenceRouterTarget < Sequel::Model
one_to_one :strand, key: :id
many_to_one :inference_router
many_to_one :inference_router_model
plugin ResourceMethods
include SemaphoreMethods
semaphore :destroy
plugin :column_encryption do |enc|
enc.column :api_key
end
end
# Table: inference_router_target
# Columns:
# id | uuid | PRIMARY KEY
# created_at | timestamp with time zone | NOT NULL DEFAULT CURRENT_TIMESTAMP
# updated_at | timestamp with time zone | NOT NULL DEFAULT CURRENT_TIMESTAMP
# name | text | NOT NULL
# host | text | NOT NULL
# api_key | text | NOT NULL
# inflight_limit | integer | NOT NULL
# priority | integer | NOT NULL
# extra_configs | jsonb | NOT NULL DEFAULT '{}'::jsonb
# enabled | boolean | NOT NULL DEFAULT false
# inference_router_model_id | uuid | NOT NULL
# inference_router_id | uuid | NOT NULL
# type | text | NOT NULL DEFAULT 'manual'::text
# config | jsonb | NOT NULL DEFAULT '{}'::jsonb
# state | jsonb | NOT NULL DEFAULT '{}'::jsonb
# Indexes:
# inference_router_target_pkey | PRIMARY KEY btree (id)
# Foreign key constraints:
# inference_router_target_inference_router_id_fkey | (inference_router_id) REFERENCES inference_router(id)
# inference_router_target_inference_router_model_id_fkey | (inference_router_model_id) REFERENCES inference_router_model(id)