Documentation
¶
Index ¶
- Constants
- Variables
- func NormalizeEmail(email string) string
- func ParseAPIKey(key string) (prefix string, userID uint, keyID uint, secret string, err error)
- func ParseDeviceEnrollmentCredential(credential string) (configurationID, keyID uint, secret string, err error)
- func ParseRedactedAPIKey(key string) (userID uint, keyID uint, err error)
- func ValidateAuditLogOptions(opts MCPAuditLogOptions, sources []types2.AuditLogSourceType) error
- type APIKeyListOptions
- type AlreadyExistsError
- type Client
- func (c *Client) ActivateLocalAuthUser(ctx context.Context, setupTokenHash, sessionID string, expiresAt time.Time) (*types.LocalAuthUser, error)
- func (c *Client) ActiveUserCountByDate(ctx context.Context, start, end time.Time) (int64, error)
- func (c *Client) ActiveUsersByDate(ctx context.Context, start, end time.Time) ([]types.User, error)
- func (c *Client) ActivitiesByUser(ctx context.Context, userID string, start, end time.Time) ([]types.APIActivity, error)
- func (c *Client) AddActivityForToday(ctx context.Context, userID string) error
- func (c *Client) AuthProviderVerificationActive(ctx context.Context, id string) (bool, error)
- func (c *Client) AuthProviderVerificationStartableBy(ctx context.Context, id string, userID uint) (bool, error)
- func (c *Client) AuthorizeTokenRequestByDeviceCode(ctx context.Context, userID uint, code string) error
- func (c *Client) CleanupExpiredMCPOAuthPendingStates(ctx context.Context, olderThan time.Duration) error
- func (c *Client) ClearTempUserCache(ctx context.Context) error
- func (c *Client) Close() error
- func (c *Client) CompleteLocalAuthUserPasswordChange(ctx context.Context, id uint, passwordHash, currentSessionID string) error
- func (c *Client) CopyMCPOAuthTokens(ctx context.Context, userID, sourceID, targetID string) error
- func (c *Client) CreateAPIKey(ctx context.Context, userID uint, name, description string, ...) (*types.APIKeyCreateResponse, error)
- func (c *Client) CreateAPIKeyFromSetupTokenRequest(ctx context.Context, userID uint, tr *types.TokenRequest) (*types.APIKeyCreateResponse, error)
- func (c *Client) CreateBootstrapLocalAuthUser(ctx context.Context, email, passwordHash string, requirePasswordChange bool) (*types.LocalAuthUser, error)
- func (c *Client) CreateDeviceEnrollmentKey(ctx context.Context, configurationID, createdBy uint, name string, ...) (*types.DeviceEnrollmentKeyCreateResponse, error)
- func (c *Client) CreateDeviceTokenRequest(ctx context.Context, tr *types.TokenRequest) (string, error)
- func (c *Client) CreateGroupRoleAssignment(ctx context.Context, groupName string, role types2.Role, description string) (*types.GroupRoleAssignment, error)
- func (c *Client) CreateHostedAgentAPIKey(ctx context.Context, instanceID string, ownerUserID uint, name string) (*types.APIKeyCreateResponse, error)
- func (c *Client) CreateImage(ctx context.Context, data []byte, mimeType string) (*types.Image, error)
- func (c *Client) CreateInitialLocalAuthUser(ctx context.Context, email, passwordHash, setupTokenHash string, ...) (*types.LocalAuthUser, error)
- func (c *Client) CreateLocalAuthSession(ctx context.Context, id string, userID uint, expiresAt time.Time) error
- func (c *Client) CreateLocalAuthUser(ctx context.Context, email, passwordHash string, requirePasswordChange bool) (*types.LocalAuthUser, error)
- func (c *Client) CreateMCPOAuthPendingState(ctx context.Context, ...) error
- func (c *Client) CreateMDMConfiguration(ctx context.Context, createdBy uint, configuration *types.MDMConfiguration) (*types.MDMConfiguration, error)
- func (c *Client) CreateServiceAccountAPIKey(ctx context.Context, serviceAccountName string, now time.Time) (*types.ServiceAccountAPIKey, error)
- func (c *Client) CreateTokenRequest(ctx context.Context, tr *types.TokenRequest) error
- func (c *Client) CreateTokenRequestState(ctx context.Context, id string) (string, error)
- func (c *Client) DeleteAllLocalAuthSessions(ctx context.Context) error
- func (c *Client) DeleteAllServiceAccountAPIKeys(ctx context.Context, serviceAccountName string) error
- func (c *Client) DeleteAuthProviderGroupData(ctx context.Context, ...) error
- func (c *Client) DeleteAuthToken(ctx context.Context, userID uint, id string) error
- func (c *Client) DeleteCredential(ctx context.Context, context, name string) (bool, error)
- func (c *Client) DeleteDeviceEnrollmentKey(ctx context.Context, configurationID, id uint) error
- func (c *Client) DeleteDeviceScan(ctx context.Context, id uint) error
- func (c *Client) DeleteExpiredLocalAuthSessions(ctx context.Context) error
- func (c *Client) DeleteExpiredServiceAccountAPIKeys(ctx context.Context, serviceAccountName string, now time.Time) error
- func (c *Client) DeleteGroupRoleAssignment(ctx context.Context, groupName string) error
- func (c *Client) DeleteImage(ctx context.Context, id string) error
- func (c *Client) DeleteLocalAuthSession(ctx context.Context, id string) error
- func (c *Client) DeleteLocalAuthSessionsForEmail(ctx context.Context, email, exceptSessionID string) error
- func (c *Client) DeleteLocalAuthUser(ctx context.Context, id uint) error
- func (c *Client) DeleteMCPOAuthPendingState(ctx context.Context, hashedState string) error
- func (c *Client) DeleteMCPOAuthTokenForAllUsers(ctx context.Context, mcpID string) error
- func (c *Client) DeleteMCPOAuthTokenForURL(ctx context.Context, userID, mcpID, mcpURL string) error
- func (c *Client) DeleteMCPOAuthTokens(ctx context.Context, userID, mcpID string) error
- func (c *Client) DeleteMDMConfiguration(ctx context.Context, id uint) error
- func (c *Client) DeleteProperty(ctx context.Context, key string) error
- func (c *Client) DeleteServiceAccountAPIKeyByID(ctx context.Context, id uint) error
- func (c *Client) DeleteSessionsForUser(ctx context.Context, storageClient kclient.Client, identities []types.Identity, ...) error
- func (c *Client) DeleteUser(ctx context.Context, userID string) (*types.User, error)
- func (c *Client) DeviceCount(ctx context.Context) (int64, error)
- func (c *Client) DeviceScanCount(ctx context.Context, start, end time.Time) (int64, error)
- func (c *Client) EncryptIdentities(ctx context.Context, force bool) error
- func (c *Client) EncryptUsers(ctx context.Context, force bool) error
- func (c *Client) EnforcementDecisionCount(ctx context.Context, start, end time.Time) (int64, error)
- func (c *Client) EnrollDevice(ctx context.Context, in DeviceEnrollment, deviceLimit DeviceLimit) (*types.Device, error)
- func (c *Client) EnsureIdentity(ctx context.Context, id *types.Identity, timezone string, userLimit UserLimit) (*types.User, error)
- func (c *Client) EnsureIdentityWithRole(ctx context.Context, id *types.Identity, timezone string, role types2.Role, ...) (*types.User, error)
- func (c *Client) FindIdentitiesForUser(ctx context.Context, userID uint) ([]types.Identity, error)
- func (c *Client) GetAPIKey(ctx context.Context, userID uint, keyID uint) (*types.APIKey, error)
- func (c *Client) GetAPIKeyByID(ctx context.Context, keyID uint) (*types.APIKey, error)
- func (c *Client) GetAuditLogFilterOptions(ctx context.Context, option string, opts MCPAuditLogOptions, exclude ...any) ([]string, error)
- func (c *Client) GetAuthProviderGroupCleanupUserIDs(ctx context.Context, authProviderNamespace, authProviderName string, ...) ([]uint, error)
- func (c *Client) GetDeviceByDeviceID(ctx context.Context, deviceID string) (*types.Device, error)
- func (c *Client) GetDeviceClientFleetSummary(ctx context.Context, name string) (*DeviceClientFleetSummary, error)
- func (c *Client) GetDeviceScan(ctx context.Context, id uint) (*types.DeviceScan, error)
- func (c *Client) GetDeviceScanStats(ctx context.Context, opts DeviceScanStatsOptions) (*DeviceScanStatsResult, error)
- func (c *Client) GetEnforcementDecision(ctx context.Context, id uint) (*types.EnforcementDecisionLog, error)
- func (c *Client) GetEnforcementDecisionFilterOptions(ctx context.Context, option string, opts EnforcementDecisionOptions) ([]string, error)
- func (c *Client) GetEnforcementDecisions(ctx context.Context, opts EnforcementDecisionOptions) ([]types.EnforcementDecisionLog, int64, error)
- func (c *Client) GetExplicitRoleEmails() map[string]types2.Role
- func (c *Client) GetGroupRoleAssignment(ctx context.Context, groupName string) (*types.GroupRoleAssignment, error)
- func (c *Client) GetGroupRoleAssignmentsForGroups(ctx context.Context, groupNames []string) ([]types.GroupRoleAssignment, error)
- func (c *Client) GetImage(ctx context.Context, id string) (*types.Image, error)
- func (c *Client) GetLLMAuditLog(ctx context.Context, id string, withSensitiveFields bool) (*types.LLMAuditLog, error)
- func (c *Client) GetLLMAuditLogAPIKeyFilterOptions(ctx context.Context, opts LLMAuditLogOptions) ([]apitypes.AuditLogAPIKeyFilterOption, error)
- func (c *Client) GetLLMAuditLogFilterOptions(ctx context.Context, option string, opts LLMAuditLogOptions, exclude ...any) ([]string, error)
- func (c *Client) GetLLMAuditLogs(ctx context.Context, opts LLMAuditLogOptions) ([]types.LLMAuditLog, int64, error)
- func (c *Client) GetMCPAuditLog(ctx context.Context, id uint, withRequestAndResponse bool) (*types.MCPAuditLog, error)
- func (c *Client) GetMCPAuditLogAPIKeyFilterOptions(ctx context.Context, opts MCPAuditLogOptions) ([]apitypes.AuditLogAPIKeyFilterOption, error)
- func (c *Client) GetMCPAuditLogs(ctx context.Context, opts MCPAuditLogOptions) ([]types.MCPAuditLog, int64, error)
- func (c *Client) GetMCPOAuthPendingState(ctx context.Context, state string) (*types.MCPOAuthPendingState, error)
- func (c *Client) GetMCPOAuthToken(ctx context.Context, userID, mcpID, url string) (*types.MCPOAuthToken, error)
- func (c *Client) GetMCPServerDetail(ctx context.Context, configHash string) (*types.MCPServerDetail, error)
- func (c *Client) GetMCPUsageStats(ctx context.Context, opts MCPUsageStatsOptions) (types.MCPUsageStatsList, error)
- func (c *Client) GetMDMAssetBundle(ctx context.Context, digest string) (*types.MDMAssetBundle, error)
- func (c *Client) GetMDMConfiguration(ctx context.Context, id uint) (*types.MDMConfiguration, error)
- func (c *Client) GetMDMConfigurationEnforcement(ctx context.Context, id uint) (types.MDMConfigurationEnforcement, error)
- func (c *Client) GetMessagePolicyViolation(ctx context.Context, id uint) (*types.MessagePolicyViolation, error)
- func (c *Client) GetMessagePolicyViolationFilterOptions(ctx context.Context, option string, opts MessagePolicyViolationOptions) ([]string, error)
- func (c *Client) GetMessagePolicyViolationStats(ctx context.Context, opts MessagePolicyViolationOptions) (*MessagePolicyViolationStats, error)
- func (c *Client) GetMessagePolicyViolations(ctx context.Context, opts MessagePolicyViolationOptions) ([]types.MessagePolicyViolation, int64, error)
- func (c *Client) GetOrCreateProperty(ctx context.Context, key, value string) (types.Property, error)
- func (c *Client) GetProperty(ctx context.Context, key string) (types.Property, error)
- func (c *Client) GetSetupTokenRequest(ctx context.Context, id string) (*types.TokenRequest, error)
- func (c *Client) GetSkillDetail(ctx context.Context, name string) (*types.SkillDetail, error)
- func (c *Client) GetTempUserCache(ctx context.Context) *types.TempSetupUser
- func (c *Client) GetUserGroupMemberships(ctx context.Context, userIDs []uint) (map[uint][]string, error)
- func (c *Client) GetUsersInGroup(ctx context.Context, groupName string) ([]types.User, error)
- func (c *Client) HasExplicitRole(email string) types2.Role
- func (c *Client) HostedAgentAPIKeys(ctx context.Context, instanceID string) ([]types.APIKey, error)
- func (c *Client) InsertDeviceScan(ctx context.Context, scan *types.DeviceScan) error
- func (c *Client) InsertLLMAuditLog(ctx context.Context, auditLog *types.LLMAuditLog) error
- func (c *Client) InsertLocalAgentAuditLogs(ctx context.Context, logs []types.MCPAuditLog) error
- func (c *Client) InsertTokenUsage(ctx context.Context, activity *types.RunTokenActivity) error
- func (c *Client) InvalidateMDMConfigurationArtifacts(ctx context.Context, latestDigest string) error
- func (c *Client) LLMAuditLogCount(ctx context.Context, start, end time.Time) (int64, error)
- func (c *Client) LLMAuditLogEnabled() bool
- func (c *Client) ListAPIKeys(ctx context.Context, userID uint) ([]types.APIKey, error)
- func (c *Client) ListAPIKeysWithOptions(ctx context.Context, userID uint, opts APIKeyListOptions) ([]types.APIKey, error)
- func (c *Client) ListAllAPIKeys(ctx context.Context, opts APIKeyListOptions) ([]types.APIKey, error)
- func (c *Client) ListAuthGroups(ctx context.Context, ...) (ListAuthGroupsResult, error)
- func (c *Client) ListAuthTokens(ctx context.Context, userID uint) ([]types.AuthToken, error)
- func (c *Client) ListCredentials(ctx context.Context, opts ListCredentialsOptions) ([]types.Credential, error)
- func (c *Client) ListDeviceClientFleetSummaries(ctx context.Context, opts DeviceClientFleetListOptions) ([]DeviceClientFleetSummary, int64, error)
- func (c *Client) ListDeviceEnrollmentKeys(ctx context.Context, configurationID uint) ([]types.DeviceEnrollmentKey, error)
- func (c *Client) ListDeviceScans(ctx context.Context, opts DeviceScanListOptions) ([]types.DeviceScan, int64, error)
- func (c *Client) ListDevices(ctx context.Context, configurationID uint) ([]types.Device, error)
- func (c *Client) ListGroupIDsForUser(ctx context.Context, userID uint) ([]string, error)
- func (c *Client) ListGroupRoleAssignments(ctx context.Context) ([]types.GroupRoleAssignment, error)
- func (c *Client) ListMCPServerOccurrences(ctx context.Context, configHash string, limit, offset int) ([]types.MCPServerOccurrence, int64, error)
- func (c *Client) ListMDMConfigurations(ctx context.Context) ([]types.MDMConfiguration, error)
- func (c *Client) ListServiceAccountAPIKeys(ctx context.Context, serviceAccountName string) ([]types.ServiceAccountAPIKey, error)
- func (c *Client) ListSkillOccurrences(ctx context.Context, name string, limit, offset int) ([]types.SkillOccurrence, int64, error)
- func (c *Client) ListSkillStats(ctx context.Context, opts SkillStatListOptions) ([]types.SkillStat, int64, error)
- func (c *Client) LocalAuthRequiresActivation(ctx context.Context) (bool, error)
- func (c *Client) LocalAuthSession(ctx context.Context, id string) (*types.LocalAuthSession, *types.LocalAuthUser, error)
- func (c *Client) LocalAuthUserByEmail(ctx context.Context, email string) (*types.LocalAuthUser, error)
- func (c *Client) LocalAuthUserByID(ctx context.Context, id uint) (*types.LocalAuthUser, error)
- func (c *Client) LocalAuthUsers(ctx context.Context) ([]types.LocalAuthUser, error)
- func (c *Client) LogEnforcementDecision(entry types.EnforcementDecisionLog)
- func (c *Client) LogLLMAuditEntry(auditLog types.LLMAuditLog, responseStream []byte)
- func (c *Client) LogMCPAuditEntry(entry types.MCPAuditLog)
- func (c *Client) LogMessagePolicyViolation(ctx context.Context, v *types.MessagePolicyViolation) error
- func (c *Client) MCPToolCallCount(ctx context.Context, start, end time.Time) (int64, error)
- func (c *Client) MigrateGPTScriptCredentials(ctx context.Context, oldDB *gorm.DB) error
- func (c *Client) MigrateToolReferenceCredentialContexts(ctx context.Context) error
- func (c *Client) ModelProxyEnabled(ctx context.Context) (bool, error)
- func (c *Client) PollTokenRequest(ctx context.Context, id string) (*types.TokenRequest, error)
- func (c *Client) PruneUnusedMDMAssetBundles(ctx context.Context, retainDigests ...string) error
- func (c *Client) RefreshLocalAuthUserSetupToken(ctx context.Context, id uint, setupTokenHash string, ...) error
- func (c *Client) RemainingTokenUsageForUser(ctx context.Context, userID string, period time.Duration, ...) (*types.RemainingTokenUsage, error)
- func (c *Client) RemoveIdentity(ctx context.Context, id *types.Identity) error
- func (c *Client) RemoveIdentityAndUser(ctx context.Context, id *types.Identity) (uint, error)
- func (c *Client) ReplaceMCPOAuthToken(ctx context.Context, userID, mcpID, url, oauthAuthRequestID string, ...) error
- func (c *Client) ResolveAuthGroups(ctx context.Context, ...) ([]types.Group, error)
- func (c *Client) ResolveUserEffectiveRole(ctx context.Context, user *types.User, authGroupIDs []string) (types2.Role, error)
- func (c *Client) ResolveUserEffectiveRolesBulk(ctx context.Context, users []types.User, ...) (map[uint]types2.Role, error)
- func (c *Client) RetireOtherServiceAccountAPIKeys(ctx context.Context, serviceAccountName string, activeID uint, ...) error
- func (c *Client) RevealCredential(ctx context.Context, contexts []string, name string) (types.Credential, error)
- func (c *Client) RevokeAPIKey(ctx context.Context, userID uint, keyID uint) error
- func (c *Client) RevokeAPIKeyByID(ctx context.Context, keyID uint) error
- func (c *Client) RevokeHostedAgentAPIKeys(ctx context.Context, instanceID string) error
- func (c *Client) SetLocalAuthUserPassword(ctx context.Context, id uint, passwordHash string, requirePasswordChange bool) error
- func (c *Client) SetModelProxyEnabled(ctx context.Context, enabled bool) error
- func (c *Client) SetProperty(ctx context.Context, key, value string) (types.Property, error)
- func (c *Client) SetTempUserCache(ctx context.Context, user *types.User, ...) error
- func (c *Client) StoreMDMAssetBundle(ctx context.Context, content []byte) (string, error)
- func (c *Client) TokenUsageByUser(ctx context.Context, start, end time.Time) ([]types.RunTokenActivity, error)
- func (c *Client) TokenUsageForUser(ctx context.Context, userID string, start, end time.Time) ([]types.RunTokenActivity, error)
- func (c *Client) TokenUsageSeriesInRange(ctx context.Context, start, end time.Time) ([]types.RunTokenActivity, error)
- func (c *Client) TotalTokenUsageForUser(ctx context.Context, userID string, start, end time.Time) (types.RunTokenActivity, error)
- func (c *Client) UpdateAPIKeyLastUsed(ctx context.Context, key *types.APIKey) error
- func (c *Client) UpdateGroupRoleAssignment(ctx context.Context, groupName string, role types2.Role, description string) (*types.GroupRoleAssignment, error)
- func (c *Client) UpdateMDMConfiguration(ctx context.Context, configuration *types.MDMConfiguration) error
- func (c *Client) UpdateMDMConfigurationEnforcement(ctx context.Context, id uint, enabled bool, ...) error
- func (c *Client) UpdateProfileIfNeeded(ctx context.Context, user *types.User, ...) error
- func (c *Client) UpdateUser(ctx context.Context, actingUserCanChangeRole bool, updatedUser *types.User, ...) (*types.User, error)
- func (c *Client) UpdateUserInternalStatus(ctx context.Context, userID string, internal bool) error
- func (c *Client) UpsertCredential(ctx context.Context, credential types.Credential) error
- func (c *Client) User(ctx context.Context, username string) (*types.User, error)
- func (c *Client) UserByID(ctx context.Context, id string) (*types.User, error)
- func (c *Client) UserByIDIncludeDeleted(ctx context.Context, id string) (*types.User, error)
- func (c *Client) UserCount(ctx context.Context) (int64, error)
- func (c *Client) UserFromProviderUserID(ctx context.Context, providerNamespace, providerName, providerUserID string) (*types.User, error)
- func (c *Client) UserFromToken(ctx context.Context, token string) (*types.User, string, string, string, []string, error)
- func (c *Client) UserHasIdentityForAuthProvider(ctx context.Context, userID uint, authProviderName string) (bool, error)
- func (c *Client) UserInfoByID(ctx context.Context, userID uint) (kuser.Info, error)
- func (c *Client) Users(ctx context.Context, query types.UserQuery) ([]types.User, error)
- func (c *Client) UsersIncludeDeleted(ctx context.Context, query types.UserQuery) ([]types.User, error)
- func (c *Client) ValidateAPIKey(ctx context.Context, key string) (*types.APIKey, error)
- func (c *Client) ValidateDeviceEnrollmentCredential(ctx context.Context, credential string) (*types.DeviceEnrollmentKey, error)
- func (c *Client) ValidateStorageServiceAccountToken(ctx context.Context, token string) (*types.ServiceAccountAPIKey, error)
- func (c *Client) VerifyTokenRequestState(ctx context.Context, state string) (*types.TokenRequest, error)
- type CredentialNotFoundError
- type DeviceClientFleetListOptions
- type DeviceClientFleetSkill
- type DeviceClientFleetSummary
- type DeviceEnrollment
- type DeviceLimit
- type DeviceLimitProvider
- type DeviceScanListOptions
- type DeviceScanStatsOptions
- type DeviceScanStatsResult
- type EnforcementDecisionOptions
- type ExplicitRoleError
- type FetchUserGroupsError
- type LLMAuditLogOptions
- type LastAdminError
- type LastOwnerError
- type ListAuthGroupsOptions
- type ListAuthGroupsResult
- type ListCredentialsOptions
- type LogoutAllErr
- type MCPAuditLogOptions
- type MCPUsageStatsOptions
- type MessagePolicyViolationDirectionCounts
- type MessagePolicyViolationOptions
- type MessagePolicyViolationPolicyCount
- type MessagePolicyViolationStats
- type MessagePolicyViolationTimeBucket
- type MessagePolicyViolationUserCount
- type SkillStatListOptions
- type UserDecorator
- type UserLimit
- type UserLimitProvider
Constants ¶
const ( // DefaultUserLimit is the maximum number of users allowed when no // license-derived user-limit provider is configured. DefaultUserLimit = 100 // DefaultDeviceLimit is the maximum number of devices allowed when no // license-derived device-limit provider is configured. DefaultDeviceLimit = 100 )
const ( // DefaultGroupPageSize is the page size used when a caller does not ask for one. DefaultGroupPageSize = 50 // MaxGroupPageSize matches the ceiling the auth providers enforce, which is set by the // smallest page any of the identity providers will serve in a single request. MaxGroupPageSize = 100 )
Variables ¶
var ( // ErrLocalAuthUserExists is returned when creating a local auth user whose email is already taken. ErrLocalAuthUserExists = errors.New("local auth user already exists") // ErrBootstrapLocalAuthUserLimit is returned when bootstrap tries to create another account. ErrBootstrapLocalAuthUserLimit = errors.New("bootstrap can only create one local account; sign in with the existing account to continue setup") )
var ( // ErrGroupRoleAssignmentNotFound is returned when a group role assignment is not found. ErrGroupRoleAssignmentNotFound = errors.New("group role assignment not found") )
var (
ErrInvalidOrExpiredDeviceCode = errors.New("invalid or expired device code")
)
Functions ¶
func NormalizeEmail ¶ added in v0.24.0
NormalizeEmail lowercases and trims an email address so that logins are case-insensitive.
func ParseAPIKey ¶ added in v0.16.0
ParseAPIKey parses an API key string and extracts its components. Returns prefix, userID, keyID, secret, and an error if the format is invalid.
func ParseDeviceEnrollmentCredential ¶ added in v0.24.0
func ParseDeviceEnrollmentCredential(credential string) (configurationID, keyID uint, secret string, err error)
ParseDeviceEnrollmentCredential extracts the configuration ID, key ID, and secret from an ode1-<configuration_id>-<key_id>-<secret> credential.
func ParseRedactedAPIKey ¶ added in v0.26.0
ParseRedactedAPIKey extracts the owner and key IDs from the non-secret API key prefix emitted by nanobot audit logs. Nanobot retains the first three hyphen-delimited components or 12 characters, whichever is longer, so short numeric components can be followed by a small fragment of the redacted secret. Full bearer tokens are deliberately rejected.
func ValidateAuditLogOptions ¶ added in v0.24.0
func ValidateAuditLogOptions(opts MCPAuditLogOptions, sources []types2.AuditLogSourceType) error
ValidateAuditLogOptions verifies source selection, source-specific filter compatibility, and sort parameters. If sources is empty, validation uses opts.SourceTypes and applies the MCP-only default when that field is also empty. Validation does not perform any authorization checks; callers must authorize the selected sources separately.
Types ¶
type APIKeyListOptions ¶ added in v0.26.0
type APIKeyListOptions struct {
ShowRevoked bool
}
APIKeyListOptions controls whether retained revoked keys are included.
type AlreadyExistsError ¶ added in v0.5.0
type AlreadyExistsError struct {
// contains filtered or unexported fields
}
func (*AlreadyExistsError) Error ¶ added in v0.5.0
func (e *AlreadyExistsError) Error() string
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶
func New(ctx context.Context, db *db.DB, storageClient kclient.Client, encryptionConfig *encryptionconfig.EncryptionConfiguration, mcpOAuthTokenTrigger func(context.Context, string) error, ownerEmails, adminEmails []string, auditLogPersistenceInterval time.Duration, auditLogBatchSize, auditLogRetentionDays, llmAuditLogRetentionDays, deviceScanRetentionDays int, llmAuditEnabled bool) *Client
func (*Client) ActivateLocalAuthUser ¶ added in v0.26.0
func (c *Client) ActivateLocalAuthUser(ctx context.Context, setupTokenHash, sessionID string, expiresAt time.Time) (*types.LocalAuthUser, error)
ActivateLocalAuthUser validates a setup token and creates a restricted session. The token stays usable until the password is set, so an interrupted setup can be resumed from the same link.
func (*Client) ActiveUserCountByDate ¶ added in v0.26.0
func (*Client) ActiveUsersByDate ¶ added in v0.7.1
func (*Client) ActivitiesByUser ¶ added in v0.7.1
func (*Client) AddActivityForToday ¶ added in v0.7.1
func (*Client) AuthProviderVerificationActive ¶ added in v0.26.0
AuthProviderVerificationActive reports whether this staged-provider verification is still open. It is possession-based because it guards the return leg of the OAuth round trip, where the caller is the replacement provider's identity rather than the owner who started the switch. Use AuthProviderVerificationStartableBy for the outbound leg.
func (*Client) AuthProviderVerificationStartableBy ¶ added in v0.26.0
func (c *Client) AuthProviderVerificationStartableBy(ctx context.Context, id string, userID uint) (bool, error)
AuthProviderVerificationStartableBy reports whether userID may open the login for this verification. A verification belongs to the owner who started the switch, so another signed-in user holding the ID must not be able to use it.
func (*Client) AuthorizeTokenRequestByDeviceCode ¶ added in v0.26.0
func (c *Client) AuthorizeTokenRequestByDeviceCode(ctx context.Context, userID uint, code string) error
AuthorizeTokenRequestByDeviceCode consumes an unexpired device code and atomically creates and publishes an API key for the authenticated user.
func (*Client) CleanupExpiredMCPOAuthPendingStates ¶ added in v0.17.0
func (*Client) ClearTempUserCache ¶ added in v0.13.0
ClearTempUserCache removes all cached temporary users from the database.
func (*Client) CompleteLocalAuthUserPasswordChange ¶ added in v0.26.0
func (c *Client) CompleteLocalAuthUserPasswordChange(ctx context.Context, id uint, passwordHash, currentSessionID string) error
CompleteLocalAuthUserPasswordChange atomically completes a required password change. The session must still exist and the user must still be pending, so only the first of them sets the password.
func (*Client) CopyMCPOAuthTokens ¶ added in v0.26.0
CopyMCPOAuthTokens preserves a migrated connection's upstream authorization. Existing destination tokens take precedence, including tokens refreshed after a partially completed migration.
func (*Client) CreateAPIKey ¶ added in v0.16.0
func (c *Client) CreateAPIKey(ctx context.Context, userID uint, name, description string, expiresAt *time.Time, scopes types.APIKeyScopes) (*types.APIKeyCreateResponse, error)
CreateAPIKey generates a new API key for the given user. Returns the full key only once in the response.
func (*Client) CreateAPIKeyFromSetupTokenRequest ¶ added in v0.26.0
func (c *Client) CreateAPIKeyFromSetupTokenRequest(ctx context.Context, userID uint, tr *types.TokenRequest) (*types.APIKeyCreateResponse, error)
CreateAPIKeyFromSetupTokenRequest creates an API key from a token request.
func (*Client) CreateBootstrapLocalAuthUser ¶ added in v0.26.0
func (c *Client) CreateBootstrapLocalAuthUser(ctx context.Context, email, passwordHash string, requirePasswordChange bool) (*types.LocalAuthUser, error)
CreateBootstrapLocalAuthUser only creates an account when no local accounts exist.
func (*Client) CreateDeviceEnrollmentKey ¶ added in v0.24.0
func (c *Client) CreateDeviceEnrollmentKey(ctx context.Context, configurationID, createdBy uint, name string, expiresAt *time.Time) (*types.DeviceEnrollmentKeyCreateResponse, error)
CreateDeviceEnrollmentKey attaches an additional enrollment key to a configuration. Existing keys and enrolled devices are untouched.
func (*Client) CreateDeviceTokenRequest ¶ added in v0.26.0
func (c *Client) CreateDeviceTokenRequest(ctx context.Context, tr *types.TokenRequest) (string, error)
CreateDeviceTokenRequest initializes and persists a device login request. Only the formatted device code is returned; the database stores its digest.
func (*Client) CreateGroupRoleAssignment ¶ added in v0.15.0
func (c *Client) CreateGroupRoleAssignment(ctx context.Context, groupName string, role types2.Role, description string) (*types.GroupRoleAssignment, error)
CreateGroupRoleAssignment creates a new group role assignment.
func (*Client) CreateHostedAgentAPIKey ¶ added in v0.26.0
func (c *Client) CreateHostedAgentAPIKey(ctx context.Context, instanceID string, ownerUserID uint, name string) (*types.APIKeyCreateResponse, error)
CreateHostedAgentAPIKey issues the credential a hosted agent sandbox uses to reach the MCP gateway and the model proxy.
The key authenticates as the agent, not as its owner, so ownerUserID is recorded for attribution and cleanup only and confers none of that user's access. Scopes are deliberately limited to the gateway and the proxy: an agent must never reach the Obot API, or an exfiltrated credential could enumerate or modify resources.
MCPServerIDs is left empty on purpose. Authentication resolves the instance and fills the authorized servers from its live configuration, so narrowing an agent takes effect without reissuing this key.
The key does not expire. Agents read their credential once at startup and cannot reload it, so expiry would strand a running sandbox.
func (*Client) CreateImage ¶ added in v0.7.0
func (c *Client) CreateImage(ctx context.Context, data []byte, mimeType string) (*types.Image, error)
CreateImage stores a new image in the database
func (*Client) CreateInitialLocalAuthUser ¶ added in v0.26.0
func (c *Client) CreateInitialLocalAuthUser(ctx context.Context, email, passwordHash, setupTokenHash string, setupTokenExpiresAt time.Time) (*types.LocalAuthUser, error)
CreateInitialLocalAuthUser creates a user that can only be claimed with a setup token. Only the token's hash is persisted, and password completion revokes it.
func (*Client) CreateLocalAuthSession ¶ added in v0.24.0
func (c *Client) CreateLocalAuthSession(ctx context.Context, id string, userID uint, expiresAt time.Time) error
CreateLocalAuthSession records a session for the given user. The ID must be a hash of the token that is handed to the browser, never the token itself.
func (*Client) CreateLocalAuthUser ¶ added in v0.24.0
func (c *Client) CreateLocalAuthUser(ctx context.Context, email, passwordHash string, requirePasswordChange bool) (*types.LocalAuthUser, error)
CreateLocalAuthUser creates a new local auth user. The password must already be hashed.
func (*Client) CreateMCPOAuthPendingState ¶ added in v0.17.0
func (*Client) CreateMDMConfiguration ¶ added in v0.24.0
func (c *Client) CreateMDMConfiguration(ctx context.Context, createdBy uint, configuration *types.MDMConfiguration) (*types.MDMConfiguration, error)
CreateMDMConfiguration creates a configuration and atomically persists any rendered artifact content. The first configuration becomes the default.
func (*Client) CreateServiceAccountAPIKey ¶ added in v0.21.0
func (*Client) CreateTokenRequest ¶ added in v0.13.0
CreateTokenRequest creates a new token request in the database.
func (*Client) CreateTokenRequestState ¶ added in v0.26.0
CreateTokenRequestState creates and stores a fresh OAuth state for a setup token request.
func (*Client) DeleteAllLocalAuthSessions ¶ added in v0.24.0
DeleteAllLocalAuthSessions signs every local user out. It is used when the provider is deconfigured, so that reconfiguring it later doesn't bring old sessions back to life.
func (*Client) DeleteAllServiceAccountAPIKeys ¶ added in v0.21.0
func (*Client) DeleteAuthProviderGroupData ¶ added in v0.25.2
func (c *Client) DeleteAuthProviderGroupData(ctx context.Context, authProviderNamespace, authProviderName, groupIDPrefix string) error
DeleteAuthProviderGroupData removes all gateway-database state for groups belonging to a deconfigured auth provider. It is transactional and idempotent so controller retries are safe.
func (*Client) DeleteAuthToken ¶ added in v0.26.0
DeleteAuthToken deletes an auth token owned by a user.
func (*Client) DeleteCredential ¶ added in v0.23.0
DeleteCredential deletes a credential if it exists and returns whether a credential was deleted.
func (*Client) DeleteDeviceEnrollmentKey ¶ added in v0.24.0
DeleteDeviceEnrollmentKey removes a single enrollment key. It only stops that key from enrolling new devices; already-enrolled devices are unaffected. Scoped to the configuration so a mismatched path can't delete another configuration's key. Idempotent: deleting a key that doesn't exist succeeds.
func (*Client) DeleteDeviceScan ¶ added in v0.22.0
DeleteDeviceScan removes a scan and its child rows. Idempotent: returns nil when no scan with that id exists.
func (*Client) DeleteExpiredLocalAuthSessions ¶ added in v0.24.0
DeleteExpiredLocalAuthSessions removes sessions that are past their expiration.
func (*Client) DeleteExpiredServiceAccountAPIKeys ¶ added in v0.21.0
func (*Client) DeleteGroupRoleAssignment ¶ added in v0.15.0
DeleteGroupRoleAssignment deletes a group role assignment by group name.
func (*Client) DeleteImage ¶ added in v0.7.0
DeleteImage removes an image from the database
func (*Client) DeleteLocalAuthSession ¶ added in v0.24.0
func (*Client) DeleteLocalAuthSessionsForEmail ¶ added in v0.24.0
func (c *Client) DeleteLocalAuthSessionsForEmail(ctx context.Context, email, exceptSessionID string) error
DeleteLocalAuthSessionsForEmail signs the local user with the given email out of all sessions. If exceptSessionID is non-empty, that one session is kept (used to preserve the caller's own session when they log out everywhere else).
func (*Client) DeleteLocalAuthUser ¶ added in v0.24.0
func (*Client) DeleteMCPOAuthPendingState ¶ added in v0.17.0
func (*Client) DeleteMCPOAuthTokenForAllUsers ¶ added in v0.8.0
func (*Client) DeleteMCPOAuthTokenForURL ¶ added in v0.15.0
func (*Client) DeleteMCPOAuthTokens ¶ added in v0.15.0
func (*Client) DeleteMDMConfiguration ¶ added in v0.24.0
DeleteMDMConfiguration removes a configuration and its enrollment keys. Devices enrolled into it are intentionally preserved (not deleted).
func (*Client) DeleteProperty ¶ added in v0.23.0
func (*Client) DeleteServiceAccountAPIKeyByID ¶ added in v0.21.0
func (*Client) DeleteSessionsForUser ¶ added in v0.8.0
func (c *Client) DeleteSessionsForUser(ctx context.Context, storageClient kclient.Client, identities []types.Identity, sessionID, localSessionID string) error
DeleteSessionsForUser deletes the user's sessions across all of their identities. When keepSessionID / keepLocalSessionID are non-empty, the caller's current session is preserved (the "log out everywhere else" flow); when both are empty, every session is deleted (e.g. when the user is being deleted).
func (*Client) DeleteUser ¶ added in v0.5.0
func (*Client) DeviceCount ¶ added in v0.25.0
DeviceCount returns the total number of enrolled devices.
func (*Client) DeviceScanCount ¶ added in v0.26.0
func (*Client) EncryptIdentities ¶ added in v0.8.0
EncryptIdentities will pull all identities out of the database and ensure they are encrypted.
func (*Client) EncryptUsers ¶ added in v0.13.0
EncryptUsers will pull all users out of the database and ensure they are encrypted.
func (*Client) EnforcementDecisionCount ¶ added in v0.26.0
func (*Client) EnrollDevice ¶ added in v0.24.0
func (c *Client) EnrollDevice(ctx context.Context, in DeviceEnrollment, deviceLimit DeviceLimit) (*types.Device, error)
EnrollDevice registers a device's identity key trust-on-first-use and returns the device. Re-enrollment semantics keyed on DeviceID:
- same device, same key -> reactivate and rebind to the configuration
- same device, different key -> rejected (anti-takeover)
- new device -> created
func (*Client) EnsureIdentity ¶
func (c *Client) EnsureIdentity(ctx context.Context, id *types.Identity, timezone string, userLimit UserLimit) (*types.User, error)
EnsureIdentity ensures that the given identity exists in the database, and returns the user associated with it.
func (*Client) EnsureIdentityWithRole ¶ added in v0.5.0
func (c *Client) EnsureIdentityWithRole(ctx context.Context, id *types.Identity, timezone string, role types2.Role, userLimit UserLimit) (*types.User, error)
EnsureIdentityWithRole ensures the given identity exists in the database with the at least the given role, and returns the user associated with it. If the user already exists with a superset of the given role, it will not be updated.
func (*Client) FindIdentitiesForUser ¶ added in v0.8.0
FindIdentitiesForUser finds all identities for the given user.
func (*Client) GetAPIKeyByID ¶ added in v0.16.0
GetAPIKeyByID retrieves an API key by ID without user filtering (for admin use).
func (*Client) GetAuditLogFilterOptions ¶ added in v0.8.0
func (c *Client) GetAuditLogFilterOptions(ctx context.Context, option string, opts MCPAuditLogOptions, exclude ...any) ([]string, error)
GetAuditLogFilterOptions returns distinct values for an allowed audit-log filter column under the same source, scope, common-filter, and time constraints used by the list query. The caller must validate option against its public allowlist before calling this method.
func (*Client) GetAuthProviderGroupCleanupUserIDs ¶ added in v0.25.2
func (c *Client) GetAuthProviderGroupCleanupUserIDs(ctx context.Context, authProviderNamespace, authProviderName string, afterUserID uint, limit int) ([]uint, error)
GetAuthProviderGroupCleanupUserIDs returns one ordered page of users with an identity from the auth provider. The cursor is exclusive so cleanup progress remains bounded and durable.
func (*Client) GetDeviceByDeviceID ¶ added in v0.24.0
GetDeviceByDeviceID looks up an enrolled device by its client-computed ID.
func (*Client) GetDeviceClientFleetSummary ¶ added in v0.22.0
func (c *Client) GetDeviceClientFleetSummary(ctx context.Context, name string) (*DeviceClientFleetSummary, error)
GetDeviceClientFleetSummary returns the aggregate for a single client name, or gorm.ErrRecordNotFound when that name never appears on any device's latest scan.
func (*Client) GetDeviceScan ¶ added in v0.22.0
GetDeviceScan loads a single scan with all children preloaded.
func (*Client) GetDeviceScanStats ¶ added in v0.22.0
func (c *Client) GetDeviceScanStats(ctx context.Context, opts DeviceScanStatsOptions) (*DeviceScanStatsResult, error)
GetDeviceScanStats returns the dashboard rollup for a window: the distinct device count and three ranked breakdowns (clients, MCP servers, skills) computed over each device's latest scan in the window. Returns every group; the caller picks any top-N.
func (*Client) GetEnforcementDecision ¶ added in v0.25.0
func (*Client) GetEnforcementDecisionFilterOptions ¶ added in v0.25.0
func (*Client) GetEnforcementDecisions ¶ added in v0.25.0
func (c *Client) GetEnforcementDecisions(ctx context.Context, opts EnforcementDecisionOptions) ([]types.EnforcementDecisionLog, int64, error)
func (*Client) GetExplicitRoleEmails ¶ added in v0.13.0
GetExplicitRoleEmails returns a copy of all emails with explicit roles. Used by setup endpoints to list Owner and Admin emails.
func (*Client) GetGroupRoleAssignment ¶ added in v0.15.0
func (c *Client) GetGroupRoleAssignment(ctx context.Context, groupName string) (*types.GroupRoleAssignment, error)
GetGroupRoleAssignment returns a specific group role assignment by group name.
func (*Client) GetGroupRoleAssignmentsForGroups ¶ added in v0.15.0
func (c *Client) GetGroupRoleAssignmentsForGroups(ctx context.Context, groupNames []string) ([]types.GroupRoleAssignment, error)
GetGroupRoleAssignmentsForGroups retrieves all role assignments for the given group names. This is used during role resolution to find all roles assigned to a user's groups.
func (*Client) GetLLMAuditLog ¶ added in v0.24.0
func (*Client) GetLLMAuditLogAPIKeyFilterOptions ¶ added in v0.26.0
func (c *Client) GetLLMAuditLogAPIKeyFilterOptions(ctx context.Context, opts LLMAuditLogOptions) ([]apitypes.AuditLogAPIKeyFilterOption, error)
GetLLMAuditLogAPIKeyFilterOptions returns the API keys present in the currently filtered LLM audit-log result set.
func (*Client) GetLLMAuditLogFilterOptions ¶ added in v0.24.0
func (*Client) GetLLMAuditLogs ¶ added in v0.24.0
func (c *Client) GetLLMAuditLogs(ctx context.Context, opts LLMAuditLogOptions) ([]types.LLMAuditLog, int64, error)
func (*Client) GetMCPAuditLog ¶ added in v0.15.1
func (c *Client) GetMCPAuditLog(ctx context.Context, id uint, withRequestAndResponse bool) (*types.MCPAuditLog, error)
GetMCPAuditLog retrieves a single MCP audit log by ID
func (*Client) GetMCPAuditLogAPIKeyFilterOptions ¶ added in v0.26.0
func (c *Client) GetMCPAuditLogAPIKeyFilterOptions(ctx context.Context, opts MCPAuditLogOptions) ([]apitypes.AuditLogAPIKeyFilterOption, error)
GetMCPAuditLogAPIKeyFilterOptions returns the API keys present in the currently filtered and authorized MCP and local-agent audit-log result set.
func (*Client) GetMCPAuditLogs ¶ added in v0.8.0
func (c *Client) GetMCPAuditLogs(ctx context.Context, opts MCPAuditLogOptions) ([]types.MCPAuditLog, int64, error)
GetMCPAuditLogs retrieves a single, globally ordered page of audit rows from the selected sources. An empty SourceTypes selection preserves the MCP-only default. Mixed-source queries use each source's effective event time before applying one count, order, limit, and offset window. Sensitive payload fields are blanked unless WithRequestAndResponse is true.
func (*Client) GetMCPOAuthPendingState ¶ added in v0.17.0
func (*Client) GetMCPOAuthToken ¶ added in v0.8.0
func (*Client) GetMCPServerDetail ¶ added in v0.22.0
func (c *Client) GetMCPServerDetail(ctx context.Context, configHash string) (*types.MCPServerDetail, error)
GetMCPServerDetail returns the aggregated row keyed by config_hash plus the union of EnvKeys / HeaderKeys observed across the canonical rows. The aggregation is unbounded (all-time, all latest scans per device). Args is pulled from a canonical row (constant within a hash group, but JSONB has no MAX() in Postgres so it can't be selected with the GROUP BY).
func (*Client) GetMCPUsageStats ¶ added in v0.8.0
func (c *Client) GetMCPUsageStats(ctx context.Context, opts MCPUsageStatsOptions) (types.MCPUsageStatsList, error)
GetMCPUsageStats retrieves usage statistics for MCP servers
func (*Client) GetMDMAssetBundle ¶ added in v0.24.0
func (c *Client) GetMDMAssetBundle(ctx context.Context, digest string) (*types.MDMAssetBundle, error)
GetMDMAssetBundle returns and verifies a source archive by digest.
func (*Client) GetMDMConfiguration ¶ added in v0.24.0
GetMDMConfiguration retrieves a single configuration by ID.
func (*Client) GetMDMConfigurationEnforcement ¶ added in v0.25.0
func (c *Client) GetMDMConfigurationEnforcement(ctx context.Context, id uint) (types.MDMConfigurationEnforcement, error)
GetMDMConfigurationEnforcement retrieves just the enforcement policy of a configuration by ID.
func (*Client) GetMessagePolicyViolation ¶ added in v0.19.0
func (c *Client) GetMessagePolicyViolation(ctx context.Context, id uint) (*types.MessagePolicyViolation, error)
GetMessagePolicyViolation retrieves a single policy violation by ID and decrypts it.
func (*Client) GetMessagePolicyViolationFilterOptions ¶ added in v0.19.0
func (c *Client) GetMessagePolicyViolationFilterOptions(ctx context.Context, option string, opts MessagePolicyViolationOptions) ([]string, error)
GetMessagePolicyViolationFilterOptions returns distinct values for a given filter field.
func (*Client) GetMessagePolicyViolationStats ¶ added in v0.19.0
func (c *Client) GetMessagePolicyViolationStats(ctx context.Context, opts MessagePolicyViolationOptions) (*MessagePolicyViolationStats, error)
GetMessagePolicyViolationStats returns aggregated statistics for policy violations.
func (*Client) GetMessagePolicyViolations ¶ added in v0.19.0
func (c *Client) GetMessagePolicyViolations(ctx context.Context, opts MessagePolicyViolationOptions) ([]types.MessagePolicyViolation, int64, error)
GetMessagePolicyViolations retrieves policy violations with optional filters.
func (*Client) GetOrCreateProperty ¶ added in v0.23.0
func (*Client) GetProperty ¶ added in v0.13.0
func (*Client) GetSetupTokenRequest ¶ added in v0.26.0
GetSetupTokenRequest returns a setup token request by ID.
func (*Client) GetSkillDetail ¶ added in v0.22.0
GetSkillDetail returns the full per-skill payload for the dashboard drill-down: aggregated counts plus representative Description / HasScripts / GitRemoteURL / Files from one canonical row in the latest-scan-per-device subset. The aggregation is unbounded (all-time, all latest scans per device), matching the per-hash MCP detail's semantics.
func (*Client) GetTempUserCache ¶ added in v0.13.0
func (c *Client) GetTempUserCache(ctx context.Context) *types.TempSetupUser
GetTempUserCache retrieves the cached temporary user, if one exists. Returns nil if no user is cached.
func (*Client) GetUserGroupMemberships ¶ added in v0.15.0
func (c *Client) GetUserGroupMemberships(ctx context.Context, userIDs []uint) (map[uint][]string, error)
GetUserGroupMemberships fetches group memberships for multiple users in a single query. Returns a map of userID to slice of groupIDs.
func (*Client) GetUsersInGroup ¶ added in v0.15.0
GetUsersInGroup returns all users who are members of the given group. This is used to find users affected by GroupRoleAssignment changes.
func (*Client) HasExplicitRole ¶ added in v0.12.0
func (*Client) HostedAgentAPIKeys ¶ added in v0.26.0
HostedAgentAPIKeys returns the keys bound to an instance, without secrets.
func (*Client) InsertDeviceScan ¶ added in v0.22.0
InsertDeviceScan persists a device scan envelope and all its children in a single GORM cascading insert. Each call creates a fresh row — duplicate submissions are not deduped at this layer.
func (*Client) InsertLLMAuditLog ¶ added in v0.24.0
func (*Client) InsertLocalAgentAuditLogs ¶ added in v0.24.0
InsertLocalAgentAuditLogs persists completed local-agent tool-call audit logs. Duplicate idempotency keys are treated as successful no-ops for transport retries.
func (*Client) InsertTokenUsage ¶ added in v0.8.0
func (*Client) InvalidateMDMConfigurationArtifacts ¶ added in v0.24.0
func (c *Client) InvalidateMDMConfigurationArtifacts(ctx context.Context, latestDigest string) error
InvalidateMDMConfigurationArtifacts clears rendered downloads that were produced from any bundle other than latestDigest. Values and AssetDigest are retained so an administrator can review them against the latest fields.
func (*Client) LLMAuditLogCount ¶ added in v0.26.0
func (*Client) LLMAuditLogEnabled ¶ added in v0.24.0
func (*Client) ListAPIKeys ¶ added in v0.16.0
ListAPIKeys returns active API keys for a user (without the secrets).
func (*Client) ListAPIKeysWithOptions ¶ added in v0.26.0
func (c *Client) ListAPIKeysWithOptions(ctx context.Context, userID uint, opts APIKeyListOptions) ([]types.APIKey, error)
ListAPIKeysWithOptions returns API keys for a user according to opts.
func (*Client) ListAllAPIKeys ¶ added in v0.16.0
func (c *Client) ListAllAPIKeys(ctx context.Context, opts APIKeyListOptions) ([]types.APIKey, error)
ListAllAPIKeys returns system API keys according to opts.
func (*Client) ListAuthGroups ¶ added in v0.9.0
func (c *Client) ListAuthGroups(ctx context.Context, authProviderURL, authProviderNamespace, authProviderName string, opts ListAuthGroupsOptions) (ListAuthGroupsResult, error)
ListAuthGroups returns one page of the auth provider's groups.
The auth provider is the authoritative source. When it cannot be listed, the response falls back to the groups table, which holds the groups observed during a user sign-in plus any resolved by ID for a policy, and is therefore partial.
func (*Client) ListAuthTokens ¶ added in v0.26.0
ListAuthTokens returns the auth tokens owned by a user.
func (*Client) ListCredentials ¶ added in v0.23.0
func (c *Client) ListCredentials(ctx context.Context, opts ListCredentialsOptions) ([]types.Credential, error)
ListCredentials returns the credentials in the given context. If AllContexts is true, CredentialContexts is ignored and credentials from all contexts are returned. The secrets in the returned credentials are blanked out for security; use RevealCredential to get the secrets for a specific credential.
func (*Client) ListDeviceClientFleetSummaries ¶ added in v0.22.0
func (c *Client) ListDeviceClientFleetSummaries(ctx context.Context, opts DeviceClientFleetListOptions) ([]DeviceClientFleetSummary, int64, error)
ListDeviceClientFleetSummaries returns one row per distinct client name observed in device_scan_clients on each device's all-time latest scan, paginated after applying the selected sort order. Each row lists distinct submitters, skills with metadata, and MCP servers (by config_hash) attributed to that client on those scans. Optional Name filters distinct names by case-insensitive substring match.
func (*Client) ListDeviceEnrollmentKeys ¶ added in v0.24.0
func (c *Client) ListDeviceEnrollmentKeys(ctx context.Context, configurationID uint) ([]types.DeviceEnrollmentKey, error)
ListDeviceEnrollmentKeys returns the (secret-free) keys for a configuration, newest first.
func (*Client) ListDeviceScans ¶ added in v0.22.0
func (c *Client) ListDeviceScans(ctx context.Context, opts DeviceScanListOptions) ([]types.DeviceScan, int64, error)
ListDeviceScans returns scan envelopes ordered newest first. MCP servers, skills, and plugins are preloaded; files are not — DeviceScanFile.Content can be large and isn't needed for the list.
func (*Client) ListDevices ¶ added in v0.24.0
ListDevices returns the devices enrolled into a configuration, newest first.
func (*Client) ListGroupIDsForUser ¶ added in v0.9.0
ListGroupIDsForUser lists the group IDs that the given user is a member of. This can include groups from multiple auth providers.
func (*Client) ListGroupRoleAssignments ¶ added in v0.15.0
ListGroupRoleAssignments returns all group role assignments from the database.
func (*Client) ListMCPServerOccurrences ¶ added in v0.22.0
func (c *Client) ListMCPServerOccurrences(ctx context.Context, configHash string, limit, offset int) ([]types.MCPServerOccurrence, int64, error)
ListMCPServerOccurrences returns one row per (device, observation) for the given config_hash, drawn from the all-time latest scan of every device. Sorted scanned_at DESC, paginated.
func (*Client) ListMDMConfigurations ¶ added in v0.24.0
ListMDMConfigurations returns the default first, then newest first.
func (*Client) ListServiceAccountAPIKeys ¶ added in v0.21.0
func (*Client) ListSkillOccurrences ¶ added in v0.22.0
func (c *Client) ListSkillOccurrences(ctx context.Context, name string, limit, offset int) ([]types.SkillOccurrence, int64, error)
ListSkillOccurrences returns one row per (device, observation) for the given skill name, drawn from the all-time latest scan of every device. Sorted scanned_at DESC, paginated.
func (*Client) ListSkillStats ¶ added in v0.22.0
func (c *Client) ListSkillStats(ctx context.Context, opts SkillStatListOptions) ([]types.SkillStat, int64, error)
ListSkillStats returns one row per distinct skill name observed in the latest scan of any device within the requested window. Paginated, sortable, optional name LIKE filter.
func (*Client) LocalAuthRequiresActivation ¶ added in v0.26.0
LocalAuthRequiresActivation reports whether an initial owner still has to activate their setup link. Expiry is intentionally ignored so an expired link still reaches the activation page.
func (*Client) LocalAuthSession ¶ added in v0.24.0
func (c *Client) LocalAuthSession(ctx context.Context, id string) (*types.LocalAuthSession, *types.LocalAuthUser, error)
LocalAuthSession returns the unexpired session with the given ID, along with its user. Expired sessions are treated as missing and deleted.
func (*Client) LocalAuthUserByEmail ¶ added in v0.24.0
func (*Client) LocalAuthUserByID ¶ added in v0.24.0
func (*Client) LocalAuthUsers ¶ added in v0.24.0
func (*Client) LogEnforcementDecision ¶ added in v0.25.0
func (c *Client) LogEnforcementDecision(entry types.EnforcementDecisionLog)
LogEnforcementDecision buffers the decision row for asynchronous persistence. The decision endpoint returns to the device before the row is durably flushed, keeping the database off the synchronous decision path (the block/allow verdict never waits on a write).
func (*Client) LogLLMAuditEntry ¶ added in v0.24.0
func (c *Client) LogLLMAuditEntry(auditLog types.LLMAuditLog, responseStream []byte)
func (*Client) LogMCPAuditEntry ¶ added in v0.10.0
func (c *Client) LogMCPAuditEntry(entry types.MCPAuditLog)
func (*Client) LogMessagePolicyViolation ¶ added in v0.19.0
func (c *Client) LogMessagePolicyViolation(ctx context.Context, v *types.MessagePolicyViolation) error
LogMessagePolicyViolation encrypts sensitive fields and inserts a violation record.
func (*Client) MCPToolCallCount ¶ added in v0.26.0
func (*Client) MigrateGPTScriptCredentials ¶ added in v0.23.0
MigrateGPTScriptCredentials migrates existing GPTScript credentials into the gateway credentials table. The old GPTScript id, server_url, and username fields are intentionally not copied; server_url only supplies the new name.
func (*Client) MigrateToolReferenceCredentialContexts ¶ added in v0.23.0
MigrateToolReferenceCredentialContexts moves credentials that were scoped by a ToolReference UID into a context matching their credential name. It must run after MigrateGPTScriptCredentials because that migration creates the gateway credential rows from the old GPTScript credential store.
func (*Client) ModelProxyEnabled ¶ added in v0.26.0
ModelProxyEnabled reads shared state on every call. Only an absent property uses the backwards-compatible default.
func (*Client) PollTokenRequest ¶ added in v0.26.0
PollTokenRequest returns a token request and marks an available token as retrieved.
func (*Client) PruneUnusedMDMAssetBundles ¶ added in v0.24.0
PruneUnusedMDMAssetBundles removes source archives absent from retainDigests.
func (*Client) RefreshLocalAuthUserSetupToken ¶ added in v0.26.0
func (c *Client) RefreshLocalAuthUserSetupToken(ctx context.Context, id uint, setupTokenHash string, setupTokenExpiresAt time.Time) error
RefreshLocalAuthUserSetupToken rotates a still-pending setup token and invalidates the sessions created with the old one. Completed accounts cannot be rearmed.
func (*Client) RemainingTokenUsageForUser ¶ added in v0.8.0
func (*Client) RemoveIdentity ¶ added in v0.5.0
RemoveIdentity deletes an identity from the database. The identity is deleted using UserID if set, otherwise ProviderUsername. The method is idempotent and ignores not-found errors, returning only unexpected errors.
func (*Client) RemoveIdentityAndUser ¶ added in v0.9.0
RemoveIdentityAndUser deletes an identity and the associated user from the database. The identity and user are deleted using UserID if set, otherwise ProviderUsername. The method is idempotent and ignores not-found errors, returning only unexpected errors.
func (*Client) ReplaceMCPOAuthToken ¶ added in v0.8.0
func (*Client) ResolveAuthGroups ¶ added in v0.25.2
func (c *Client) ResolveAuthGroups(ctx context.Context, authProviderURL, authProviderNamespace, authProviderName string, ids []string) ([]types.Group, error)
ResolveAuthGroups looks up specific groups by ID, which is what the UI needs to render a name for a group that already has a role or policy attached.
Note the shape: cache first, provider only for the remainder. Resolution runs on page loads, so making it an unconditional provider call would put an identity provider round trip, and its rate limit, in front of every admin screen.
func (*Client) ResolveUserEffectiveRole ¶ added in v0.15.0
func (c *Client) ResolveUserEffectiveRole(ctx context.Context, user *types.User, authGroupIDs []string) (types2.Role, error)
ResolveUserEffectiveRole computes the effective role for a user by combining: 1. Individual role from users table 2. Group-based roles from GroupRoleAssignments Returns the highest base role plus orthogonal add-on roles (if present).
func (*Client) ResolveUserEffectiveRolesBulk ¶ added in v0.15.0
func (c *Client) ResolveUserEffectiveRolesBulk(ctx context.Context, users []types.User, userGroupMemberships map[uint][]string) (map[uint]types2.Role, error)
ResolveUserEffectiveRolesBulk computes effective roles for multiple users efficiently. It performs a single database query to fetch all group role assignments for all users' groups. Returns a map of userID to their effective role.
func (*Client) RetireOtherServiceAccountAPIKeys ¶ added in v0.21.0
func (*Client) RevealCredential ¶ added in v0.23.0
func (c *Client) RevealCredential(ctx context.Context, contexts []string, name string) (types.Credential, error)
RevealCredential returns the first credential matching name in the ordered list of contexts.
func (*Client) RevokeAPIKey ¶ added in v0.26.0
RevokeAPIKey immediately disables an API key while retaining its metadata. Repeated revocation is idempotent and preserves the original revocation time.
func (*Client) RevokeAPIKeyByID ¶ added in v0.26.0
RevokeAPIKeyByID immediately disables an API key without user filtering while retaining its metadata for audit history.
func (*Client) RevokeHostedAgentAPIKeys ¶ added in v0.26.0
RevokeHostedAgentAPIKeys immediately disables every key bound to an instance while retaining the key metadata for audit history.
func (*Client) SetLocalAuthUserPassword ¶ added in v0.24.0
func (c *Client) SetLocalAuthUserPassword(ctx context.Context, id uint, passwordHash string, requirePasswordChange bool) error
SetLocalAuthUserPassword updates a user's password hash and invalidates all of their sessions, so that a password reset actually kicks the old sessions out.
func (*Client) SetModelProxyEnabled ¶ added in v0.26.0
SetModelProxyEnabled uses an atomic upsert so concurrent first writes cannot race to create the singleton. Preserve the existing property encryption path.
func (*Client) SetProperty ¶ added in v0.13.0
func (*Client) SetTempUserCache ¶ added in v0.13.0
func (c *Client) SetTempUserCache(ctx context.Context, user *types.User, authProviderName, authProviderNamespace string) error
SetTempUserCache stores a temporary user in the database for the bootstrap setup flow. Returns an error if a user is already cached.
func (*Client) StoreMDMAssetBundle ¶ added in v0.24.0
StoreMDMAssetBundle stores an immutable source archive under its SHA-256 digest. Re-storing the same archive repairs the stored content.
func (*Client) TokenUsageByUser ¶ added in v0.8.0
func (*Client) TokenUsageForUser ¶ added in v0.8.0
func (*Client) TokenUsageSeriesInRange ¶ added in v0.17.0
func (c *Client) TokenUsageSeriesInRange(ctx context.Context, start, end time.Time) ([]types.RunTokenActivity, error)
TokenUsageSeriesInRange returns all individual token usage records in the time range for all users. Results are ordered by created_at descending. The range is [start, end] inclusive so that the requested end time is the last moment included.
func (*Client) TotalTokenUsageForUser ¶ added in v0.8.0
func (*Client) UpdateAPIKeyLastUsed ¶ added in v0.16.0
UpdateAPIKeyLastUsed updates the last_used_at timestamp for an API key if more than a minute has elapsed since the previous timestamp.
func (*Client) UpdateGroupRoleAssignment ¶ added in v0.15.0
func (c *Client) UpdateGroupRoleAssignment(ctx context.Context, groupName string, role types2.Role, description string) (*types.GroupRoleAssignment, error)
UpdateGroupRoleAssignment updates an existing group role assignment.
func (*Client) UpdateMDMConfiguration ¶ added in v0.24.0
func (c *Client) UpdateMDMConfiguration(ctx context.Context, configuration *types.MDMConfiguration) error
UpdateMDMConfiguration updates a configuration and atomically replaces its rendered artifacts in the same transaction.
func (*Client) UpdateMDMConfigurationEnforcement ¶ added in v0.25.0
func (c *Client) UpdateMDMConfigurationEnforcement(ctx context.Context, id uint, enabled bool, allowlist types2.EnforcementAllowlist, artifacts []types.MDMConfigurationArtifact) error
UpdateMDMConfigurationEnforcement updates only the enforcement policy columns of a configuration and atomically replaces its rendered artifacts in the same transaction, mirroring UpdateMDMConfiguration. The device bundle bakes in the enforcement toggle, so a toggle change must swap in freshly rendered artifacts; a blank configuration (no pinned asset) passes no artifacts and only its columns change.
func (*Client) UpdateProfileIfNeeded ¶ added in v0.8.0
func (*Client) UpdateUser ¶ added in v0.5.0
func (*Client) UpdateUserInternalStatus ¶ added in v0.8.0
func (*Client) UpsertCredential ¶ added in v0.23.0
UpsertCredential creates or replaces a credential identified by context+name.
func (*Client) UserByIDIncludeDeleted ¶ added in v0.9.0
UserByIDIncludeDeleted returns a user by ID including soft-deleted users (for audit purposes)
func (*Client) UserFromProviderUserID ¶ added in v0.24.0
func (c *Client) UserFromProviderUserID(ctx context.Context, providerNamespace, providerName, providerUserID string) (*types.User, error)
UserFromProviderUserID returns a user by their provider user ID
func (*Client) UserFromToken ¶ added in v0.8.0
func (*Client) UserHasIdentityForAuthProvider ¶ added in v0.23.0
func (*Client) UserInfoByID ¶ added in v0.16.0
UserInfoByID returns a user.Info object for the given user ID, suitable for use with ACR helper methods. This fetches the user and their group memberships from the database.
func (*Client) UsersIncludeDeleted ¶ added in v0.9.0
func (c *Client) UsersIncludeDeleted(ctx context.Context, query types.UserQuery) ([]types.User, error)
UsersIncludeDeleted returns all users including soft-deleted ones (for audit purposes)
func (*Client) ValidateAPIKey ¶ added in v0.16.0
ValidateAPIKey validates an API key and returns the associated APIKey record. The key format is: ok1-<user_id>-<key_id>-<secret> Lookup is done by key ID, then bcrypt is used to verify the secret. Cache hits avoid repeating bcrypt but still check persisted lifecycle state so revocation on one server replica takes effect on every replica immediately. On cache misses, last_used_at is updated only if more than a minute has elapsed.
func (*Client) ValidateDeviceEnrollmentCredential ¶ added in v0.24.0
func (c *Client) ValidateDeviceEnrollmentCredential(ctx context.Context, credential string) (*types.DeviceEnrollmentKey, error)
ValidateDeviceEnrollmentCredential parses an ode1-... credential, loads its key, and accepts it when the key exists (scoped to the configuration), is not expired, and the secret matches. Returns the key on success.
func (*Client) ValidateStorageServiceAccountToken ¶ added in v0.21.0
func (*Client) VerifyTokenRequestState ¶ added in v0.26.0
func (c *Client) VerifyTokenRequestState(ctx context.Context, state string) (*types.TokenRequest, error)
VerifyTokenRequestState consumes OAuth state and returns its setup token request.
type CredentialNotFoundError ¶ added in v0.23.0
func (CredentialNotFoundError) Error ¶ added in v0.23.0
func (e CredentialNotFoundError) Error() string
func (CredentialNotFoundError) Unwrap ¶ added in v0.23.0
func (e CredentialNotFoundError) Unwrap() error
type DeviceClientFleetListOptions ¶ added in v0.22.0
type DeviceClientFleetListOptions struct {
// Name, when non-empty after trimming, restricts distinct client names to
// those matching as a case-insensitive substring (LIKE/ILIKE %Name%).
Name string
// SortBy is name | mcp_server_count | skill_count | user_count.
SortBy string
// SortOrder is asc | desc.
SortOrder string
// Limit is the max number of client rows to return; 0 means no limit.
Limit int
// Offset skips that many client names in the selected sort order.
Offset int
}
DeviceClientFleetListOptions configures ListDeviceClientFleetSummaries.
type DeviceClientFleetSkill ¶ added in v0.22.0
DeviceClientFleetSkill is gateway-layer skill metadata for client summaries.
type DeviceClientFleetSummary ¶ added in v0.22.0
type DeviceClientFleetSummary struct {
Name string
Users []string
Skills []DeviceClientFleetSkill
MCPServers []types.MCPServerStat
}
DeviceClientFleetSummary is the gateway-layer aggregate for one client name; callers map it to apiclient types.
type DeviceEnrollment ¶ added in v0.24.0
type DeviceEnrollment struct {
DeviceID string
MDMConfigurationID uint
PublicKey []byte
Hostname string
OS string
OSVersion string
}
DeviceEnrollment is the input to enrolling (or re-enrolling) a device. PublicKey is DER SubjectPublicKeyInfo (PKIX) of the device identity key.
type DeviceLimit ¶ added in v0.25.0
DeviceLimit describes the maximum number of devices an installation may have. Maximum is ignored when Unlimited is true.
type DeviceLimitProvider ¶ added in v0.25.0
type DeviceLimitProvider interface {
DeviceLimit(context.Context) (DeviceLimit, error)
}
DeviceLimitProvider resolves the current license-derived device limit.
type DeviceScanListOptions ¶ added in v0.22.0
type DeviceScanListOptions struct {
SubmittedBy []string
DeviceID []string
Limit int
Offset int
GroupByDevice bool
}
DeviceScanListOptions filters the scan-envelope list endpoint. SubmittedBy and DeviceID are multi-value; either narrows the result.
type DeviceScanStatsOptions ¶ added in v0.22.0
DeviceScanStatsOptions bounds the dashboard rollup. Zero-valued times are treated as unbounded; callers normally pass a recent window (e.g. last 60 days).
type DeviceScanStatsResult ¶ added in v0.22.0
type DeviceScanStatsResult struct {
StartTime time.Time
EndTime time.Time
DeviceCount int64
UserCount int64
Clients []types.ClientStat
MCPServers []types.MCPServerStat
Skills []types.SkillStat
ScanTimestamps []time.Time
}
DeviceScanStatsResult is the dashboard rollup payload.
type EnforcementDecisionOptions ¶ added in v0.25.0
type EnforcementDecisionOptions struct {
MDMConfigurationID []uint
Actor []string // device_id
Agent []string
Server []string // server_name
Tool []string
Kind []string
Decision []string // allow | deny
Query string
StartTime time.Time
EndTime time.Time
Limit int
Offset int
SortBy string
SortOrder string
}
func (EnforcementDecisionOptions) Validate ¶ added in v0.25.0
func (o EnforcementDecisionOptions) Validate() error
Validate reports whether the caller-supplied sort inputs are acceptable. It is exported so the API layer can surface a bad sort key/direction as a 400 rather than letting it fall through to a 500.
type ExplicitRoleError ¶ added in v0.12.0
type ExplicitRoleError struct {
// contains filtered or unexported fields
}
func (*ExplicitRoleError) Error ¶ added in v0.12.0
func (e *ExplicitRoleError) Error() string
type FetchUserGroupsError ¶ added in v0.15.0
FetchUserGroupsError represents an error that occurs when fetching user groups from the auth provider. This error indicates a configuration issue with the auth provider that requires administrator intervention.
func (*FetchUserGroupsError) Error ¶ added in v0.15.0
func (e *FetchUserGroupsError) Error() string
type LLMAuditLogOptions ¶ added in v0.24.0
type LLMAuditLogOptions struct {
WithSensitiveFields bool
HideModelsRequests bool
APIKeyID []uint
UserID []string
ModelProvider []string
TargetModel []string
RequestPath []string
ResponseStatus []int
Outcome []string
UserAgent []string
ClientSessionID []string
MessagePolicyTriggered []bool
Query string
StartTime time.Time
EndTime time.Time
Limit int
Offset int
SortBy string
SortOrder string
}
type LastAdminError ¶ added in v0.5.0
type LastAdminError struct{}
func (*LastAdminError) Error ¶ added in v0.5.0
func (e *LastAdminError) Error() string
type LastOwnerError ¶ added in v0.13.0
type LastOwnerError struct{}
func (*LastOwnerError) Error ¶ added in v0.13.0
func (e *LastOwnerError) Error() string
type ListAuthGroupsOptions ¶ added in v0.25.2
type ListAuthGroupsResult ¶ added in v0.25.2
type ListAuthGroupsResult struct {
Groups []types.Group
NextCursor string
// Source is where the items came from: types.GroupSourceProvider or types.GroupSourceCache.
Source types.GroupSource
// Degraded is true when the auth provider could not be listed and the response fell back to
// cached groups.
Degraded bool
// Reset is true when the supplied cursor could not be honored and these groups are the first
// page of a fresh listing rather than the page that was asked for.
Reset bool
}
type ListCredentialsOptions ¶ added in v0.23.0
type LogoutAllErr ¶ added in v0.8.0
type LogoutAllErr struct{}
func (LogoutAllErr) Error ¶ added in v0.8.0
func (e LogoutAllErr) Error() string
type MCPAuditLogOptions ¶ added in v0.8.0
type MCPAuditLogOptions struct {
// WithRequestAndResponse requests decrypted payload and sensitive environment fields. It must
// only be set after the caller has passed the corresponding authorization check.
WithRequestAndResponse bool
// SourceTypes selects the persisted source kinds. Empty preserves the MCP-only default.
SourceTypes []types2.AuditLogSourceType
// PowerUserWorkspaceID and OwnServerMCPIDs define the authorized MCP-server scope. When both
// are present, a row may match either scope.
PowerUserWorkspaceID []string
OwnServerMCPIDs []string
// APIKeyID, UserID, SessionID, and ClientIP are common filters shared by both sources.
APIKeyID []uint
UserID []string
SessionID []string
ClientIP []string
// ProcessingTimeMin and ProcessingTimeMax filter the normalized duration field, using MCP
// processing time or local-agent duration as appropriate.
ProcessingTimeMin int64
ProcessingTimeMax int64
// MCP-only filters.
MCPID []string
MCPServerDisplayName []string
MCPServerCatalogEntryName []string
CallType []string
CallIdentifier []string
ClientName []string
ClientVersion []string
ResponseStatus []string
// Local-agent tool-call filters.
AgentProvider []string
Status []string
ToolName []string
ToolKind []string
DeviceID []string
// Unified, source-agnostic filters used by the audit log UI.
//
// Actor matches user_id OR device_id (users and enrolled devices).
// Operation matches MCP call_type; local-agent rows have the implicit operation tools/call.
// MCPServer matches MCP mcp_id/mcp_server_display_name, or a local-agent row's MCP parent.
// Tool matches MCP call_identifier or a local-agent action_name.
// Outcome matches the normalized outcome (success/failure/denied/timeout/unknown); MCP rows
// are classified from response_status/error the same way ClassifyMCPOutcome does.
// Client matches MCP client_name or local-agent agent_provider.
Actor []string
Operation []string
MCPServer []string
Tool []string
Outcome []string
Client []string
// Query searches the non-sensitive text columns of every selected source and matching user
// display names.
Query string
StartTime time.Time
EndTime time.Time
Limit int
Offset int
// SortBy accepts timestamp, event_type, outcome, and duration for mixed queries. A single-source
// query may additionally use that source's allowlisted storage columns.
SortBy string
// SortOrder accepts asc or desc. Empty defaults to descending.
SortOrder string
}
MCPAuditLogOptions configures audit-row queries across MCP and local-agent catalogs. Common filters apply to every selected source. MCP-only and local-agent-only filters are mutually exclusive; ValidateAuditLogOptions enforces those rules before a query runs.
type MCPUsageStatsOptions ¶ added in v0.8.0
type MCPUsageStatsOptions struct {
MCPID string
PowerUserWorkspaceID []string // Workspace filtering support (same as audit logs)
OwnServerMCPIDs []string // MCPIDs for user's own servers (union with PowerUserWorkspaceID)
UserIDs []string
MCPServerDisplayNames []string
MCPServerCatalogEntryNames []string
StartTime time.Time
EndTime time.Time
}
MCPUsageStatsOptions represents options for querying MCP usage statistics
type MessagePolicyViolationDirectionCounts ¶ added in v0.19.0
type MessagePolicyViolationOptions ¶ added in v0.19.0
type MessagePolicyViolationOptions struct {
UserID []string
PolicyID []string
Direction []string
ProjectID []string
ThreadID []string
Query string
StartTime time.Time
EndTime time.Time
Limit int
Offset int
SortBy string
SortOrder string
TimeGroupBy string // "user" or "policy" (default)
}
MessagePolicyViolationOptions represents options for querying policy violations.
type MessagePolicyViolationPolicyCount ¶ added in v0.19.0
type MessagePolicyViolationStats ¶ added in v0.19.0
type MessagePolicyViolationStats struct {
ByTime []MessagePolicyViolationTimeBucket `json:"byTime"`
ByPolicy []MessagePolicyViolationPolicyCount `json:"byPolicy"`
ByUser []MessagePolicyViolationUserCount `json:"byUser"`
ByDirection MessagePolicyViolationDirectionCounts `json:"byDirection"`
}
MessagePolicyViolationStats holds the aggregated stats returned by GetMessagePolicyViolationStats.
type MessagePolicyViolationTimeBucket ¶ added in v0.19.0
type MessagePolicyViolationUserCount ¶ added in v0.19.0
type SkillStatListOptions ¶ added in v0.22.0
type SkillStatListOptions struct {
StartTime time.Time
EndTime time.Time
Name string // case-insensitive LIKE match against skill name
SortBy string // name | device_count | user_count | observation_count
SortOrder string // asc | desc
Limit int
Offset int
}
SkillStatListOptions filters and orders the paginated skill stats list. The time window applies to the parent device_scans (only scans inside the window are candidates for "latest per device" selection). Zero-valued bounds are treated as unbounded.
type UserDecorator ¶
type UserDecorator struct {
// contains filtered or unexported fields
}
func NewUserDecorator ¶
func NewUserDecorator(next authenticator.Request, client *Client, userLimitProvider UserLimitProvider) *UserDecorator
func (UserDecorator) AuthenticateRequest ¶
func (u UserDecorator) AuthenticateRequest(req *http.Request) (*authenticator.Response, bool, error)
Source Files
¶
- apiactivity.go
- apikey.go
- audit_api_key_filter.go
- auditlogpersister.go
- auth.go
- client.go
- credential.go
- credential_migration.go
- device.go
- devicescan.go
- devicescancleanup.go
- enforcementdecision.go
- enforcementdecisionpersister.go
- error.go
- group.go
- grouproleassignment.go
- identity.go
- image.go
- llmauditlog.go
- localauth.go
- mcpauditlog.go
- mcpoauthtoken.go
- mdmassetbundle.go
- mdmconfiguration.go
- messagepolicyviolation.go
- modelproxy.go
- producttelemetry.go
- property.go
- retention.go
- serviceaccount.go
- session.go
- tempsetupuser.go
- token.go
- tokenactivity.go
- user.go