Documentation
¶
Overview ¶
Package api serves remora's management API under /api/* and the public /healthz probe.
Index ¶
- func RegisterHealthz(mux *http.ServeMux, src StatusSource, pool PoolSource)
- func Scrub(s string) string
- type Account
- type Accounts
- type Aliases
- type Cooling
- type Deps
- type EngineNames
- type EngineVersion
- type HealthResponse
- type Key
- type KeyPatch
- type Keys
- type LogSource
- type Login
- type LoginStatus
- type ModelLister
- type PoolSource
- type Provider
- type ProviderKey
- type ProviderTest
- type Providers
- type Quota
- type Quotas
- type Server
- func (s *Server) ApplyConfig(ctx context.Context, req gen.ApplyConfigRequestObject) (gen.ApplyConfigResponseObject, error)
- func (s *Server) CancelAccountLogin(ctx context.Context, req gen.CancelAccountLoginRequestObject) (gen.CancelAccountLoginResponseObject, error)
- func (s *Server) ChangePassword(ctx context.Context, req gen.ChangePasswordRequestObject) (gen.ChangePasswordResponseObject, error)
- func (s *Server) CompileAlias(ctx context.Context, req gen.CompileAliasRequestObject) (gen.CompileAliasResponseObject, error)
- func (s *Server) CompleteAccountLogin(ctx context.Context, req gen.CompleteAccountLoginRequestObject) (gen.CompleteAccountLoginResponseObject, error)
- func (s *Server) CreateAlias(ctx context.Context, req gen.CreateAliasRequestObject) (gen.CreateAliasResponseObject, error)
- func (s *Server) CreateApiToken(ctx context.Context, req gen.CreateApiTokenRequestObject) (gen.CreateApiTokenResponseObject, error)
- func (s *Server) CreateKey(ctx context.Context, req gen.CreateKeyRequestObject) (gen.CreateKeyResponseObject, error)
- func (s *Server) CreateProvider(ctx context.Context, req gen.CreateProviderRequestObject) (gen.CreateProviderResponseObject, error)
- func (s *Server) DeleteAccount(ctx context.Context, req gen.DeleteAccountRequestObject) (gen.DeleteAccountResponseObject, error)
- func (s *Server) DeleteAlias(ctx context.Context, req gen.DeleteAliasRequestObject) (gen.DeleteAliasResponseObject, error)
- func (s *Server) DeleteApiToken(ctx context.Context, req gen.DeleteApiTokenRequestObject) (gen.DeleteApiTokenResponseObject, error)
- func (s *Server) DeleteKey(ctx context.Context, req gen.DeleteKeyRequestObject) (gen.DeleteKeyResponseObject, error)
- func (s *Server) DeleteProvider(ctx context.Context, req gen.DeleteProviderRequestObject) (gen.DeleteProviderResponseObject, error)
- func (s *Server) ExportConfig(ctx context.Context, _ gen.ExportConfigRequestObject) (gen.ExportConfigResponseObject, error)
- func (s *Server) GetAccountLogin(ctx context.Context, req gen.GetAccountLoginRequestObject) (gen.GetAccountLoginResponseObject, error)
- func (s *Server) GetAccountPool(ctx context.Context, _ gen.GetAccountPoolRequestObject) (gen.GetAccountPoolResponseObject, error)
- func (s *Server) GetAlias(ctx context.Context, req gen.GetAliasRequestObject) (gen.GetAliasResponseObject, error)
- func (s *Server) GetAliasChain(ctx context.Context, req gen.GetAliasChainRequestObject) (gen.GetAliasChainResponseObject, error)
- func (s *Server) GetHealth(ctx context.Context, _ gen.GetHealthRequestObject) (gen.GetHealthResponseObject, error)
- func (s *Server) GetKey(ctx context.Context, req gen.GetKeyRequestObject) (gen.GetKeyResponseObject, error)
- func (s *Server) GetKeyUsage(ctx context.Context, req gen.GetKeyUsageRequestObject) (gen.GetKeyUsageResponseObject, error)
- func (s *Server) GetLog(ctx context.Context, req gen.GetLogRequestObject) (gen.GetLogResponseObject, error)
- func (s *Server) GetProvider(ctx context.Context, req gen.GetProviderRequestObject) (gen.GetProviderResponseObject, error)
- func (s *Server) GetProviderModels(ctx context.Context, req gen.GetProviderModelsRequestObject) (gen.GetProviderModelsResponseObject, error)
- func (s *Server) GetQuota(ctx context.Context, req gen.GetQuotaRequestObject) (gen.GetQuotaResponseObject, error)
- func (s *Server) GetSession(ctx context.Context, _ gen.GetSessionRequestObject) (gen.GetSessionResponseObject, error)
- func (s *Server) GetStats(ctx context.Context, req gen.GetStatsRequestObject) (gen.GetStatsResponseObject, error)
- func (s *Server) GetVersion(ctx context.Context, _ gen.GetVersionRequestObject) (gen.GetVersionResponseObject, error)
- func (s *Server) Handler() http.Handler
- func (s *Server) ImportAccount(ctx context.Context, req gen.ImportAccountRequestObject) (gen.ImportAccountResponseObject, error)
- func (s *Server) ListAccountStrategies(ctx context.Context, req gen.ListAccountStrategiesRequestObject) (gen.ListAccountStrategiesResponseObject, error)
- func (s *Server) ListAccounts(ctx context.Context, req gen.ListAccountsRequestObject) (gen.ListAccountsResponseObject, error)
- func (s *Server) ListAliases(ctx context.Context, req gen.ListAliasesRequestObject) (gen.ListAliasesResponseObject, error)
- func (s *Server) ListApiTokens(ctx context.Context, req gen.ListApiTokensRequestObject) (gen.ListApiTokensResponseObject, error)
- func (s *Server) ListAudit(ctx context.Context, req gen.ListAuditRequestObject) (gen.ListAuditResponseObject, error)
- func (s *Server) ListCooling(ctx context.Context, req gen.ListCoolingRequestObject) (gen.ListCoolingResponseObject, error)
- func (s *Server) ListKeys(ctx context.Context, req gen.ListKeysRequestObject) (gen.ListKeysResponseObject, error)
- func (s *Server) ListLogs(ctx context.Context, req gen.ListLogsRequestObject) (gen.ListLogsResponseObject, error)
- func (s *Server) ListProviders(ctx context.Context, req gen.ListProvidersRequestObject) (gen.ListProvidersResponseObject, error)
- func (s *Server) Login(ctx context.Context, req gen.LoginRequestObject) (gen.LoginResponseObject, error)
- func (s *Server) Logout(ctx context.Context, _ gen.LogoutRequestObject) (gen.LogoutResponseObject, error)
- func (s *Server) PlanConfig(ctx context.Context, req gen.PlanConfigRequestObject) (gen.PlanConfigResponseObject, error)
- func (s *Server) RefreshQuota(ctx context.Context, req gen.RefreshQuotaRequestObject) (gen.RefreshQuotaResponseObject, error)
- func (s *Server) ResetAccountCooldown(ctx context.Context, req gen.ResetAccountCooldownRequestObject) (gen.ResetAccountCooldownResponseObject, error)
- func (s *Server) SetAccountStrategy(ctx context.Context, req gen.SetAccountStrategyRequestObject) (gen.SetAccountStrategyResponseObject, error)
- func (s *Server) StartAccountLogin(ctx context.Context, req gen.StartAccountLoginRequestObject) (gen.StartAccountLoginResponseObject, error)
- func (s *Server) TestProvider(ctx context.Context, req gen.TestProviderRequestObject) (gen.TestProviderResponseObject, error)
- func (s *Server) UpdateAccount(ctx context.Context, req gen.UpdateAccountRequestObject) (gen.UpdateAccountResponseObject, error)
- func (s *Server) UpdateAlias(ctx context.Context, req gen.UpdateAliasRequestObject) (gen.UpdateAliasResponseObject, error)
- func (s *Server) UpdateKey(ctx context.Context, req gen.UpdateKeyRequestObject) (gen.UpdateKeyResponseObject, error)
- func (s *Server) UpdateProvider(ctx context.Context, req gen.UpdateProviderRequestObject) (gen.UpdateProviderResponseObject, error)
- type SonioxFiles
- type StatsSource
- type StatusSource
- type System
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterHealthz ¶
func RegisterHealthz(mux *http.ServeMux, src StatusSource, pool PoolSource)
RegisterHealthz mounts GET /healthz (200 ok, 503 degraded) on mux. It needs no auth: the image's health check and orchestrators call it. Accounts out of the pool are counted but never turn it to 503: an orchestrator would restart a node that is still serving. A failed pool lookup leaves the count out; an engine that is down already shows in down.
Types ¶
type Account ¶
type Account struct {
ID, Provider, Email, Status, Message string
Enabled bool
Priority int
CooldownUntil *time.Time
Quota []Quota
Models []string
}
Account is a subscription account signed in with OAuth.
type Accounts ¶
type Accounts interface {
List(ctx context.Context, provider string) ([]Account, error)
StartLogin(ctx context.Context, provider string) (Login, error)
LoginStatus(ctx context.Context, state string) (LoginStatus, error)
CompleteLogin(ctx context.Context, state, redirectURL string) error
CancelLogin(ctx context.Context, state string) error
SetEnabled(ctx context.Context, id string, enabled bool) error
Delete(ctx context.Context, id string) error
ResetCooldown(ctx context.Context, id string) error
Import(ctx context.Context, provider string, credential []byte) (Account, error)
Pool(ctx context.Context) ([]accounts.PoolStatus, error)
SetPriority(ctx context.Context, id string, priority int) error
// Strategies lists every subscription provider's strategy, round-robin when none is set.
Strategies(ctx context.Context) (map[string]alias.Strategy, error)
// SetStrategy stores a provider's strategy and applies it; inside a Batch it joins the batch's transaction and
// Reconcile applies it after the commit.
SetStrategy(ctx context.Context, provider string, st alias.Strategy) error
Reconcile(ctx context.Context) error
}
Accounts manages subscription accounts (plan 03's accounts.Service).
func NewAccounts ¶
NewAccounts manages subscription accounts through plan 03's accounts service. Account ids are the store's integer ids as decimal strings; an id that is not one is not found.
type Aliases ¶
Aliases is config.Aliases.
func NewAliases ¶
func NewAliases(st *store.Store, rec *reconcile.Reconciler, cooling func() []cooling.Cooling) Aliases
NewAliases manages aliases in st through rec. cooling reports the members cooling now (the cooler's Snapshot); nil reports none.
type Deps ¶
type Deps struct {
Providers Providers
Accounts Accounts // plan 03's accounts.Service, through NewAccounts
Aliases Aliases
Keys Keys
Batch config.Batch // joins the writes of one remora.yaml apply; reconcile.Reconciler.Batch
System System
Names EngineNames
Stats StatsSource // the local request rollup
Logs LogSource // the front door's request log
Quota Quotas // subscription accounts' quota, through NewQuota
Tail *bifrost.Tail // the one poller following it, fanned out to live log viewers
Audit *store.Store
Auth *auth.Service
Log *slog.Logger
// contains filtered or unexported fields
}
Deps are the services the management API runs on. A nil port answers 501 not_implemented for the operations that need it (remora.yaml export, plan and apply need Providers, Aliases, Keys and Batch). Stats answers 503 when absent.
type EngineNames ¶
type EngineNames interface {
KeyByVK(ctx context.Context, vkID string) (keyID, keyName string, ok bool)
VKByKey(ctx context.Context, keyID string) (vkID string, ok bool)
AliasByRule(ctx context.Context, ruleID string) (string, bool)
RuleByAlias(ctx context.Context, name string) (string, bool)
Target(ctx context.Context, engineProvider, engineModel string) alias.Target
EngineFilter(ctx context.Context, provider, model string) (engineProviders, engineModels []string)
}
EngineNames translates between remora names and the front door's ids (Task 8 uses it for logs and stats).
func NewNames ¶
func NewNames(st *store.Store) EngineNames
NewNames translates engine ids with the ids the reconciler recorded in st.
type EngineVersion ¶
type EngineVersion struct{ Name, Version string }
EngineVersion names one engine and its release tag.
type HealthResponse ¶
type HealthResponse struct {
Status string `json:"status"` // "ok" | "degraded"
Down []string `json:"down,omitempty"` // neutral component names not up ("router", "accounts")
// AccountsOut counts enabled subscription accounts out of the pool. A count only: /healthz is public.
AccountsOut int `json:"accounts_out,omitempty"`
}
HealthResponse is the body of GET /healthz.
type LogSource ¶
type LogSource interface {
SearchLogs(ctx context.Context, f bifrost.LogFilter) (bifrost.LogPage, error)
GetLog(ctx context.Context, id string) (bifrost.Log, error)
LogStats(ctx context.Context, f bifrost.LogFilter) (bifrost.LogStats, error)
Histogram(ctx context.Context, f bifrost.LogFilter) ([]bifrost.HistogramBucket, error)
TokenHistogram(ctx context.Context, f bifrost.LogFilter) ([]bifrost.TokenBucket, error)
CostHistogram(ctx context.Context, f bifrost.LogFilter) ([]bifrost.CostBucket, error)
ModelUsage(ctx context.Context, f bifrost.LogFilter) ([]bifrost.ModelUsage, error)
LogModels(ctx context.Context, query string) ([]string, error)
}
LogSource reads the front door's request log; *bifrost.Client satisfies it.
type Login ¶
type Login struct{ State, URL, UserCode string }
Login is a started OAuth login: a URL to open, or a device code to enter.
type LoginStatus ¶
type LoginStatus struct{ Status, Message string }
LoginStatus is the state of a login: "wait" | "ok" | "error".
type ModelLister ¶ added in v0.1.5
type ModelLister interface {
ProviderModels(ctx context.Context, name string) ([]string, error)
RefreshProviderModels(ctx context.Context, name string) ([]bifrost.KeyStatus, error)
}
ModelLister reads and refreshes the front-door model catalog; *bifrost.Client satisfies it.
type PoolSource ¶ added in v0.2.1
type PoolSource interface {
Pool(ctx context.Context) ([]accounts.PoolStatus, error)
}
PoolSource reports the subscription account pool. *accounts.Service implements it.
type Providers ¶
type Providers interface {
config.Providers
Models(ctx context.Context, name string) ([]string, error)
}
Providers adds the model catalog read to the shared configuration port.
func NewProviders ¶
func NewProviders(st *store.Store, rec *reconcile.Reconciler, fd ModelLister, sx SonioxFiles) Providers
NewProviders manages providers in st through rec. A test lists models through fd, or, for a speech provider, lists its files through sx.
type Quotas ¶ added in v0.3.0
type Quotas interface {
Overview(ctx context.Context) ([]quota.ProviderView, error)
Refresh(ctx context.Context, accountID, provider string) (queued, skipped []string, err error)
}
Quotas reads subscription accounts' quota and queues checks. Account ids are decimal strings.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements the management API's strict server interface.
func (*Server) ApplyConfig ¶
func (s *Server) ApplyConfig(ctx context.Context, req gen.ApplyConfigRequestObject) (gen.ApplyConfigResponseObject, error)
ApplyConfig makes the store match a document and answers the changes made. When a change fails, nothing is changed and the error names the failed change. With a plan_hash that no longer matches, nothing is changed and the answer is 412 with the fresh plan.
func (*Server) CancelAccountLogin ¶
func (s *Server) CancelAccountLogin(ctx context.Context, req gen.CancelAccountLoginRequestObject) (gen.CancelAccountLoginResponseObject, error)
CancelAccountLogin cancels a login that has not finished.
func (*Server) ChangePassword ¶
func (s *Server) ChangePassword(ctx context.Context, req gen.ChangePasswordRequestObject) (gen.ChangePasswordResponseObject, error)
ChangePassword changes the admin password. Only a signed-in session may: an API token is refused with 403, so a leaked token cannot lock the admin out. Every other session is ended; the caller's stays valid.
func (*Server) CompileAlias ¶
func (s *Server) CompileAlias(ctx context.Context, req gen.CompileAliasRequestObject) (gen.CompileAliasResponseObject, error)
CompileAlias compiles an unsaved alias against the stored ones; nothing is stored.
func (*Server) CompleteAccountLogin ¶
func (s *Server) CompleteAccountLogin(ctx context.Context, req gen.CompleteAccountLoginRequestObject) (gen.CompleteAccountLoginResponseObject, error)
CompleteAccountLogin hands over the address the browser ended on after signing in. The address must be absolute and carry a code or an error; its state is optional, and the accounts service checks it against the login when it is there.
func (*Server) CreateAlias ¶
func (s *Server) CreateAlias(ctx context.Context, req gen.CreateAliasRequestObject) (gen.CreateAliasResponseObject, error)
CreateAlias creates an alias.
func (*Server) CreateApiToken ¶
func (s *Server) CreateApiToken(ctx context.Context, req gen.CreateApiTokenRequestObject) (gen.CreateApiTokenResponseObject, error)
CreateApiToken creates an API token; its value ("rmt_…") is answered only here.
func (*Server) CreateKey ¶
func (s *Server) CreateKey(ctx context.Context, req gen.CreateKeyRequestObject) (gen.CreateKeyResponseObject, error)
CreateKey creates a client key, with a generated value unless the caller chose one. The value is answered only here.
func (*Server) CreateProvider ¶
func (s *Server) CreateProvider(ctx context.Context, req gen.CreateProviderRequestObject) (gen.CreateProviderResponseObject, error)
CreateProvider creates a provider.
func (*Server) DeleteAccount ¶
func (s *Server) DeleteAccount(ctx context.Context, req gen.DeleteAccountRequestObject) (gen.DeleteAccountResponseObject, error)
DeleteAccount deletes an account and its sign-in.
func (*Server) DeleteAlias ¶
func (s *Server) DeleteAlias(ctx context.Context, req gen.DeleteAliasRequestObject) (gen.DeleteAliasResponseObject, error)
DeleteAlias deletes an alias.
func (*Server) DeleteApiToken ¶
func (s *Server) DeleteApiToken(ctx context.Context, req gen.DeleteApiTokenRequestObject) (gen.DeleteApiTokenResponseObject, error)
DeleteApiToken revokes an API token at once.
func (*Server) DeleteKey ¶
func (s *Server) DeleteKey(ctx context.Context, req gen.DeleteKeyRequestObject) (gen.DeleteKeyResponseObject, error)
DeleteKey deletes a client key.
func (*Server) DeleteProvider ¶
func (s *Server) DeleteProvider(ctx context.Context, req gen.DeleteProviderRequestObject) (gen.DeleteProviderResponseObject, error)
DeleteProvider deletes a provider.
func (*Server) ExportConfig ¶
func (s *Server) ExportConfig(ctx context.Context, _ gen.ExportConfigRequestObject) (gen.ExportConfigResponseObject, error)
ExportConfig answers the whole configuration as remora.yaml, secrets as env:NAME references.
func (*Server) GetAccountLogin ¶
func (s *Server) GetAccountLogin(ctx context.Context, req gen.GetAccountLoginRequestObject) (gen.GetAccountLoginResponseObject, error)
GetAccountLogin reports a login's progress.
func (*Server) GetAccountPool ¶ added in v0.2.1
func (s *Server) GetAccountPool(ctx context.Context, _ gen.GetAccountPoolRequestObject) (gen.GetAccountPoolResponseObject, error)
GetAccountPool reports, per subscription provider, the enabled accounts that dropped out of the pool.
func (*Server) GetAlias ¶
func (s *Server) GetAlias(ctx context.Context, req gen.GetAliasRequestObject) (gen.GetAliasResponseObject, error)
GetAlias returns an alias.
func (*Server) GetAliasChain ¶
func (s *Server) GetAliasChain(ctx context.Context, req gen.GetAliasChainRequestObject) (gen.GetAliasChainResponseObject, error)
GetAliasChain returns a stored alias's compiled chain, each cooling target with the time it cools down.
func (*Server) GetHealth ¶
func (s *Server) GetHealth(ctx context.Context, _ gen.GetHealthRequestObject) (gen.GetHealthResponseObject, error)
GetHealth reports remora's components by neutral name. It always answers 200; status says "degraded" when a component is down.
func (*Server) GetKey ¶
func (s *Server) GetKey(ctx context.Context, req gen.GetKeyRequestObject) (gen.GetKeyResponseObject, error)
GetKey returns a client key, without its value.
func (*Server) GetKeyUsage ¶
func (s *Server) GetKeyUsage(ctx context.Context, req gen.GetKeyUsageRequestObject) (gen.GetKeyUsageResponseObject, error)
GetKeyUsage answers one client key's stats over a time range. A key the front door has no virtual key for yet has seen no requests.
func (*Server) GetLog ¶
func (s *Server) GetLog(ctx context.Context, req gen.GetLogRequestObject) (gen.GetLogResponseObject, error)
GetLog answers one entry with its bodies and the request's whole fallback path, root first, whichever attempt is asked for.
func (*Server) GetProvider ¶
func (s *Server) GetProvider(ctx context.Context, req gen.GetProviderRequestObject) (gen.GetProviderResponseObject, error)
GetProvider returns a provider.
func (*Server) GetProviderModels ¶ added in v0.7.0
func (s *Server) GetProviderModels(ctx context.Context, req gen.GetProviderModelsRequestObject) (gen.GetProviderModelsResponseObject, error)
GetProviderModels returns known models with the provider name used by clients.
func (*Server) GetQuota ¶ added in v0.3.0
func (s *Server) GetQuota(ctx context.Context, req gen.GetQuotaRequestObject) (gen.GetQuotaResponseObject, error)
GetQuota returns a page of matching accounts under their full provider summaries.
func (*Server) GetSession ¶
func (s *Server) GetSession(ctx context.Context, _ gen.GetSessionRequestObject) (gen.GetSessionResponseObject, error)
GetSession reports how the caller is authenticated.
func (*Server) GetStats ¶
func (s *Server) GetStats(ctx context.Context, req gen.GetStatsRequestObject) (gen.GetStatsResponseObject, error)
GetStats answers volume, errors, latency, tokens and cost over a time range (the last 24 hours by default), optionally narrowed to a key, an alias or a provider and grouped by one of them.
func (*Server) GetVersion ¶
func (s *Server) GetVersion(ctx context.Context, _ gen.GetVersionRequestObject) (gen.GetVersionResponseObject, error)
GetVersion reports engine versions only to authenticated callers.
func (*Server) Handler ¶
Handler serves /api/* behind the CSRF, authentication and scope checks. Mount it at "/api/".
func (*Server) ImportAccount ¶
func (s *Server) ImportAccount(ctx context.Context, req gen.ImportAccountRequestObject) (gen.ImportAccountResponseObject, error)
ImportAccount adds an account from an existing OAuth credential file. The accounts service checks that the credential belongs to the provider; the credential itself is never answered.
func (*Server) ListAccountStrategies ¶ added in v0.3.0
func (s *Server) ListAccountStrategies(ctx context.Context, req gen.ListAccountStrategiesRequestObject) (gen.ListAccountStrategiesResponseObject, error)
ListAccountStrategies lists every subscription provider's strategy, sorted by provider.
func (*Server) ListAccounts ¶
func (s *Server) ListAccounts(ctx context.Context, req gen.ListAccountsRequestObject) (gen.ListAccountsResponseObject, error)
ListAccounts lists subscription accounts of one provider or all, searched by email, provider or status, one page at a time.
func (*Server) ListAliases ¶
func (s *Server) ListAliases(ctx context.Context, req gen.ListAliasesRequestObject) (gen.ListAliasesResponseObject, error)
ListAliases lists aliases, filtered by kind and a name search, one page at a time.
func (*Server) ListApiTokens ¶
func (s *Server) ListApiTokens(ctx context.Context, req gen.ListApiTokensRequestObject) (gen.ListApiTokensResponseObject, error)
ListApiTokens lists the API tokens, searched by name or prefix, one page at a time. Values are never shown.
func (*Server) ListAudit ¶ added in v0.7.0
func (s *Server) ListAudit(ctx context.Context, req gen.ListAuditRequestObject) (gen.ListAuditResponseObject, error)
ListAudit returns the audit trail without request or response bodies.
func (*Server) ListCooling ¶
func (s *Server) ListCooling(ctx context.Context, req gen.ListCoolingRequestObject) (gen.ListCoolingResponseObject, error)
ListCooling lists the cooling targets, each with the aliases whose chain reaches it, one page at a time. The search matches the provider, the model, "<provider>/<model>", the reason and the alias names.
func (*Server) ListKeys ¶
func (s *Server) ListKeys(ctx context.Context, req gen.ListKeysRequestObject) (gen.ListKeysResponseObject, error)
ListKeys lists client keys, searched by name or prefix, one page at a time.
func (*Server) ListLogs ¶
func (s *Server) ListLogs(ctx context.Context, req gen.ListLogsRequestObject) (gen.ListLogsResponseObject, error)
ListLogs lists request log entries, newest first, in remora's names. A key or alias the front door does not know matches nothing.
func (*Server) ListProviders ¶
func (s *Server) ListProviders(ctx context.Context, req gen.ListProvidersRequestObject) (gen.ListProvidersResponseObject, error)
ListProviders lists providers, filtered by kind, type and a name search, one page at a time.
func (*Server) Login ¶
func (s *Server) Login(ctx context.Context, req gen.LoginRequestObject) (gen.LoginResponseObject, error)
Login checks the admin password and sets the session cookie.
func (*Server) Logout ¶
func (s *Server) Logout(ctx context.Context, _ gen.LogoutRequestObject) (gen.LogoutResponseObject, error)
Logout ends the caller's session, if it has one, and clears the cookie.
func (*Server) PlanConfig ¶
func (s *Server) PlanConfig(ctx context.Context, req gen.PlanConfigRequestObject) (gen.PlanConfigResponseObject, error)
PlanConfig answers the changes a document would make; nothing is changed.
func (*Server) RefreshQuota ¶ added in v0.3.0
func (s *Server) RefreshQuota(ctx context.Context, req gen.RefreshQuotaRequestObject) (gen.RefreshQuotaResponseObject, error)
RefreshQuota queues quota checks of one account or one provider.
func (*Server) ResetAccountCooldown ¶
func (s *Server) ResetAccountCooldown(ctx context.Context, req gen.ResetAccountCooldownRequestObject) (gen.ResetAccountCooldownResponseObject, error)
ResetAccountCooldown clears an account's cooldown.
func (*Server) SetAccountStrategy ¶ added in v0.3.0
func (s *Server) SetAccountStrategy(ctx context.Context, req gen.SetAccountStrategyRequestObject) (gen.SetAccountStrategyResponseObject, error)
SetAccountStrategy sets a subscription provider's strategy.
func (*Server) StartAccountLogin ¶
func (s *Server) StartAccountLogin(ctx context.Context, req gen.StartAccountLoginRequestObject) (gen.StartAccountLoginResponseObject, error)
StartAccountLogin starts an OAuth login: a sign-in page to open, or with user_code a device code to enter there.
func (*Server) TestProvider ¶
func (s *Server) TestProvider(ctx context.Context, req gen.TestProviderRequestObject) (gen.TestProviderResponseObject, error)
TestProvider sends a small request to the provider and remembers whether it passed, for the provider's status. A failing upstream is a 200 answer with ok false; only a failure to run the test is an error.
func (*Server) UpdateAccount ¶
func (s *Server) UpdateAccount(ctx context.Context, req gen.UpdateAccountRequestObject) (gen.UpdateAccountResponseObject, error)
UpdateAccount enables or disables an account, or sets its priority, and answers it as it now is. Only the fields the body names change.
func (*Server) UpdateAlias ¶
func (s *Server) UpdateAlias(ctx context.Context, req gen.UpdateAliasRequestObject) (gen.UpdateAliasResponseObject, error)
UpdateAlias replaces an alias. An alias cannot be renamed.
func (*Server) UpdateKey ¶
func (s *Server) UpdateKey(ctx context.Context, req gen.UpdateKeyRequestObject) (gen.UpdateKeyResponseObject, error)
UpdateKey renames a key, replaces its allowlist or enables or disables it; fields left out are kept. An empty allowlist denies everything.
func (*Server) UpdateProvider ¶
func (s *Server) UpdateProvider(ctx context.Context, req gen.UpdateProviderRequestObject) (gen.UpdateProviderResponseObject, error)
UpdateProvider replaces a provider. Keys sent without a value keep their stored secret; no keys keep them all.
type SonioxFiles ¶ added in v0.1.5
SonioxFiles lists a Soniox account's files; *soniox.Client satisfies it.
type StatsSource ¶ added in v0.7.2
type StatsSource interface {
Query(ctx context.Context, from, to time.Time, bucketSec int64, filter func(stats.Dimensions) bool, groups ...func(stats.Dimensions) bool) (stats.Result, error)
ModelPairs(ctx context.Context, from, to time.Time, filter func(stats.Dimensions) bool) ([]stats.ModelPair, error)
}
StatsSource reads the local request rollup.
type StatusSource ¶
type StatusSource interface {
Status() []supervise.EngineStatus
}
StatusSource reports the supervised engines. *supervise.Supervisor implements it.
type System ¶
type System interface {
Health(ctx context.Context) (ok bool, engines map[string]error)
Version() (remora string, engines []EngineVersion)
}
System reports health and versions. Health names components neutrally; Version lists engines by their own names, in start order (engine names appear only there and in the credits).
func NewSystem ¶
func NewSystem(src StatusSource) System
NewSystem reports health and versions from the supervisor.