Documentation
¶
Index ¶
Constants ¶
View Source
const ( ErrBadRequest = errors.Sentinel("kind: bad request") ErrValidation = errors.Sentinel("kind: validation failed") ErrForbidden = errors.Sentinel("kind: forbidden") ErrNotFound = errors.Sentinel("kind: not found") ErrConflict = errors.Sentinel("kind: conflict") ErrTimeout = errors.Sentinel("kind: timeout") )
Variables ¶
View Source
var ( ErrInvalidToken = errors.Sentinel("invalid token") ErrExpiredToken = errors.Sentinel("token expired") ErrTokenVersionMismatch = errors.Sentinel("token version mismatch") ErrUserNotFound = errors.Sentinel("user not found") ErrAmbiguousUserEmail = Classify(ErrConflict, errors.Sentinel("multiple accounts share this email")) ErrTokenValidation = Classify(ErrUnauthorized, errors.Sentinel("Invalid token claims")) ErrSessionRevoked = Classify(ErrUnauthorized, errors.Sentinel("Session has been revoked")) ErrUpgradeInProgress = Classify(ErrConflict, errors.Sentinel("an upgrade is already in progress")) ErrUpdateAllInProgress = Classify(ErrConflict, errors.Sentinel("an update-all job is already in progress")) ErrTemplateNotFound = Classify(ErrNotFound, errors.Sentinel("Template not found")) ErrInvalidEnvKey = Classify(ErrValidation, errors.Sentinel("Invalid environment key")) ErrGlobalVariableNotFound = Classify(ErrNotFound, errors.Sentinel("Global variable not found")) ErrGlobalVariableConflict = Classify(ErrConflict, errors.Sentinel("Global variable already exists")) ErrGlobalVariableScopeRequired = Classify(ErrValidation, errors.Sentinel("At least one environment is required when a variable is not scoped to all environments")) ErrGlobalVariableSecretValueRequired = Classify(ErrValidation, errors.Sentinel("A new value is required when making a secret variable readable")) ErrSwarmNotEnabled = Classify(ErrBadRequest, errors.Sentinel("Swarm mode is not enabled")) ErrSwarmManagerRequired = Classify(ErrForbidden, errors.Sentinel("Swarm manager access required")) ErrRoleNotFound = Classify(ErrNotFound, errors.Sentinel("Role not found")) ErrRoleBuiltIn = Classify(ErrForbidden, errors.Sentinel("Built-in role cannot be modified")) ErrRoleNameTaken = Classify(ErrConflict, errors.Sentinel("Role name already in use")) ErrUnknownPermission = Classify(ErrValidation, errors.Sentinel("Unknown permission")) ErrRolePermissionEscalation = Classify(ErrForbidden, errors.Sentinel("cannot grant a permission you do not hold")) ErrInvalidRoleAssignment = Classify(ErrBadRequest, errors.Sentinel("invalid role assignment")) ErrFederatedCredentialNotFound = Classify(ErrNotFound, errors.Sentinel("federated credential not found")) ErrFederatedCredentialInvalid = Classify(ErrValidation, errors.Sentinel("invalid federated credential")) ErrFederatedCredentialInvalidRequest = Classify(ErrBadRequest, errors.Sentinel("invalid federated token exchange request")) ErrFederatedCredentialInvalidGrant = Classify(ErrUnauthorized, errors.Sentinel("invalid federated token grant")) ErrFederatedCredentialPermissionEscalation = Classify(ErrForbidden, errors.Sentinel("cannot map a federated credential to a role you do not hold")) ErrOidcMappingNotFound = Classify(ErrNotFound, errors.Sentinel("OIDC role mapping not found")) ErrOidcMappingEnvManaged = Classify(ErrConflict, errors.Sentinel("OIDC role mapping is managed by OIDC_ROLE_MAPPINGS and cannot be edited at runtime")) ErrNoGlobalAdminRemains = Classify(ErrConflict, errors.Sentinel("At least one user must retain a global Admin role assignment")) ErrProjectNotFound = Classify(ErrNotFound, errors.Sentinel("Project not found")) ErrProjectArchived = Classify(ErrConflict, errors.Sentinel("project is archived and must be unarchived before this action")) ErrProjectMustBeStopped = Classify(ErrConflict, errors.Sentinel("project must be stopped before archiving")) ErrProjectWorkspaceConflict = Classify(ErrConflict, errors.Sentinel("Project workspace changed; refresh it and try again")) ErrProjectWorkspaceForbidden = Classify(ErrForbidden, errors.Sentinel("Forbidden project workspace path")) ErrProjectWorkspaceBadRequest = Classify(ErrBadRequest, errors.Sentinel("Invalid project workspace request")) ErrProjectWorkspaceNotFound = Classify(ErrNotFound, errors.Sentinel("Project workspace file not found")) ErrVolumeWorkspaceConflict = Classify(ErrConflict, errors.Sentinel("Volume workspace changed; refresh it and try again")) ErrVolumeWorkspaceForbidden = Classify(ErrForbidden, errors.Sentinel("Forbidden volume workspace path")) ErrVolumeWorkspaceBadRequest = Classify(ErrBadRequest, errors.Sentinel("Invalid volume workspace request")) ErrVolumeWorkspaceNotFound = Classify(ErrNotFound, errors.Sentinel("Volume workspace file not found")) ErrProjectComposeFileNotFound = Classify(ErrNotFound, errors.Sentinel("Project compose file not found")) ErrComposeFileNotFound = Classify(ErrNotFound, errors.Sentinel("no compose file found")) ErrEnvironmentInvalidProxyTarget = Classify(ErrBadRequest, errors.Sentinel("Invalid proxy target URL")) ErrEnvironmentConnectionTestFailed = Classify(ErrBadRequest, errors.Sentinel("Environment connection test failed")) ErrUnsafeRemoteURL = Classify(ErrBadRequest, errors.Sentinel("Remote URL is not allowed")) ErrImageScanInProgress = Classify(ErrConflict, errors.Sentinel("an image update check is already in progress")) ErrInvalidNotificationPayloadTemplate = Classify(ErrValidation, errors.Sentinel("invalid generic webhook payload template")) ErrRedeployAfterSyncFailed = errors.Sentinel("redeploy failed") ErrGitOpsSyncProjectBindingBroken = errors.Sentinel("GitOps sync project binding broken") ErrUploadSessionNotFound = Classify(ErrNotFound, errors.Sentinel("Upload session not found")) ErrUploadSessionIncomplete = Classify(ErrConflict, errors.Sentinel("Upload session is incomplete")) ErrUploadKindMismatch = Classify(ErrBadRequest, errors.Sentinel("Upload session kind does not match this endpoint")) ErrUploadChunkInvalid = Classify(ErrValidation, errors.Sentinel("Invalid upload chunk")) ErrUploadSessionInvalid = Classify(ErrValidation, errors.Sentinel("Invalid upload session request")) )
View Source
var SystemUser = User{
Username: "System",
}
SystemUser is the actor recorded for work Arcane performs on its own behalf — scheduled jobs, startup reconciliation, GitOps syncs — rather than in response to a signed-in user.
Functions ¶
Types ¶
type APIError ¶ added in v2.8.1
type APIError struct {
Message string `json:"message"`
Code APIErrorCode `json:"code"`
StatusCode int `json:"statusCode"`
Details any `json:"details,omitempty"`
}
func NewAPIError ¶ added in v2.8.1
func NewAPIError(message string, code APIErrorCode, statusCode int) *APIError
NewAPIError creates a new APIError
func NewAPIErrorWithDetails ¶ added in v2.8.1
func NewAPIErrorWithDetails(message string, code APIErrorCode, statusCode int, details any) *APIError
func ToAPIError ¶ added in v2.8.1
func (*APIError) HTTPStatus ¶ added in v2.8.1
type APIErrorCode ¶ added in v2.8.1
type APIErrorCode string
const ( APIErrorCodeBadRequest APIErrorCode = "BAD_REQUEST" APIErrorCodeForbidden APIErrorCode = "FORBIDDEN" APIErrorCodeNotFound APIErrorCode = "NOT_FOUND" APIErrorCodeConflict APIErrorCode = "CONFLICT" APIErrorCodeInternalServerError APIErrorCode = "INTERNAL_SERVER_ERROR" APIErrorCodeDockerAPIError APIErrorCode = "DOCKER_API_ERROR" APIErrorCodeValidationError APIErrorCode = "VALIDATION_ERROR" APIErrorCodeTimeout APIErrorCode = "TIMEOUT" )
type APIErrorResponse ¶ added in v2.8.1
type APIErrorResponse struct {
Success bool `json:"success"`
Error string `json:"error"`
Code APIErrorCode `json:"code"`
Details any `json:"details,omitempty"`
}
type APISuccessResponse ¶ added in v2.8.1
type CurrentUserContextKey ¶ added in v2.8.1
type CurrentUserContextKey struct{}
CurrentUserContextKey is the context key holding the authenticated user model, set via context.WithValue(ctx, common.CurrentUserContextKey{}, user). It lives here (rather than in transport middleware) so that services, which cannot import the middleware package, can read the requesting user for per-user preferences.
type DockerAPIError ¶ added in v2.8.1
func (*DockerAPIError) Error ¶ added in v2.8.1
func (e *DockerAPIError) Error() string
func (*DockerAPIError) HTTPStatus ¶ added in v2.8.1
func (e *DockerAPIError) HTTPStatus() int
type User ¶ added in v2.8.1
type User struct {
database.BaseModel
Username string `json:"username" sortable:"true"`
PasswordHash string `json:"-" gorm:"column:password_hash"`
DisplayName *string `json:"displayName,omitempty" gorm:"column:display_name" sortable:"true"`
Email *string `json:"email,omitempty" sortable:"true"`
OidcSubjectId *string `json:"oidcSubjectId,omitempty" gorm:"column:oidc_subject_id"`
LastLogin *time.Time `json:"lastLogin,omitempty" gorm:"column:last_login" sortable:"true"`
Locale *string `json:"locale,omitempty" gorm:"column:locale"`
TimeFormat user.TimeFormat `json:"timeFormat" gorm:"column:time_format;not null;default:auto"`
FontSize *int `json:"fontSize,omitempty" gorm:"column:font_size"`
Preferences user.Preferences `json:"preferences" gorm:"column:preferences;serializer:json"`
RequiresPasswordChange bool `json:"requiresPasswordChange" gorm:"column:requires_password_change"`
IsServiceAccount bool `json:"isServiceAccount" gorm:"column:is_service_account;not null;default:false"`
PasskeyMFAEnabled bool `json:"passkeyMfaEnabled" gorm:"column:passkey_mfa_enabled;not null;default:false"`
// Avatar metadata
HasAvatar bool `json:"hasAvatar" gorm:"column:has_avatar;not null;default:false"`
// OIDC provider tokens
OidcAccessToken *string `json:"-" gorm:"type:text"`
OidcRefreshToken *string `json:"-" gorm:"type:text"`
OidcAccessTokenExpiresAt *time.Time `json:"-"`
}
func CurrentUserFromContext ¶ added in v2.8.1
CurrentUserFromContext retrieves the authenticated user from the context. Returns nil, false on unauthenticated paths (background jobs, agent proxying).
Click to show internal directories.
Click to hide internal directories.