controlplane

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrgRoleOwner  = tenancy.OrgRoleOwner
	OrgRoleAdmin  = tenancy.OrgRoleAdmin
	OrgRoleMember = tenancy.OrgRoleMember

	TeamRoleOwner  = tenancy.TeamRoleOwner
	TeamRoleAdmin  = tenancy.TeamRoleAdmin
	TeamRoleMember = tenancy.TeamRoleMember

	InviteStatusPending = tenancy.InviteStatusPending
)

Variables

View Source
var ErrInternalUnauthorized = errors.New("invalid internal token")

Functions

func CheckInternalToken

func CheckInternalToken(configured, presented string) error

CheckInternalToken validates X-AFI-Internal-Token for HTTP admin endpoints. An empty configured token rejects all callers (fail closed).

func CheckPassword

func CheckPassword(hash, password string) bool

func EnsureSSOConfigured

func EnsureSSOConfigured(cfg *kernel.Config, auth *platform.AuthService) error

EnsureSSOConfigured returns an error when SSO is enabled but no providers loaded.

func HashAPIKey

func HashAPIKey(raw string) string

func HashPassword

func HashPassword(password string) (string, error)

func IssueToken

func IssueToken(secret string, ttl time.Duration, userID, email, role string) (string, error)

func KeyPrefix

func KeyPrefix(raw string) string

KeyPrefix returns a short display prefix for an API key.

func NewAuthService

NewAuthService wires password + SSO auth against identity ports (composition root supplies adapters).

func NewSSOStateStore

func NewSSOStateStore(cfg *kernel.Config, rdb *goredis.Client) (identity.SSOStateStore, error)

NewSSOStateStore builds the CSRF state backend for SSO. Prefer redis for horizontally scaled control planes; memory is for local/tests only.

Types

type A2AAgent

type A2AAgent = gatewayconfig.A2AAgent

type APIKey

type APIKey = access.APIKey

type Claims

type Claims = auth.Claims

func ParseToken

func ParseToken(secret, token string) (*Claims, error)

type Credential

type Credential = credentials.Credential

type CredentialAssignment

type CredentialAssignment = credentials.Assignment

type Environment

type Environment = tenancy.Environment

type InviteOutcome

type InviteOutcome = tenancy.InviteOutcome

type InvitePreview

type InvitePreview = tenancy.InvitePreview

type MCPBackend

type MCPBackend = gatewayconfig.MCPBackend

type ModelPrice

type ModelPrice = usage.ModelPrice

type ObjectStoreConfig

type ObjectStoreConfig = gatewayconfig.ObjectStoreConfig

type OrgInvite

type OrgInvite = tenancy.OrgInvite

type OrgMember

type OrgMember = tenancy.OrgMember

type Organization

type Organization = tenancy.Organization

type Persistence

type Persistence interface {
	platform.ConfigAPI
	// contains filtered or unexported methods
}

Persistence is the control-plane DB facade (implemented by adapters/postgres.Store).

type Project

type Project = tenancy.Project

type ProtocolProbeResult

type ProtocolProbeResult struct {
	OK         bool   `json:"ok"`
	StatusCode int    `json:"status_code,omitempty"`
	LatencyMs  int64  `json:"latency_ms"`
	Error      string `json:"error,omitempty"`
	Detail     string `json:"detail,omitempty"`
}

ProtocolProbeResult is returned by MCP/A2A connection tests.

type Provider

type Provider = gatewayconfig.Provider

type ProviderHealth

type ProviderHealth = usage.ProviderHealth

type Quota

type Quota = gatewayconfig.Quota

type RequestPolicy

type RequestPolicy = gatewayconfig.RequestPolicy

type RetryConfig

type RetryConfig = gatewayconfig.RetryConfig

type Route

type Route = gatewayconfig.Route

type RouteFallback

type RouteFallback = gatewayconfig.RouteFallback

type Server

type Server struct {
	Metrics *telemetry.ControlPlaneMetrics
	// contains filtered or unexported fields
}

func NewServer

func NewServer(
	cfg *kernel.Config,
	store Persistence,
	seeder localSeeder,
	publisher snapshotPublisher,
	snapStore snapshot.Store,
	log *slog.Logger,
	eventOutbox platform.EventEnqueuer,
	auditStore audit.Store,
	auth *platform.AuthService,
) *Server

NewServer wires HTTP delivery. Persistence/auth/audit adapters are injected by the composition root.

func (*Server) Handler

func (s *Server) Handler() http.Handler

func (*Server) SetUsageEnqueuer added in v0.3.0

func (s *Server) SetUsageEnqueuer(u usageEnqueuer)

SetUsageEnqueuer configures spoke usage ingest (optional).

type SigningKey added in v0.3.0

type SigningKey = access.SigningKey

type Team

type Team = tenancy.Team

type TeamMember

type TeamMember = tenancy.TeamMember

type UsageEvent

type UsageEvent = usage.Record

type UsageFilter

type UsageFilter = usage.Filter

type UsageReportObserver added in v0.3.0

type UsageReportObserver struct {
	Log     *slog.Logger
	Metrics *telemetry.ControlPlaneMetrics
}

UsageReportObserver accepts spoke/regional usage reports for observation only. It does not write usage_events or usage_outbox — durable analytics stay regional or are exported via OTel from these counters/logs.

func NewUsageReportObserver added in v0.3.0

func NewUsageReportObserver(log *slog.Logger) *UsageReportObserver

func (*UsageReportObserver) Enqueue added in v0.3.0

func (o *UsageReportObserver) Enqueue(ctx context.Context, payload []byte) error

Enqueue implements the spoke usage ingest port without persistence.

type UsageSummaryBucket

type UsageSummaryBucket = usage.SummaryBucket

type User

type User = identity.User

type WasmHook

type WasmHook = gatewayconfig.WasmHook

Jump to

Keyboard shortcuts

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