Documentation
¶
Index ¶
- func ActorFrom(ctx context.Context) string
- func WithActor(ctx context.Context, userID string) context.Context
- type AuthFeatures
- type AuthService
- func (a *AuthService) AppSSOCallbackURL(token, returnTo, errMsg string) string
- func (a *AuthService) BeginSSO(ctx context.Context, providerID, returnTo string) (authURL string, err error)
- func (a *AuthService) CompleteSSO(ctx context.Context, providerID, code, state string) (*CompleteSSOResult, error)
- func (a *AuthService) ConfirmPasswordReset(ctx context.Context, rawToken, password string) (token string, user *identity.User, err error)
- func (a *AuthService) Features() AuthFeatures
- func (a *AuthService) ListSSOProviders() []SSOProviderInfo
- func (a *AuthService) LoginWithPassword(ctx context.Context, email, password string) (string, error)
- func (a *AuthService) Register(ctx context.Context, email, name, password string) (token string, user *identity.User, err error)
- func (a *AuthService) RequestPasswordReset(ctx context.Context, email string) (rawToken string, err error)
- func (a *AuthService) SSOMetadataXML(providerID string) ([]byte, error)
- type Bus
- type CompleteSSOResult
- type ConfigAPI
- type Event
- type EventEnqueuer
- type EventName
- type EventRecorder
- type Handler
- type MemoryRecorder
- type MultiRecorder
- type NopRecorder
- type SSOProviderInfo
- type Service
- func (s *Service) AcceptOrgInvite(ctx context.Context, rawToken, name, passwordHash string) (*tenancy.OrgMember, *identity.User, error)
- func (s *Service) AddTeamMember(ctx context.Context, teamID, userID string) (*tenancy.TeamMember, error)
- func (s *Service) AssignCredential(ctx context.Context, credentialID, scopeType, scopeID, createdBy string) (*credentials.Assignment, error)
- func (s *Service) AuthenticateDeploymentJoinToken(ctx context.Context, rawToken string) (*regions.GatewayDeployment, error)
- func (s *Service) AuthenticateFederationPeerToken(ctx context.Context, rawToken string) (*federation.ControlPlanePeer, error)
- func (s *Service) BindAllOrgsToRegion(ctx context.Context, regionID string) (int, error)
- func (s *Service) BindOrgToRegion(ctx context.Context, regionID, orgID, status string) (*regions.OrgRegionMembership, error)
- func (s *Service) CreateA2AAgent(ctx context.Context, ...) (*gatewayconfig.A2AAgent, error)
- func (s *Service) CreateAPIKey(ctx context.Context, ...) (*access.APIKey, error)
- func (s *Service) CreateCredential(ctx context.Context, ...) (*credentials.Credential, error)
- func (s *Service) CreateEnvironment(ctx context.Context, orgID, projectID, name, slug string) (*tenancy.Environment, error)
- func (s *Service) CreateMCPBackend(ctx context.Context, orgID, alias, name, baseURL, apiKeyEnv string, ...) (*gatewayconfig.MCPBackend, error)
- func (s *Service) CreateOrganization(ctx context.Context, name, creatorUserID string) (*tenancy.Organization, error)
- func (s *Service) CreatePolicy(ctx context.Context, orgID, name, expression string, ...) (*gatewayconfig.RequestPolicy, error)
- func (s *Service) CreateProject(ctx context.Context, orgID, teamID, name string) (*tenancy.Project, error)
- func (s *Service) CreateProvider(ctx context.Context, orgID, name, typ, baseURL, apiKeyEnv string, ...) (*gatewayconfig.Provider, error)
- func (s *Service) CreateQuota(ctx context.Context, orgID, scopeType, scopeID, metric string, ...) (*gatewayconfig.Quota, error)
- func (s *Service) CreateRegion(ctx context.Context, slug, name string) (*regions.Region, error)
- func (s *Service) CreateRoute(ctx context.Context, orgID, model, providerID, targetModel string, ...) (*gatewayconfig.Route, error)
- func (s *Service) CreateSigningKey(ctx context.Context, ...) (*access.SigningKey, error)
- func (s *Service) CreateTeam(ctx context.Context, orgID, name, creatorUserID string) (*tenancy.Team, error)
- func (s *Service) CreateWasmHook(ctx context.Context, orgID, name, phase, moduleURI, digest string, ...) (*gatewayconfig.WasmHook, error)
- func (s *Service) DeleteA2AAgent(ctx context.Context, id string) error
- func (s *Service) DeleteAPIKey(ctx context.Context, keyID string) error
- func (s *Service) DeleteCredential(ctx context.Context, credentialID string) error
- func (s *Service) DeleteCredentialAssignment(ctx context.Context, assignmentID string) error
- func (s *Service) DeleteEnvironment(ctx context.Context, environmentID string) error
- func (s *Service) DeleteMCPBackend(ctx context.Context, id string) error
- func (s *Service) DeletePolicy(ctx context.Context, policyID string) error
- func (s *Service) DeleteProvider(ctx context.Context, providerID string) error
- func (s *Service) DeleteQuota(ctx context.Context, quotaID string) error
- func (s *Service) DeleteRegionOverlay(ctx context.Context, regionID, orgID string) error
- func (s *Service) DeleteRoute(ctx context.Context, routeID string) error
- func (s *Service) DeleteSigningKey(ctx context.Context, id string) error
- func (s *Service) DeleteWasmHook(ctx context.Context, id string) error
- func (s *Service) ExportFederationRegion(ctx context.Context, slug string, since int64, objectPrefix string) (*federation.RegionExport, error)
- func (s *Service) GetDeployment(ctx context.Context, deploymentID string) (*regions.GatewayDeployment, error)
- func (s *Service) GetEnvironment(ctx context.Context, environmentID string) (*tenancy.Environment, error)
- func (s *Service) GetFederationPeer(ctx context.Context, peerID string) (*federation.ControlPlanePeer, error)
- func (s *Service) GetOrgDefaultRetry(ctx context.Context, orgID string) (*gatewayconfig.RetryConfig, error)
- func (s *Service) GetOrgObjectStore(ctx context.Context, orgID string) (*gatewayconfig.ObjectStoreConfig, error)
- func (s *Service) GetRegion(ctx context.Context, regionID string) (*regions.Region, error)
- func (s *Service) GetRegionOverlay(ctx context.Context, regionID, orgID string) (*regions.RegionConfigOverlay, error)
- func (s *Service) GetTeam(ctx context.Context, teamID string) (*tenancy.Team, error)
- func (s *Service) InviteOrgMember(ctx context.Context, orgID, email, invitedByUserID string) (*tenancy.InviteOutcome, string, error)
- func (s *Service) JoinFederationPeer(ctx context.Context, rawToken string) (*federation.ControlPlanePeer, error)
- func (s *Service) ListA2AAgents(ctx context.Context, orgID string) ([]gatewayconfig.A2AAgent, error)
- func (s *Service) ListAPIKeys(ctx context.Context, projectID string) ([]access.APIKey, error)
- func (s *Service) ListAudit(ctx context.Context, orgID string, f audit.Filter) ([]audit.Record, error)
- func (s *Service) ListCredentialAssignments(ctx context.Context, orgID string) ([]credentials.Assignment, error)
- func (s *Service) ListCredentials(ctx context.Context, orgID string) ([]credentials.Credential, error)
- func (s *Service) ListDeployments(ctx context.Context, regionID string) ([]regions.GatewayDeployment, error)
- func (s *Service) ListEnvironments(ctx context.Context, projectID string) ([]tenancy.Environment, error)
- func (s *Service) ListFederationPeers(ctx context.Context) ([]federation.ControlPlanePeer, error)
- func (s *Service) ListFederationUsageReports(ctx context.Context, orgID string, since, until *time.Time, limit int) ([]usage.Record, error)
- func (s *Service) ListMCPBackends(ctx context.Context, orgID string) ([]gatewayconfig.MCPBackend, error)
- func (s *Service) ListOrgInvites(ctx context.Context, orgID string) ([]tenancy.OrgInvite, error)
- func (s *Service) ListOrgMembers(ctx context.Context, orgID string) ([]tenancy.OrgMember, error)
- func (s *Service) ListOrganizationsForUser(ctx context.Context, userID string) ([]tenancy.Organization, error)
- func (s *Service) ListPolicies(ctx context.Context, orgID string) ([]gatewayconfig.RequestPolicy, error)
- func (s *Service) ListProjects(ctx context.Context, orgID, userID string) ([]tenancy.Project, error)
- func (s *Service) ListProviderHealth(ctx context.Context, orgID string, from, to time.Time) ([]usage.ProviderHealth, error)
- func (s *Service) ListProviders(ctx context.Context, orgID string) ([]gatewayconfig.Provider, error)
- func (s *Service) ListQuotas(ctx context.Context, orgID string) ([]gatewayconfig.Quota, error)
- func (s *Service) ListRegionMemberships(ctx context.Context, regionID string) ([]regions.OrgRegionMembership, error)
- func (s *Service) ListRegions(ctx context.Context) ([]regions.Region, error)
- func (s *Service) ListRoutes(ctx context.Context, orgID string) ([]gatewayconfig.Route, error)
- func (s *Service) ListSigningKeys(ctx context.Context, orgID string) ([]access.SigningKey, error)
- func (s *Service) ListTeamMembers(ctx context.Context, teamID string) ([]tenancy.TeamMember, error)
- func (s *Service) ListTeams(ctx context.Context, orgID, userID string) ([]tenancy.Team, error)
- func (s *Service) ListUsage(ctx context.Context, orgID string, f usage.Filter) ([]usage.Record, error)
- func (s *Service) ListVisibleOrgAPIKeys(ctx context.Context, orgID, viewerUserID string, viewerIsAdmin bool) ([]access.APIKey, error)
- func (s *Service) ListWasmHooks(ctx context.Context, orgID string) ([]gatewayconfig.WasmHook, error)
- func (s *Service) OpenFederationPeerJoinToken(ctx context.Context, peerID string) (string, error)
- func (s *Service) PreviewOrgInvite(ctx context.Context, rawToken string) (*tenancy.InvitePreview, error)
- func (s *Service) PublishSnapshot(ctx context.Context) error
- func (s *Service) PutRegionOverlay(ctx context.Context, regionID, orgID string, payload regions.OverlayPayload) (*regions.RegionConfigOverlay, error)
- func (s *Service) RecordDeploymentHeartbeat(ctx context.Context, deploymentID, joinToken string, snapVersion int64, ...) (*regions.GatewayDeployment, error)
- func (s *Service) RecordFederationPeerSync(ctx context.Context, peerID string, cursor int64, syncErr string) error
- func (s *Service) RegisterDeployment(ctx context.Context, regionID, name, publicBaseURL string) (*regions.DeploymentWithToken, error)
- func (s *Service) RegisterFederationPeer(ctx context.Context, name, regionID, baseURL string) (*federation.PeerWithToken, error)
- func (s *Service) RemoveTeamMember(ctx context.Context, teamID, userID string) error
- func (s *Service) ReorderPolicies(ctx context.Context, orgID string, items []gatewayconfig.PolicyPriorityUpdate) error
- func (s *Service) ResendOrgInvite(ctx context.Context, orgID, inviteID string) (*tenancy.OrgInvite, string, error)
- func (s *Service) RevokeOrgInvite(ctx context.Context, orgID, inviteID string) error
- func (s *Service) RotateCredential(ctx context.Context, credentialID, secretRef, secretValue string) (*credentials.Credential, error)
- func (s *Service) RotateDeploymentJoinToken(ctx context.Context, deploymentID string) (*regions.DeploymentWithToken, error)
- func (s *Service) RotateFederationPeerJoinToken(ctx context.Context, peerID string) (*federation.PeerWithToken, error)
- func (s *Service) RotateSigningKey(ctx context.Context, id, publicKeyPEM string) (*access.SigningKey, error)
- func (s *Service) SetOrgDefaultRetry(ctx context.Context, orgID string, retry *gatewayconfig.RetryConfig) (*gatewayconfig.RetryConfig, error)
- func (s *Service) SetOrgObjectStore(ctx context.Context, orgID string, cfg *gatewayconfig.ObjectStoreConfig) (*gatewayconfig.ObjectStoreConfig, error)
- func (s *Service) SummarizeUsage(ctx context.Context, orgID string, f usage.Filter) ([]usage.SummaryBucket, error)
- func (s *Service) UnbindOrgFromRegion(ctx context.Context, regionID, orgID string) error
- func (s *Service) UpdateA2AAgent(ctx context.Context, id string, ...) (*gatewayconfig.A2AAgent, error)
- func (s *Service) UpdateCredential(ctx context.Context, credentialID, name, status string) (*credentials.Credential, error)
- func (s *Service) UpdateFederationPeer(ctx context.Context, peerID, name, baseURL, status string) (*federation.ControlPlanePeer, error)
- func (s *Service) UpdateMCPBackend(ctx context.Context, id string, alias, name, baseURL, apiKeyEnv *string, ...) (*gatewayconfig.MCPBackend, error)
- func (s *Service) UpdateOrgMemberRole(ctx context.Context, orgID, actorUserID, targetUserID, role string) (*tenancy.OrgMember, error)
- func (s *Service) UpdatePolicy(ctx context.Context, policyID string, name, expression *string, ...) (*gatewayconfig.RequestPolicy, error)
- func (s *Service) UpdateProvider(ctx context.Context, providerID, name, baseURL, apiKeyEnv string, ...) (*gatewayconfig.Provider, error)
- func (s *Service) UpdateQuota(ctx context.Context, quotaID string, limitValue int64) (*gatewayconfig.Quota, error)
- func (s *Service) UpdateRegion(ctx context.Context, regionID, name, status string) (*regions.Region, error)
- func (s *Service) UpdateRoute(ctx context.Context, routeID, model, providerID, targetModel string, ...) (*gatewayconfig.Route, error)
- func (s *Service) UpdateSigningKey(ctx context.Context, id, name, status string) (*access.SigningKey, error)
- func (s *Service) UpdateTeamMemberRole(ctx context.Context, teamID, actorUserID, targetUserID, role string) (*tenancy.TeamMember, error)
- func (s *Service) UpdateWasmHook(ctx context.Context, id string, name, phase, moduleURI, digest *string, ...) (*gatewayconfig.WasmHook, error)
- type SnapshotPublisher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthFeatures ¶
type AuthFeatures struct {
SignupEnabled bool `json:"signup_enabled"`
PasswordResetEnabled bool `json:"password_reset_enabled"`
}
AuthFeatures describes public auth capabilities for the login UI.
type AuthService ¶
type AuthService struct {
Users identity.UserRepository
Identities identity.ExternalIdentityRepository
Resets identity.PasswordResetRepository
Tokens identity.TokenIssuer
Passwords identity.PasswordHasher
States identity.SSOStateStore
Providers map[string]identity.FederationProvider
SSOEnabled bool
SignupEnabled bool
// PublicBaseURL is the control-plane base URL used for OAuth callbacks.
PublicBaseURL string
// AppBaseURL is the web UI base URL used after SSO callback redirect.
AppBaseURL string
NewUserID func() string
NewLinkID func() string
NewResetID func() string
Now func() time.Time
}
AuthService orchestrates password and SSO platform AuthN.
func (*AuthService) AppSSOCallbackURL ¶
func (a *AuthService) AppSSOCallbackURL(token, returnTo, errMsg string) string
AppSSOCallbackURL builds the web UI URL that receives the session token.
func (*AuthService) BeginSSO ¶
func (a *AuthService) BeginSSO(ctx context.Context, providerID, returnTo string) (authURL string, err error)
BeginSSO starts an OAuth/OIDC/SAML login and returns the IdP redirect URL.
func (*AuthService) CompleteSSO ¶
func (a *AuthService) CompleteSSO(ctx context.Context, providerID, code, state string) (*CompleteSSOResult, error)
CompleteSSO finishes OAuth/OIDC/SAML login, JIT-provisions the user, and issues a JWT.
func (*AuthService) ConfirmPasswordReset ¶
func (a *AuthService) ConfirmPasswordReset(ctx context.Context, rawToken, password string) (token string, user *identity.User, err error)
ConfirmPasswordReset consumes a reset token, sets the new password, and issues a JWT.
func (*AuthService) Features ¶
func (a *AuthService) Features() AuthFeatures
Features returns public auth capability flags for the UI.
func (*AuthService) ListSSOProviders ¶
func (a *AuthService) ListSSOProviders() []SSOProviderInfo
ListSSOProviders returns enabled SSO providers for the login UI.
func (*AuthService) LoginWithPassword ¶
func (a *AuthService) LoginWithPassword(ctx context.Context, email, password string) (string, error)
LoginWithPassword authenticates a local user and returns a session JWT.
func (*AuthService) Register ¶
func (a *AuthService) Register(ctx context.Context, email, name, password string) (token string, user *identity.User, err error)
Register creates a local password user and returns a session JWT.
func (*AuthService) RequestPasswordReset ¶
func (a *AuthService) RequestPasswordReset(ctx context.Context, email string) (rawToken string, err error)
RequestPasswordReset creates a reset token for the user when the email exists. Returns an empty rawToken (and nil error) when the email is unknown — anti-enumeration.
func (*AuthService) SSOMetadataXML ¶
func (a *AuthService) SSOMetadataXML(providerID string) ([]byte, error)
SSOMetadataXML returns SP metadata for a SAML provider, or ErrUnknownProvider / not supported.
type Bus ¶
type Bus struct {
// contains filtered or unexported fields
}
Bus is an in-process pub/sub domain event bus. It implements EventRecorder and fans each event to matching subscribers.
func (*Bus) Record ¶
Record publishes an event to matching subscribers (specific name + EventAll). Subscriber panics are recovered so one bad handler cannot break the bus.
func (*Bus) Subscribe ¶
Subscribe registers a handler for a specific event name. Use EventAll to receive every event.
func (*Bus) SubscribeAll ¶
SubscribeAll is shorthand for Subscribe(EventAll, h).
type CompleteSSOResult ¶
CompleteSSOResult is returned after a successful federated login.
type ConfigAPI ¶
type ConfigAPI interface {
ListOrganizationsForUser(ctx context.Context, userID string) ([]tenancy.Organization, error)
CreateOrganization(ctx context.Context, name, creatorUserID string) (*tenancy.Organization, error)
ListOrgMembers(ctx context.Context, orgID string) ([]tenancy.OrgMember, error)
UpdateOrgMemberRole(ctx context.Context, orgID, actorUserID, targetUserID, role string) (*tenancy.OrgMember, error)
InviteOrgMember(ctx context.Context, orgID, email, invitedByUserID string) (*tenancy.InviteOutcome, string, error)
ListOrgInvites(ctx context.Context, orgID string) ([]tenancy.OrgInvite, error)
RevokeOrgInvite(ctx context.Context, orgID, inviteID string) error
ResendOrgInvite(ctx context.Context, orgID, inviteID string) (*tenancy.OrgInvite, string, error)
PreviewOrgInvite(ctx context.Context, rawToken string) (*tenancy.InvitePreview, error)
AcceptOrgInvite(ctx context.Context, rawToken, name, passwordHash string) (*tenancy.OrgMember, *identity.User, error)
ListTeams(ctx context.Context, orgID, userID string) ([]tenancy.Team, error)
CreateTeam(ctx context.Context, orgID, name, creatorUserID string) (*tenancy.Team, error)
GetTeam(ctx context.Context, teamID string) (*tenancy.Team, error)
ListTeamMembers(ctx context.Context, teamID string) ([]tenancy.TeamMember, error)
AddTeamMember(ctx context.Context, teamID, userID string) (*tenancy.TeamMember, error)
UpdateTeamMemberRole(ctx context.Context, teamID, actorUserID, targetUserID, role string) (*tenancy.TeamMember, error)
RemoveTeamMember(ctx context.Context, teamID, userID string) error
ListProjects(ctx context.Context, orgID, userID string) ([]tenancy.Project, error)
CreateProject(ctx context.Context, orgID, teamID, name string) (*tenancy.Project, error)
ListEnvironments(ctx context.Context, projectID string) ([]tenancy.Environment, error)
GetEnvironment(ctx context.Context, environmentID string) (*tenancy.Environment, error)
CreateEnvironment(ctx context.Context, orgID, projectID, name, slug string) (*tenancy.Environment, error)
DeleteEnvironment(ctx context.Context, environmentID string) error
GetEnvironmentOrgID(ctx context.Context, environmentID string) (string, error)
ListAPIKeys(ctx context.Context, projectID string) ([]access.APIKey, error)
ListOrgAPIKeys(ctx context.Context, orgID string) ([]access.APIKey, error)
CreateAPIKey(ctx context.Context, orgID, kind, ownerUserID, projectID, environmentID, name, rawKey string) (*access.APIKey, error)
GetAPIKeyOrgID(ctx context.Context, keyID string) (string, error)
DeleteAPIKey(ctx context.Context, keyID string) error
ListSigningKeys(ctx context.Context, orgID string) ([]access.SigningKey, error)
CreateSigningKey(ctx context.Context, orgID, keyID, projectID, environmentID, name, algorithm, publicKeyPEM string) (*access.SigningKey, error)
UpdateSigningKey(ctx context.Context, id, name, status string) (*access.SigningKey, error)
RotateSigningKey(ctx context.Context, id, publicKeyPEM string) (*access.SigningKey, error)
GetSigningKeyOrgID(ctx context.Context, id string) (string, error)
DeleteSigningKey(ctx context.Context, id string) error
ListProviders(ctx context.Context, orgID string) ([]gatewayconfig.Provider, error)
ListProviderHealth(ctx context.Context, orgID string, from, to time.Time) ([]usage.ProviderHealth, error)
CreateProvider(ctx context.Context, orgID, name, typ, baseURL, apiKeyEnv string, caps snapshot.ProviderCapabilities, config json.RawMessage) (*gatewayconfig.Provider, error)
UpdateProvider(ctx context.Context, providerID, name, baseURL, apiKeyEnv string, config *json.RawMessage) (*gatewayconfig.Provider, error)
GetProviderOrgID(ctx context.Context, providerID string) (string, error)
DeleteProvider(ctx context.Context, providerID string) error
ListRoutes(ctx context.Context, orgID string) ([]gatewayconfig.Route, error)
CreateRoute(ctx context.Context, orgID, model, providerID, targetModel string, fallbacks []gatewayconfig.RouteFallback, retry *gatewayconfig.RetryConfig, strategy string, weight int) (*gatewayconfig.Route, error)
UpdateRoute(ctx context.Context, routeID, model, providerID, targetModel string, fallbacks []gatewayconfig.RouteFallback, retry *gatewayconfig.RetryConfig, strategy string, weight int) (*gatewayconfig.Route, error)
GetRouteOrgID(ctx context.Context, routeID string) (string, error)
DeleteRoute(ctx context.Context, routeID string) error
GetOrgDefaultRetry(ctx context.Context, orgID string) (*gatewayconfig.RetryConfig, error)
SetOrgDefaultRetry(ctx context.Context, orgID string, retry *gatewayconfig.RetryConfig) error
GetOrgObjectStore(ctx context.Context, orgID string) (*gatewayconfig.ObjectStoreConfig, error)
SetOrgObjectStore(ctx context.Context, orgID string, cfg *gatewayconfig.ObjectStoreConfig) error
ListUsage(ctx context.Context, orgID string, f usage.Filter) ([]usage.Record, error)
SummarizeUsage(ctx context.Context, orgID string, f usage.Filter) ([]usage.SummaryBucket, error)
ListAudit(ctx context.Context, orgID string, f audit.Filter) ([]audit.Record, error)
ListQuotas(ctx context.Context, orgID string) ([]gatewayconfig.Quota, error)
CreateQuota(ctx context.Context, orgID, scopeType, scopeID, metric string, limitValue int64, window string) (*gatewayconfig.Quota, error)
UpdateQuota(ctx context.Context, quotaID string, limitValue int64) (*gatewayconfig.Quota, error)
GetQuotaOrgID(ctx context.Context, quotaID string) (string, error)
DeleteQuota(ctx context.Context, quotaID string) error
ListPolicies(ctx context.Context, orgID string) ([]gatewayconfig.RequestPolicy, error)
CreatePolicy(ctx context.Context, orgID, name, expression string, actions []gatewayconfig.PolicyAction, enabled bool, priority int) (*gatewayconfig.RequestPolicy, error)
UpdatePolicy(ctx context.Context, policyID string, name, expression *string, actions []gatewayconfig.PolicyAction, enabled *bool, priority *int) (*gatewayconfig.RequestPolicy, error)
ReorderPolicies(ctx context.Context, orgID string, items []gatewayconfig.PolicyPriorityUpdate) error
GetPolicyOrgID(ctx context.Context, policyID string) (string, error)
DeletePolicy(ctx context.Context, policyID string) error
ListWasmHooks(ctx context.Context, orgID string) ([]gatewayconfig.WasmHook, error)
CreateWasmHook(ctx context.Context, orgID, name, phase, moduleURI, digest string, enabled bool, priority int, config []byte) (*gatewayconfig.WasmHook, error)
UpdateWasmHook(ctx context.Context, id string, name, phase, moduleURI, digest *string, enabled *bool, priority *int, config []byte) (*gatewayconfig.WasmHook, error)
GetWasmHookOrgID(ctx context.Context, id string) (string, error)
DeleteWasmHook(ctx context.Context, id string) error
ListMCPBackends(ctx context.Context, orgID string) ([]gatewayconfig.MCPBackend, error)
CreateMCPBackend(ctx context.Context, orgID, alias, name, baseURL, apiKeyEnv string, methodAllowlist []byte, enabled bool) (*gatewayconfig.MCPBackend, error)
UpdateMCPBackend(ctx context.Context, id string, alias, name, baseURL, apiKeyEnv *string, methodAllowlist []byte, enabled *bool) (*gatewayconfig.MCPBackend, error)
GetMCPBackendOrgID(ctx context.Context, id string) (string, error)
DeleteMCPBackend(ctx context.Context, id string) error
ListA2AAgents(ctx context.Context, orgID string) ([]gatewayconfig.A2AAgent, error)
CreateA2AAgent(ctx context.Context, orgID, alias, name, upstreamURL, cardURL, apiKeyEnv, authScheme string, cardCache []byte, enabled bool) (*gatewayconfig.A2AAgent, error)
UpdateA2AAgent(ctx context.Context, id string, alias, name, upstreamURL, cardURL, apiKeyEnv, authScheme *string, cardCache []byte, enabled *bool) (*gatewayconfig.A2AAgent, error)
GetA2AAgentOrgID(ctx context.Context, id string) (string, error)
DeleteA2AAgent(ctx context.Context, id string) error
ListCredentials(ctx context.Context, orgID string) ([]credentials.Credential, error)
CreateCredential(ctx context.Context, orgID, name, providerType, storageKind, secretRef, secretValue string) (*credentials.Credential, error)
UpdateCredential(ctx context.Context, credentialID, name, status string) (*credentials.Credential, error)
RotateCredential(ctx context.Context, credentialID, secretRef, secretValue string) (*credentials.Credential, error)
GetCredentialOrgID(ctx context.Context, credentialID string) (string, error)
DeleteCredential(ctx context.Context, credentialID string) error
ListCredentialAssignments(ctx context.Context, orgID string) ([]credentials.Assignment, error)
AssignCredential(ctx context.Context, credentialID, scopeType, scopeID, createdBy string) (*credentials.Assignment, error)
GetCredentialAssignmentOrgID(ctx context.Context, assignmentID string) (string, error)
DeleteCredentialAssignment(ctx context.Context, assignmentID string) error
ListRegions(ctx context.Context) ([]regions.Region, error)
GetRegion(ctx context.Context, regionID string) (*regions.Region, error)
CreateRegion(ctx context.Context, slug, name string) (*regions.Region, error)
UpdateRegion(ctx context.Context, regionID, name, status string) (*regions.Region, error)
ListDeployments(ctx context.Context, regionID string) ([]regions.GatewayDeployment, error)
GetDeployment(ctx context.Context, deploymentID string) (*regions.GatewayDeployment, error)
RegisterDeployment(ctx context.Context, regionID, name, publicBaseURL string) (*regions.DeploymentWithToken, error)
RotateDeploymentJoinToken(ctx context.Context, deploymentID string) (*regions.DeploymentWithToken, error)
RecordDeploymentHeartbeat(ctx context.Context, deploymentID, joinToken string, snapVersion int64, build string) (*regions.GatewayDeployment, error)
AuthenticateDeploymentJoinToken(ctx context.Context, rawToken string) (*regions.GatewayDeployment, error)
ListRegionMemberships(ctx context.Context, regionID string) ([]regions.OrgRegionMembership, error)
BindOrgToRegion(ctx context.Context, regionID, orgID, status string) (*regions.OrgRegionMembership, error)
BindAllOrgsToRegion(ctx context.Context, regionID string) (int, error)
UnbindOrgFromRegion(ctx context.Context, regionID, orgID string) error
GetRegionOverlay(ctx context.Context, regionID, orgID string) (*regions.RegionConfigOverlay, error)
PutRegionOverlay(ctx context.Context, regionID, orgID string, payload regions.OverlayPayload) (*regions.RegionConfigOverlay, error)
DeleteRegionOverlay(ctx context.Context, regionID, orgID string) error
ListFederationPeers(ctx context.Context) ([]federation.ControlPlanePeer, error)
GetFederationPeer(ctx context.Context, peerID string) (*federation.ControlPlanePeer, error)
RegisterFederationPeer(ctx context.Context, name, regionID, baseURL string) (*federation.PeerWithToken, error)
UpdateFederationPeer(ctx context.Context, peerID, name, baseURL, status string) (*federation.ControlPlanePeer, error)
RotateFederationPeerJoinToken(ctx context.Context, peerID string) (*federation.PeerWithToken, error)
AuthenticateFederationPeerToken(ctx context.Context, rawToken string) (*federation.ControlPlanePeer, error)
JoinFederationPeer(ctx context.Context, rawToken string) (*federation.ControlPlanePeer, error)
ExportFederationRegion(ctx context.Context, slug string, since int64, objectPrefix string) (*federation.RegionExport, error)
RecordFederationPeerSync(ctx context.Context, peerID string, cursor int64, syncErr string) error
ListFederationUsageReports(ctx context.Context, orgID string, since, until *time.Time, limit int) ([]usage.Record, error)
OpenFederationPeerJoinToken(ctx context.Context, peerID string) (string, error)
}
ConfigAPI is the persistence surface for platform reads and mutations.
type Event ¶
type Event struct {
ID string `json:"id"`
Name EventName `json:"name"`
ResourceID string `json:"resource_id,omitempty"`
OrganizationID string `json:"organization_id,omitempty"`
ActorUserID string `json:"actor_user_id,omitempty"`
At time.Time `json:"at"`
Meta map[string]string `json:"meta,omitempty"`
}
Event is a domain event emitted after successful platform work.
type EventEnqueuer ¶
EventEnqueuer persists platform events for durable cross-process delivery.
type EventName ¶
type EventName string
EventName identifies a platform domain event.
const ( EventOrgCreated EventName = "org.created" EventMemberAdded EventName = "member.added" EventMemberRoleUpdated EventName = "member.role_updated" EventInviteCreated EventName = "invite.created" EventInviteRevoked EventName = "invite.revoked" EventInviteResent EventName = "invite.resent" EventInviteAccepted EventName = "invite.accepted" EventTeamCreated EventName = "team.created" EventTeamMemberAdded EventName = "team.member_added" EventTeamMemberRoleUpdated EventName = "team.member_role_updated" EventTeamMemberRemoved EventName = "team.member_removed" EventProjectCreated EventName = "project.created" EventEnvironmentCreated EventName = "environment.created" EventEnvironmentDeleted EventName = "environment.deleted" EventAPIKeyCreated EventName = "api_key.created" EventAPIKeyDeleted EventName = "api_key.deleted" EventSigningKeyCreated EventName = "signing_key.created" EventSigningKeyUpdated EventName = "signing_key.updated" EventSigningKeyRotated EventName = "signing_key.rotated" EventSigningKeyDeleted EventName = "signing_key.deleted" EventProviderCreated EventName = "provider.created" EventProviderUpdated EventName = "provider.updated" EventProviderDeleted EventName = "provider.deleted" EventRouteCreated EventName = "route.created" EventRouteUpdated EventName = "route.updated" EventRouteDeleted EventName = "route.deleted" EventOrgDefaultRetryUpdated EventName = "org.default_retry.updated" EventOrgObjectStoreUpdated EventName = "org.object_store.updated" EventQuotaCreated EventName = "quota.created" EventQuotaUpdated EventName = "quota.updated" EventQuotaDeleted EventName = "quota.deleted" EventPolicyCreated EventName = "policy.created" EventPolicyUpdated EventName = "policy.updated" EventPolicyDeleted EventName = "policy.deleted" EventWasmHookCreated EventName = "wasm_hook.created" EventWasmHookUpdated EventName = "wasm_hook.updated" EventWasmHookDeleted EventName = "wasm_hook.deleted" EventMCPBackendCreated EventName = "mcp_backend.created" EventMCPBackendUpdated EventName = "mcp_backend.updated" EventMCPBackendDeleted EventName = "mcp_backend.deleted" EventA2AAgentCreated EventName = "a2a_agent.created" EventA2AAgentUpdated EventName = "a2a_agent.updated" EventA2AAgentDeleted EventName = "a2a_agent.deleted" EventCredentialCreated EventName = "credential.created" EventCredentialUpdated EventName = "credential.updated" EventCredentialRotated EventName = "credential.rotated" EventCredentialDeleted EventName = "credential.deleted" EventCredentialAssigned EventName = "credential.assigned" EventCredentialUnassigned EventName = "credential.unassigned" EventSnapshotPublish EventName = "snapshot.published" EventRegionCreated EventName = "region.created" EventRegionUpdated EventName = "region.updated" EventDeploymentRegistered EventName = "deployment.registered" EventDeploymentJoinTokenRotated EventName = "deployment.join_token_rotated" EventOrgRegionBound EventName = "org.region.bound" EventOrgRegionUnbound EventName = "org.region.unbound" EventRegionOverlayUpserted EventName = "region.overlay.upserted" EventRegionOverlayDeleted EventName = "region.overlay.deleted" )
const EventAll EventName = "*"
EventAll matches every event when used with Bus.Subscribe.
type EventRecorder ¶
EventRecorder receives domain events after successful platform commands.
type Handler ¶
Handler receives a domain event. Handlers must not panic; the bus recovers panics.
func AuditHandler ¶
AuditHandler maps domain events onto the audit.Store port. It belongs in the application layer so adapters stay free of the platform Event type.
func OutboxHandler ¶
func OutboxHandler(enq EventEnqueuer, log *slog.Logger) Handler
OutboxHandler returns a bus Handler that enqueues events to a durable outbox. Enqueue failures are logged and do not fail the request path.
func SlogHandler ¶
SlogHandler returns a Handler that logs events at debug level.
type MemoryRecorder ¶
type MemoryRecorder struct {
// contains filtered or unexported fields
}
MemoryRecorder stores recent events (newest last). Useful in tests and diagnostics.
func NewMemoryRecorder ¶
func NewMemoryRecorder(limit int) *MemoryRecorder
NewMemoryRecorder keeps up to limit events (default 256).
func (*MemoryRecorder) Snapshot ¶
func (m *MemoryRecorder) Snapshot() []Event
Snapshot returns a copy of recorded events (oldest first).
type MultiRecorder ¶
type MultiRecorder []EventRecorder
MultiRecorder fans events out to multiple recorders.
type SSOProviderInfo ¶
type SSOProviderInfo struct {
ID string `json:"id"`
DisplayName string `json:"display_name"`
Type string `json:"type"`
}
SSOProviderInfo is a public descriptor for the login UI.
type Service ¶
type Service struct {
API ConfigAPI
Snap SnapshotPublisher
Events EventRecorder
}
Service orchestrates platform queries and commands (mutate + publish + events).
func New ¶
func New(api ConfigAPI, snap SnapshotPublisher) *Service
func (*Service) AcceptOrgInvite ¶
func (*Service) AddTeamMember ¶
func (*Service) AssignCredential ¶
func (s *Service) AssignCredential(ctx context.Context, credentialID, scopeType, scopeID, createdBy string) (*credentials.Assignment, error)
func (*Service) AuthenticateDeploymentJoinToken ¶ added in v0.3.0
func (*Service) AuthenticateFederationPeerToken ¶ added in v0.3.0
func (s *Service) AuthenticateFederationPeerToken(ctx context.Context, rawToken string) (*federation.ControlPlanePeer, error)
func (*Service) BindAllOrgsToRegion ¶ added in v0.3.0
func (*Service) BindOrgToRegion ¶ added in v0.3.0
func (*Service) CreateA2AAgent ¶
func (*Service) CreateAPIKey ¶
func (*Service) CreateCredential ¶
func (s *Service) CreateCredential(ctx context.Context, orgID, name, providerType, storageKind, secretRef, secretValue string) (*credentials.Credential, error)
func (*Service) CreateEnvironment ¶
func (*Service) CreateMCPBackend ¶
func (s *Service) CreateMCPBackend(ctx context.Context, orgID, alias, name, baseURL, apiKeyEnv string, methodAllowlist []byte, enabled bool) (*gatewayconfig.MCPBackend, error)
func (*Service) CreateOrganization ¶
func (*Service) CreatePolicy ¶
func (s *Service) CreatePolicy(ctx context.Context, orgID, name, expression string, actions []gatewayconfig.PolicyAction, enabled bool, priority int) (*gatewayconfig.RequestPolicy, error)
func (*Service) CreateProject ¶
func (*Service) CreateProvider ¶
func (s *Service) CreateProvider(ctx context.Context, orgID, name, typ, baseURL, apiKeyEnv string, caps snapshot.ProviderCapabilities, config json.RawMessage) (*gatewayconfig.Provider, error)
func (*Service) CreateQuota ¶
func (*Service) CreateRegion ¶ added in v0.3.0
func (*Service) CreateRoute ¶
func (s *Service) CreateRoute(ctx context.Context, orgID, model, providerID, targetModel string, fallbacks []gatewayconfig.RouteFallback, retry *gatewayconfig.RetryConfig, strategy string, weight int) (*gatewayconfig.Route, error)
func (*Service) CreateSigningKey ¶ added in v0.3.0
func (*Service) CreateTeam ¶
func (*Service) CreateWasmHook ¶
func (*Service) DeleteA2AAgent ¶
func (*Service) DeleteAPIKey ¶
func (*Service) DeleteCredential ¶
func (*Service) DeleteCredentialAssignment ¶
func (*Service) DeleteEnvironment ¶
func (*Service) DeleteMCPBackend ¶
func (*Service) DeletePolicy ¶
func (*Service) DeleteProvider ¶
func (*Service) DeleteQuota ¶
func (*Service) DeleteRegionOverlay ¶ added in v0.3.0
func (*Service) DeleteRoute ¶
func (*Service) DeleteSigningKey ¶ added in v0.3.0
func (*Service) DeleteWasmHook ¶
func (*Service) ExportFederationRegion ¶ added in v0.3.0
func (s *Service) ExportFederationRegion(ctx context.Context, slug string, since int64, objectPrefix string) (*federation.RegionExport, error)
func (*Service) GetDeployment ¶ added in v0.3.0
func (*Service) GetEnvironment ¶
func (*Service) GetFederationPeer ¶ added in v0.3.0
func (s *Service) GetFederationPeer(ctx context.Context, peerID string) (*federation.ControlPlanePeer, error)
func (*Service) GetOrgDefaultRetry ¶
func (s *Service) GetOrgDefaultRetry(ctx context.Context, orgID string) (*gatewayconfig.RetryConfig, error)
func (*Service) GetOrgObjectStore ¶
func (s *Service) GetOrgObjectStore(ctx context.Context, orgID string) (*gatewayconfig.ObjectStoreConfig, error)
func (*Service) GetRegionOverlay ¶ added in v0.3.0
func (*Service) InviteOrgMember ¶
func (*Service) JoinFederationPeer ¶ added in v0.3.0
func (s *Service) JoinFederationPeer(ctx context.Context, rawToken string) (*federation.ControlPlanePeer, error)
func (*Service) ListA2AAgents ¶
func (*Service) ListAPIKeys ¶
func (*Service) ListCredentialAssignments ¶
func (s *Service) ListCredentialAssignments(ctx context.Context, orgID string) ([]credentials.Assignment, error)
func (*Service) ListCredentials ¶
func (s *Service) ListCredentials(ctx context.Context, orgID string) ([]credentials.Credential, error)
func (*Service) ListDeployments ¶ added in v0.3.0
func (*Service) ListEnvironments ¶
func (*Service) ListFederationPeers ¶ added in v0.3.0
func (s *Service) ListFederationPeers(ctx context.Context) ([]federation.ControlPlanePeer, error)
func (*Service) ListFederationUsageReports ¶ added in v0.3.0
func (*Service) ListMCPBackends ¶
func (s *Service) ListMCPBackends(ctx context.Context, orgID string) ([]gatewayconfig.MCPBackend, error)
func (*Service) ListOrgInvites ¶
func (*Service) ListOrgMembers ¶
func (*Service) ListOrganizationsForUser ¶
func (*Service) ListPolicies ¶
func (s *Service) ListPolicies(ctx context.Context, orgID string) ([]gatewayconfig.RequestPolicy, error)
func (*Service) ListProjects ¶
func (*Service) ListProviderHealth ¶
func (*Service) ListProviders ¶
func (*Service) ListQuotas ¶
func (*Service) ListRegionMemberships ¶ added in v0.3.0
func (*Service) ListRegions ¶ added in v0.3.0
func (*Service) ListRoutes ¶
func (*Service) ListSigningKeys ¶ added in v0.3.0
func (*Service) ListTeamMembers ¶
func (*Service) ListVisibleOrgAPIKeys ¶
func (s *Service) ListVisibleOrgAPIKeys(ctx context.Context, orgID, viewerUserID string, viewerIsAdmin bool) ([]access.APIKey, error)
ListVisibleOrgAPIKeys returns org keys filtered for the viewer. Admins see all keys; members see service accounts plus their own personal keys.
func (*Service) ListWasmHooks ¶
func (*Service) OpenFederationPeerJoinToken ¶ added in v0.3.0
func (*Service) PreviewOrgInvite ¶
func (*Service) PublishSnapshot ¶
PublishSnapshot republishes the gateway snapshot and emits snapshot.published.
func (*Service) PutRegionOverlay ¶ added in v0.3.0
func (s *Service) PutRegionOverlay(ctx context.Context, regionID, orgID string, payload regions.OverlayPayload) (*regions.RegionConfigOverlay, error)
func (*Service) RecordDeploymentHeartbeat ¶ added in v0.3.0
func (*Service) RecordFederationPeerSync ¶ added in v0.3.0
func (*Service) RegisterDeployment ¶ added in v0.3.0
func (*Service) RegisterFederationPeer ¶ added in v0.3.0
func (s *Service) RegisterFederationPeer(ctx context.Context, name, regionID, baseURL string) (*federation.PeerWithToken, error)
func (*Service) RemoveTeamMember ¶
func (*Service) ReorderPolicies ¶
func (s *Service) ReorderPolicies(ctx context.Context, orgID string, items []gatewayconfig.PolicyPriorityUpdate) error
func (*Service) ResendOrgInvite ¶
func (*Service) RevokeOrgInvite ¶
func (*Service) RotateCredential ¶
func (s *Service) RotateCredential(ctx context.Context, credentialID, secretRef, secretValue string) (*credentials.Credential, error)
func (*Service) RotateDeploymentJoinToken ¶ added in v0.3.0
func (*Service) RotateFederationPeerJoinToken ¶ added in v0.3.0
func (s *Service) RotateFederationPeerJoinToken(ctx context.Context, peerID string) (*federation.PeerWithToken, error)
func (*Service) RotateSigningKey ¶ added in v0.3.0
func (*Service) SetOrgDefaultRetry ¶
func (s *Service) SetOrgDefaultRetry(ctx context.Context, orgID string, retry *gatewayconfig.RetryConfig) (*gatewayconfig.RetryConfig, error)
func (*Service) SetOrgObjectStore ¶
func (s *Service) SetOrgObjectStore(ctx context.Context, orgID string, cfg *gatewayconfig.ObjectStoreConfig) (*gatewayconfig.ObjectStoreConfig, error)
func (*Service) SummarizeUsage ¶
func (*Service) UnbindOrgFromRegion ¶ added in v0.3.0
func (*Service) UpdateA2AAgent ¶
func (*Service) UpdateCredential ¶
func (s *Service) UpdateCredential(ctx context.Context, credentialID, name, status string) (*credentials.Credential, error)
func (*Service) UpdateFederationPeer ¶ added in v0.3.0
func (s *Service) UpdateFederationPeer(ctx context.Context, peerID, name, baseURL, status string) (*federation.ControlPlanePeer, error)
func (*Service) UpdateMCPBackend ¶
func (s *Service) UpdateMCPBackend(ctx context.Context, id string, alias, name, baseURL, apiKeyEnv *string, methodAllowlist []byte, enabled *bool) (*gatewayconfig.MCPBackend, error)
func (*Service) UpdateOrgMemberRole ¶
func (*Service) UpdatePolicy ¶
func (s *Service) UpdatePolicy(ctx context.Context, policyID string, name, expression *string, actions []gatewayconfig.PolicyAction, enabled *bool, priority *int) (*gatewayconfig.RequestPolicy, error)
func (*Service) UpdateProvider ¶
func (s *Service) UpdateProvider(ctx context.Context, providerID, name, baseURL, apiKeyEnv string, config *json.RawMessage) (*gatewayconfig.Provider, error)
func (*Service) UpdateQuota ¶
func (*Service) UpdateRegion ¶ added in v0.3.0
func (*Service) UpdateRoute ¶
func (s *Service) UpdateRoute(ctx context.Context, routeID, model, providerID, targetModel string, fallbacks []gatewayconfig.RouteFallback, retry *gatewayconfig.RetryConfig, strategy string, weight int) (*gatewayconfig.Route, error)
func (*Service) UpdateSigningKey ¶ added in v0.3.0
func (*Service) UpdateTeamMemberRole ¶
type SnapshotPublisher ¶
type SnapshotPublisher interface {
PublishSnapshot(ctx context.Context) error
// PublishRegionSnapshots puts the global snapshot and only the listed regions' object-store blobs.
PublishRegionSnapshots(ctx context.Context, regionIDs ...string) error
}
SnapshotPublisher publishes compiled gateway snapshots after config changes.