providers

package
v0.4.0-rc.35 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package providers owns the tenant-wide LLM provider catalog: rows in the providers table, their encrypted API keys, and the lifecycle (create / list / update / delete). Mutations gate through authz.Authorize(TenantProviderManage) (admin); List gates through TenantProviderView (manager+) so anyone who can configure an agent's models can resolve provider id→name. API keys are write-once: set on create/update, encrypted at rest, and never returned to any caller.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateRequest

type CreateRequest struct {
	ProviderID  string // catalog id (e.g. "openai")
	Slug        string
	DisplayName string
	APIKey      string
	BaseURL     string
}

type Result

type Result struct {
	Row dbq.Provider
}

Result is the persisted row. The API key is never included — it's write-once and stays encrypted at rest; the row's has-key state is derived from the ciphertext column (see convert.ProviderToProto).

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(d *db.DB, enc secrets.Store, logger *zap.Logger) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, p authz.Principal, req CreateRequest) (Result, error)

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, p authz.Principal, id uuid.UUID) error

func (*Service) List

func (s *Service) List(ctx context.Context, p authz.Principal) ([]Result, error)

func (*Service) Update

func (s *Service) Update(ctx context.Context, p authz.Principal, id uuid.UUID, req UpdateRequest) (Result, error)

type UpdateRequest

type UpdateRequest struct {
	Slug        string
	DisplayName string
	BaseURL     string
	APIKey      string // empty → leave existing ciphertext
	IsEnabled   *bool  // nil → leave existing flag
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL