Help us shape the future of Go! Take the 2026 Go Developer Survey

daemon

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: Apache-2.0 Imports: 67 Imported by: 0

Documentation

Overview

AMI operations handlers for Universal AMI System (Phase 5.1 Week 2)

AWS Compliance API handlers for Prism daemon

Package daemon provides credential error detection for graceful handling

Package daemon provides the daemon server implementation

Package daemon provides invitation management API handlers for Prism v0.5.11+

This file implements REST API endpoints for the user invitation system, enabling project owners to invite collaborators via email.

Package daemon provides profile manager adapter for invitation validation

Marketplace operations handlers for Template Marketplace Integration (Phase 5.1 Week 3)

Package daemon provides AWS credential middleware

Package daemon provides rate limiting API handlers

Package daemon provides rate limiting for instance launch operations

Security API handlers for Prism daemon

Package daemon provides shared token management API handlers for Prism v0.5.13+

This file implements REST API endpoints for the shared token system, enabling project owners to create tokens that multiple users can redeem.

Package daemon provides singleton enforcement for the Prism daemon.

This ensures only one daemon process runs at a time and handles graceful shutdown of old processes when a new daemon starts.

Package daemon provides sleep/wake monitoring REST API handlers

Package daemon provides sleep/wake monitoring integration

Index

Constants

View Source
const (
	// PIDFileName is the name of the PID file
	PIDFileName = "prismd.pid"

	// ShutdownTimeout is how long to wait for graceful shutdown
	ShutdownTimeout = 10 * time.Second

	// ForceKillTimeout is how long to wait before force kill
	ForceKillTimeout = 15 * time.Second
)

Variables

View Source
var ErrUserManagerNotInitialized = errors.New("user manager not initialized")

Functions

func GetConfigPath

func GetConfigPath() string

getConfigPath returns the standard daemon configuration file path GetConfigPath returns the path to the daemon configuration file

func SaveConfig

func SaveConfig(config *Config) error

SaveConfig saves daemon configuration to the standard location

Types

type APIVersion

type APIVersion struct {
	// Version identifier (e.g., "v1", "v2")
	Version string

	// Status of this version (stable, beta, alpha, deprecated)
	Status string

	// IsDefault indicates if this is the default version to use when no version is specified
	IsDefault bool

	// ReleaseDate is when this version was released
	ReleaseDate time.Time

	// DeprecationDate is when this version was deprecated (if applicable)
	DeprecationDate *time.Time

	// SunsetDate is when this version will be removed (if applicable)
	SunsetDate *time.Time

	// DocsURL is the documentation URL for this version
	DocsURL string
}

APIVersion represents a specific API version

type APIVersionManager

type APIVersionManager struct {
	// contains filtered or unexported fields
}

APIVersionManager manages API versions and routing

func NewAPIVersionManager

func NewAPIVersionManager(basePath string) *APIVersionManager

NewAPIVersionManager creates a new API version manager

func (*APIVersionManager) AddVersion

func (m *APIVersionManager) AddVersion(version APIVersion)

AddVersion adds a new API version to the manager

func (*APIVersionManager) BuildVersionedPath

func (m *APIVersionManager) BuildVersionedPath(path, version string) string

BuildVersionedPath builds a properly versioned path Example: BuildVersionedPath("instances", "v2") -> "/api/v2/instances"

func (*APIVersionManager) ExtractVersionFromPath

func (m *APIVersionManager) ExtractVersionFromPath(path string) string

ExtractVersionFromPath extracts the version string from a URL path Example: "/api/v1/instances" -> "v1"

func (*APIVersionManager) GetDefaultVersion

func (m *APIVersionManager) GetDefaultVersion() string

GetDefaultVersion returns the default API version

func (*APIVersionManager) GetLatestVersion

func (m *APIVersionManager) GetLatestVersion() string

GetLatestVersion returns the latest API version (may be alpha/beta)

func (*APIVersionManager) GetStableVersion

func (m *APIVersionManager) GetStableVersion() string

GetStableVersion returns the current stable API version

func (*APIVersionManager) GetSupportedVersions

func (m *APIVersionManager) GetSupportedVersions() []APIVersion

GetSupportedVersions returns all supported API versions

func (*APIVersionManager) GetVersion

func (m *APIVersionManager) GetVersion(version string) (APIVersion, bool)

GetVersion returns details about an API version

func (*APIVersionManager) NormalizePath

func (m *APIVersionManager) NormalizePath(path, version string) string

NormalizePath standardizes the path format for a given version Example: "/instances" -> "/api/v1/instances" (for default version v1)

func (*APIVersionManager) TranslateRequestPath

func (m *APIVersionManager) TranslateRequestPath(path, version string) string

TranslateRequestPath translates a request path based on API version This allows API evolution by mapping newer API calls to older implementations when needed Example: "/api/v2/instances" might map to a different handler than "/api/v1/instances"

func (*APIVersionManager) VersionHeaderMiddleware

func (m *APIVersionManager) VersionHeaderMiddleware(next http.Handler) http.Handler

VersionHeaderMiddleware adds versioning information to response headers

func (*APIVersionManager) VersionRoutingMiddleware

func (m *APIVersionManager) VersionRoutingMiddleware(next http.Handler) http.Handler

VersionRoutingMiddleware handles routing based on API version

type CircuitBreaker

type CircuitBreaker struct {
	Name             string
	FailureCount     int
	LastFailure      time.Time
	State            CircuitBreakerState
	FailureThreshold int
	ResetTimeout     time.Duration
}

CircuitBreaker prevents cascade failures

type CircuitBreakerState

type CircuitBreakerState string

CircuitBreakerState represents circuit breaker states

const (
	CircuitBreakerClosed   CircuitBreakerState = "closed"
	CircuitBreakerOpen     CircuitBreakerState = "open"
	CircuitBreakerHalfOpen CircuitBreakerState = "half_open"
)

type CleanupRequest

type CleanupRequest struct {
	ForceKill bool `json:"force_kill,omitempty"`
	RemoveAll bool `json:"remove_all,omitempty"`
}

CleanupRequest represents a request for daemon cleanup

type CleanupResponse

type CleanupResponse struct {
	ProcessesFound   int      `json:"processes_found"`
	ProcessesCleaned int      `json:"processes_cleaned"`
	ProcessesFailed  int      `json:"processes_failed"`
	FailedProcesses  []int    `json:"failed_processes,omitempty"`
	FilesRemoved     []string `json:"files_removed,omitempty"`
	Status           string   `json:"status"`
	Message          string   `json:"message"`
}

CleanupResponse represents the response for cleanup operations

type CloudInitStatus

type CloudInitStatus struct {
	Status      string // "running", "done", "error", "disabled"
	Description string
	Errors      []string
}

CloudInitStatus represents cloud-init status

type Config

type Config struct {
	// Instance retention settings
	InstanceRetentionMinutes int `json:"instance_retention_minutes"` // 0 = indefinite, >0 = minutes to retain terminated instances

	// Server settings
	Port string `json:"port,omitempty"` // Server port (default: 8947)

	// Monitoring settings (future expansion)
	MonitoringIntervalSeconds int `json:"monitoring_interval_seconds,omitempty"` // Future: monitoring frequency
}

Config represents daemon configuration options

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default daemon configuration

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig loads daemon configuration from the standard location

func (*Config) GetRetentionDuration

func (c *Config) GetRetentionDuration() time.Duration

GetRetentionDuration returns the retention duration from config

type CreateTunnelsRequest

type CreateTunnelsRequest struct {
	InstanceName string   `json:"instance_name"`
	Services     []string `json:"services,omitempty"` // If empty, create all
}

CreateTunnelsRequest is the request to create tunnels

type CreateTunnelsResponse

type CreateTunnelsResponse struct {
	Tunnels []TunnelInfo `json:"tunnels"`
	Message string       `json:"message"`
}

CreateTunnelsResponse is the response from creating tunnels

type DaemonHealthSummary

type DaemonHealthSummary struct {
	Status          HealthStatus  `json:"status"`
	Score           float64       `json:"score"`
	LastChecked     time.Time     `json:"last_checked"`
	SystemMetrics   SystemMetrics `json:"system_metrics"`
	ActiveChecks    int           `json:"active_checks"`
	FailedChecks    int           `json:"failed_checks"`
	CriticalIssues  []string      `json:"critical_issues"`
	Recommendations []string      `json:"recommendations"`
}

DaemonHealthSummary provides overall daemon health summary

type DaemonProfileAdapter

type DaemonProfileAdapter struct{}

DaemonProfileAdapter adapts the profile manager for daemon use

func (*DaemonProfileAdapter) GetCurrentProfile

func (d *DaemonProfileAdapter) GetCurrentProfile() (string, error)

func (*DaemonProfileAdapter) GetProfileConfig

func (d *DaemonProfileAdapter) GetProfileConfig(profileID string) (interface{}, error)

func (*DaemonProfileAdapter) UpdateProfileConfig

func (d *DaemonProfileAdapter) UpdateProfileConfig(profileID string, config interface{}) error

type DaemonRegistry

type DaemonRegistry struct {
	Processes   []ProcessInfo `json:"processes"`
	LastUpdated time.Time     `json:"last_updated"`
	Version     string        `json:"version"`
}

DaemonRegistry represents the daemon registry for tracking instances

type DefaultProcessManager

type DefaultProcessManager struct {
	// contains filtered or unexported fields
}

DefaultProcessManager implements ProcessManager interface

func (*DefaultProcessManager) CleanupProcesses

func (pm *DefaultProcessManager) CleanupProcesses() error

CleanupProcesses performs comprehensive cleanup of all daemon processes

func (*DefaultProcessManager) FindDaemonProcesses

func (pm *DefaultProcessManager) FindDaemonProcesses() ([]ProcessInfo, error)

FindDaemonProcesses discovers all running Prism daemon processes

func (*DefaultProcessManager) ForceKill

func (pm *DefaultProcessManager) ForceKill(pid int) error

ForceKill forcefully terminates a daemon process

func (*DefaultProcessManager) GetPIDFilePath

func (pm *DefaultProcessManager) GetPIDFilePath() string

GetPIDFilePath returns the path to the PID file

func (*DefaultProcessManager) GetRegistryPath

func (pm *DefaultProcessManager) GetRegistryPath() string

GetRegistryPath returns the path to the registry file

func (*DefaultProcessManager) GracefulShutdown

func (pm *DefaultProcessManager) GracefulShutdown(pid int) error

GracefulShutdown attempts graceful shutdown of a daemon process

func (*DefaultProcessManager) IsProcessRunning

func (pm *DefaultProcessManager) IsProcessRunning(pid int) bool

IsProcessRunning checks if a process is currently running

func (*DefaultProcessManager) RegisterDaemon

func (pm *DefaultProcessManager) RegisterDaemon(pid int, configPath, logPath string) error

RegisterDaemon registers a daemon process in the registry

func (*DefaultProcessManager) UnregisterDaemon

func (pm *DefaultProcessManager) UnregisterDaemon(pid int) error

UnregisterDaemon removes a daemon process from the registry

func (*DefaultProcessManager) WaitForShutdown

func (pm *DefaultProcessManager) WaitForShutdown(pid int, timeout time.Duration) error

WaitForShutdown waits for a process to shut down within timeout

type ErrorRecord

type ErrorRecord struct {
	Timestamp time.Time     `json:"timestamp"`
	ErrorType string        `json:"error_type"`
	Message   string        `json:"message"`
	Component string        `json:"component"`
	Severity  ErrorSeverity `json:"severity"`
	Count     int           `json:"count"`
	Recovered bool          `json:"recovered"`
}

ErrorRecord tracks error occurrences for analysis

type ErrorSeverity

type ErrorSeverity string

ErrorSeverity represents error severity levels

const (
	ErrorSeverityLow      ErrorSeverity = "low"
	ErrorSeverityMedium   ErrorSeverity = "medium"
	ErrorSeverityHigh     ErrorSeverity = "high"
	ErrorSeverityCritical ErrorSeverity = "critical"
)

type GetGroupUsersHandler

type GetGroupUsersHandler struct{}

GetGroupUsersHandler handles GET requests for group users

func (*GetGroupUsersHandler) CanHandle

func (h *GetGroupUsersHandler) CanHandle(method string) bool

func (*GetGroupUsersHandler) Handle

func (h *GetGroupUsersHandler) Handle(w http.ResponseWriter, r *http.Request, id string, server *Server) error

type GroupUsersHandler

type GroupUsersHandler interface {
	CanHandle(method string) bool
	Handle(w http.ResponseWriter, r *http.Request, id string, server *Server) error
}

GroupUsersHandler interface for different HTTP methods (Strategy Pattern - SOLID)

type GroupUsersMethodDispatcher

type GroupUsersMethodDispatcher struct {
	// contains filtered or unexported fields
}

GroupUsersMethodDispatcher manages HTTP method handlers (Strategy Pattern - SOLID)

func NewGroupUsersMethodDispatcher

func NewGroupUsersMethodDispatcher() *GroupUsersMethodDispatcher

NewGroupUsersMethodDispatcher creates group users method dispatcher

func (*GroupUsersMethodDispatcher) Dispatch

func (d *GroupUsersMethodDispatcher) Dispatch(w http.ResponseWriter, r *http.Request, id string, server *Server)

Dispatch handles request using appropriate handler

type HTTPServer

type HTTPServer interface {
	Shutdown(ctx context.Context) error
}

HTTPServer interface to avoid circular dependency

type HealthCheck

type HealthCheck struct {
	Name        string                   `json:"name"`
	Description string                   `json:"description"`
	CheckFunc   func() HealthCheckResult `json:"-"`
	Interval    time.Duration            `json:"interval"`
	Timeout     time.Duration            `json:"timeout"`
	Critical    bool                     `json:"critical"`
	LastRun     time.Time                `json:"last_run"`
	LastResult  HealthCheckResult        `json:"last_result"`
}

HealthCheck represents a health check function

type HealthCheckResult

type HealthCheckResult struct {
	Status    HealthStatus           `json:"status"`
	Message   string                 `json:"message"`
	Duration  time.Duration          `json:"duration"`
	Error     string                 `json:"error,omitempty"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
	CheckedAt time.Time              `json:"checked_at"`
}

HealthCheckResult represents the result of a health check

type HealthMonitor

type HealthMonitor struct {
	// contains filtered or unexported fields
}

HealthMonitor provides comprehensive daemon health monitoring

func NewHealthMonitor

func NewHealthMonitor(stateManager StateManager, stabilityMgr *StabilityManager, recoveryMgr *RecoveryManager, monitor *monitoring.PerformanceMonitor) *HealthMonitor

NewHealthMonitor creates a new health monitor

func (*HealthMonitor) AddHealthCheck

func (hm *HealthMonitor) AddHealthCheck(name string, check HealthCheck)

AddHealthCheck adds a custom health check

func (*HealthMonitor) GetHealthHistory

func (hm *HealthMonitor) GetHealthHistory() []HealthSnapshot

GetHealthHistory returns recent health history

func (*HealthMonitor) GetHealthSummary

func (hm *HealthMonitor) GetHealthSummary() DaemonHealthSummary

GetHealthSummary returns current health summary

func (*HealthMonitor) HandleDetailedHealthEndpoint

func (hm *HealthMonitor) HandleDetailedHealthEndpoint(w http.ResponseWriter, r *http.Request)

HandleDetailedHealthEndpoint handles detailed health endpoint

func (*HealthMonitor) HandleHealthEndpoint

func (hm *HealthMonitor) HandleHealthEndpoint(w http.ResponseWriter, r *http.Request)

HandleHealthEndpoint handles HTTP health endpoint

func (*HealthMonitor) IsHealthy

func (hm *HealthMonitor) IsHealthy() bool

IsHealthy returns current health status

func (*HealthMonitor) RemoveHealthCheck

func (hm *HealthMonitor) RemoveHealthCheck(name string)

RemoveHealthCheck removes a health check

func (*HealthMonitor) Start

func (hm *HealthMonitor) Start(ctx context.Context)

Start begins health monitoring

type HealthSnapshot

type HealthSnapshot struct {
	Timestamp      time.Time                    `json:"timestamp"`
	OverallStatus  HealthStatus                 `json:"overall_status"`
	CheckResults   map[string]HealthCheckResult `json:"check_results"`
	SystemMetrics  SystemMetrics                `json:"system_metrics"`
	StabilityScore float64                      `json:"stability_score"`
}

HealthSnapshot represents a point-in-time health snapshot

type HealthStatus

type HealthStatus string

HealthStatus represents health check status

const (
	HealthStatusHealthy   HealthStatus = "healthy"
	HealthStatusDegraded  HealthStatus = "degraded"
	HealthStatusUnhealthy HealthStatus = "unhealthy"
	HealthStatusUnknown   HealthStatus = "unknown"
)

type LaunchProgressMonitor

type LaunchProgressMonitor struct {
	// contains filtered or unexported fields
}

LaunchProgressMonitor monitors instance setup progress via SSH

func NewLaunchProgressMonitor

func NewLaunchProgressMonitor(instance *types.Instance, sshKeyPath, username string) *LaunchProgressMonitor

NewLaunchProgressMonitor creates a new progress monitor

func (*LaunchProgressMonitor) GetProgress

func (m *LaunchProgressMonitor) GetProgress() float64

GetProgress returns the overall progress percentage

func (*LaunchProgressMonitor) GetStages

func (m *LaunchProgressMonitor) GetStages() []types.ProgressStage

GetStages returns the current progress stages

func (*LaunchProgressMonitor) Start

Start begins monitoring the instance setup progress

type MetricStats

type MetricStats struct {
	Average float64
	Maximum float64
	Minimum float64
	P95     float64
	P99     float64
	Count   int
}

MetricStats holds statistical analysis of metric datapoints

type Operation

type Operation string

Operation represents an operation type

const (
	// OperationCreate represents a create operation
	OperationCreate Operation = "create"

	// OperationRead represents a read operation
	OperationRead Operation = "read"

	// OperationUpdate represents an update operation
	OperationUpdate Operation = "update"

	// OperationDelete represents a delete operation
	OperationDelete Operation = "delete"

	// OperationList represents a list operation
	OperationList Operation = "list"

	// OperationManage represents a management operation
	OperationManage Operation = "manage"
)

type Permission

type Permission struct {
	// Resource is the resource type
	Resource Resource

	// Operation is the operation type
	Operation Operation

	// MinimumLevel is the minimum permission level required
	MinimumLevel PermissionLevel
}

Permission represents a permission check

type PermissionLevel

type PermissionLevel int

PermissionLevel represents an access level for an operation

const (
	// PermissionNone represents no access
	PermissionNone PermissionLevel = iota

	// PermissionRead represents read access
	PermissionRead

	// PermissionWrite represents write access (includes read)
	PermissionWrite

	// PermissionAdmin represents administrative access (includes read and write)
	PermissionAdmin
)

type PolicyAssignRequest

type PolicyAssignRequest struct {
	PolicySet string `json:"policy_set"`
	UserID    string `json:"user_id,omitempty"`
}

PolicyAssignRequest represents a policy assignment request

type PolicyAssignResponse

type PolicyAssignResponse struct {
	Success           bool   `json:"success"`
	Message           string `json:"message"`
	AssignedPolicySet string `json:"assigned_policy_set"`
	EnforcementStatus string `json:"enforcement_status"`
}

PolicyAssignResponse represents the response to a policy assignment

type PolicyCheckRequest

type PolicyCheckRequest struct {
	TemplateName string `json:"template_name"`
	UserID       string `json:"user_id,omitempty"`
}

PolicyCheckRequest represents a template access check request

type PolicyCheckResponse

type PolicyCheckResponse struct {
	Allowed         bool     `json:"allowed"`
	TemplateName    string   `json:"template_name"`
	Reason          string   `json:"reason"`
	MatchedPolicies []string `json:"matched_policies,omitempty"`
	Suggestions     []string `json:"suggestions,omitempty"`
}

PolicyCheckResponse represents the result of a policy check

type PolicyEnforcementRequest

type PolicyEnforcementRequest struct {
	Enabled bool `json:"enabled"`
}

PolicyEnforcementRequest represents an enforcement state change request

type PolicyEnforcementResponse

type PolicyEnforcementResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
	Enabled bool   `json:"enabled"`
	Status  string `json:"status"`
}

PolicyEnforcementResponse represents the response to enforcement changes

type PolicySetInfo

type PolicySetInfo struct {
	ID          string            `json:"id"`
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Policies    int               `json:"policies"`
	Status      string            `json:"status"`
	Tags        map[string]string `json:"tags,omitempty"`
}

PolicySetInfo provides information about a policy set

type PolicySetsResponse

type PolicySetsResponse struct {
	PolicySets map[string]PolicySetInfo `json:"policy_sets"`
}

PolicySetsResponse represents available policy sets

type PolicyStatusResponse

type PolicyStatusResponse struct {
	Enabled          bool     `json:"enabled"`
	Status           string   `json:"status"`
	StatusIcon       string   `json:"status_icon"`
	AssignedPolicies []string `json:"assigned_policies"`
	Message          string   `json:"message,omitempty"`
}

PolicyStatusResponse represents the policy enforcement status

type ProcessInfo

type ProcessInfo struct {
	PID        int       `json:"pid"`
	Command    string    `json:"command"`
	StartTime  time.Time `json:"start_time"`
	ConfigPath string    `json:"config_path,omitempty"`
	LogPath    string    `json:"log_path,omitempty"`
	WorkingDir string    `json:"working_dir,omitempty"`
	User       string    `json:"user,omitempty"`
	Status     string    `json:"status"`
}

ProcessInfo represents information about a daemon process

type ProcessListResponse

type ProcessListResponse struct {
	Processes []ProcessInfo `json:"processes"`
	Total     int           `json:"total"`
	Status    string        `json:"status"`
}

ProcessListResponse represents the response for listing daemon processes

type ProcessManager

type ProcessManager interface {
	FindDaemonProcesses() ([]ProcessInfo, error)
	GracefulShutdown(pid int) error
	ForceKill(pid int) error
	CleanupProcesses() error
	RegisterDaemon(pid int, configPath, logPath string) error
	UnregisterDaemon(pid int) error
	GetPIDFilePath() string
	GetRegistryPath() string
	IsProcessRunning(pid int) bool
	WaitForShutdown(pid int, timeout time.Duration) error
}

ProcessManager interface defines daemon process management operations

func NewProcessManager

func NewProcessManager() ProcessManager

NewProcessManager creates a new process manager instance

type ProfileCreateRequest added in v0.6.0

type ProfileCreateRequest struct {
	Name          string `json:"name"`
	AWSProfile    string `json:"aws_profile"`
	Region        string `json:"region"`
	SSHKeyName    string `json:"ssh_key_name,omitempty"`
	SSHKeyPath    string `json:"ssh_key_path,omitempty"`
	UseDefaultKey bool   `json:"use_default_key,omitempty"`
}

ProfileCreateRequest represents a request to create a profile

type ProfileManagerAdapter added in v0.7.7

type ProfileManagerAdapter struct {
	// contains filtered or unexported fields
}

ProfileManagerAdapter adapts the Server to implement invitation.ProfileManager interface

func NewProfileManagerAdapter added in v0.7.7

func NewProfileManagerAdapter(s *Server) *ProfileManagerAdapter

NewProfileManagerAdapter creates a new ProfileManagerAdapter

func (*ProfileManagerAdapter) GetProfile added in v0.7.7

func (p *ProfileManagerAdapter) GetProfile(ctx context.Context, profileID string) (*invitation.Profile, error)

GetProfile retrieves a profile by ID

func (*ProfileManagerAdapter) GetProfileCredentials added in v0.7.7

func (p *ProfileManagerAdapter) GetProfileCredentials(ctx context.Context, profileID string) (aws.Credentials, error)

GetProfileCredentials retrieves AWS credentials for a profile

type ProfileResponse added in v0.6.0

type ProfileResponse struct {
	ID            string  `json:"id"`
	Name          string  `json:"name"`
	Type          string  `json:"type"`
	AWSProfile    string  `json:"aws_profile"`
	Region        string  `json:"region"`
	Default       bool    `json:"default"`
	CreatedAt     string  `json:"created_at"`
	UpdatedAt     string  `json:"updated_at,omitempty"`
	LastUsed      *string `json:"last_used,omitempty"`
	SSHKeyName    string  `json:"ssh_key_name,omitempty"`
	SSHKeyPath    string  `json:"ssh_key_path,omitempty"`
	UseDefaultKey bool    `json:"use_default_key,omitempty"`
}

ProfileResponse represents a profile in API responses

type ProfileUpdateRequest added in v0.6.0

type ProfileUpdateRequest struct {
	Name          *string `json:"name,omitempty"`
	AWSProfile    *string `json:"aws_profile,omitempty"`
	Region        *string `json:"region,omitempty"`
	SSHKeyName    *string `json:"ssh_key_name,omitempty"`
	SSHKeyPath    *string `json:"ssh_key_path,omitempty"`
	UseDefaultKey *bool   `json:"use_default_key,omitempty"`
}

ProfileUpdateRequest represents a request to update a profile

type ProgressTracker added in v0.7.2

type ProgressTracker struct {
	// contains filtered or unexported fields
}

ProgressTracker manages progress monitoring for multiple instances

func NewProgressTracker added in v0.7.2

func NewProgressTracker() *ProgressTracker

NewProgressTracker creates a new progress tracker

func (*ProgressTracker) GetProgress added in v0.7.2

func (pt *ProgressTracker) GetProgress(instanceName string) *LaunchProgressMonitor

GetProgress returns the current progress for an instance

func (*ProgressTracker) StartMonitoring added in v0.7.2

func (pt *ProgressTracker) StartMonitoring(instance *types.Instance, sshKeyPath string)

StartMonitoring starts progress monitoring for an instance

func (*ProgressTracker) StopMonitoring added in v0.7.2

func (pt *ProgressTracker) StopMonitoring(instanceName string)

StopMonitoring stops progress monitoring for an instance

type PutGroupUsersHandler

type PutGroupUsersHandler struct{}

PutGroupUsersHandler handles PUT requests for updating group users

func (*PutGroupUsersHandler) CanHandle

func (h *PutGroupUsersHandler) CanHandle(method string) bool

func (*PutGroupUsersHandler) Handle

func (h *PutGroupUsersHandler) Handle(w http.ResponseWriter, r *http.Request, id string, server *Server) error

type QuotaCheckRequest added in v0.5.11

type QuotaCheckRequest struct {
	InstanceType string `json:"instance_type"`
	Count        int    `json:"count"` // Number of students/invitations
	TemplateName string `json:"template_name,omitempty"`
}

QuotaCheckRequest represents a request to check AWS quotas for bulk invitations

type RateLimitError added in v0.5.11

type RateLimitError struct {
	Current    int
	Limit      int
	Window     time.Duration
	RetryAfter time.Duration
}

RateLimitError is returned when a launch is rate limited

func (*RateLimitError) Error added in v0.5.11

func (e *RateLimitError) Error() string

type RateLimiter added in v0.5.11

type RateLimiter struct {
	// contains filtered or unexported fields
}

RateLimiter provides token bucket-based rate limiting for instance launches

func NewRateLimiter added in v0.5.11

func NewRateLimiter(maxLaunches int, window time.Duration) *RateLimiter

NewRateLimiter creates a new rate limiter

func (*RateLimiter) CheckAndRecordLaunch added in v0.5.11

func (rl *RateLimiter) CheckAndRecordLaunch() error

CheckAndRecordLaunch checks if a launch is allowed and records it if so Returns nil if allowed, error with retry time if rate limited

func (*RateLimiter) GetStatus added in v0.5.11

func (rl *RateLimiter) GetStatus() RateLimiterStatus

GetStatus returns current rate limiter status

func (*RateLimiter) SetEnabled added in v0.5.11

func (rl *RateLimiter) SetEnabled(enabled bool)

SetEnabled enables or disables rate limiting

func (*RateLimiter) UpdateConfig added in v0.5.11

func (rl *RateLimiter) UpdateConfig(maxLaunches int, window time.Duration)

UpdateConfig updates rate limiter configuration

type RateLimiterStatus added in v0.5.11

type RateLimiterStatus struct {
	Enabled     bool          `json:"enabled"`
	MaxLaunches int           `json:"max_launches"`
	Window      time.Duration `json:"window"`
	Current     int           `json:"current"`
	Remaining   int           `json:"remaining"`
	ResetTime   time.Time     `json:"reset_time,omitempty"`
}

RateLimiterStatus represents the current status of the rate limiter

type RecoveryManager

type RecoveryManager struct {
	HTTPServer HTTPServer
	// contains filtered or unexported fields
}

RecoveryManager handles panic recovery and graceful degradation

func NewRecoveryManager

func NewRecoveryManager(stabilityMgr *StabilityManager, httpServer HTTPServer) *RecoveryManager

NewRecoveryManager creates a new recovery manager

func (*RecoveryManager) AddRecoveryStrategy

func (rm *RecoveryManager) AddRecoveryStrategy(errorType string, strategy RecoveryStrategy)

AddRecoveryStrategy adds a custom recovery strategy

func (*RecoveryManager) GetRecoveryStrategies

func (rm *RecoveryManager) GetRecoveryStrategies() map[string]RecoveryStrategy

GetRecoveryStrategies returns all recovery strategies

func (*RecoveryManager) GracefulShutdown

func (rm *RecoveryManager) GracefulShutdown(ctx context.Context) error

GracefulShutdown performs graceful shutdown

func (*RecoveryManager) HandleGoroutineLeak

func (rm *RecoveryManager) HandleGoroutineLeak() error

HandleGoroutineLeak handles excessive goroutine count

func (*RecoveryManager) HandleMemoryPressure

func (rm *RecoveryManager) HandleMemoryPressure() error

HandleMemoryPressure handles high memory usage situations

func (*RecoveryManager) HealthCheck

func (rm *RecoveryManager) HealthCheck() error

HealthCheck performs comprehensive health check

func (*RecoveryManager) RecoverFromError

func (rm *RecoveryManager) RecoverFromError(component string, err error) error

RecoverFromError attempts to recover from a specific error

func (*RecoveryManager) RecoverFromPanic

func (rm *RecoveryManager) RecoverFromPanic(component string)

RecoverFromPanic provides panic recovery middleware

func (*RecoveryManager) RecoverGoroutine

func (rm *RecoveryManager) RecoverGoroutine(component string, fn func())

RecoverGoroutine wraps goroutine execution with panic recovery

func (*RecoveryManager) RecoverHTTPHandler

func (rm *RecoveryManager) RecoverHTTPHandler(component string, handler http.HandlerFunc) http.HandlerFunc

RecoverHTTPHandler creates HTTP handler with panic recovery

type RecoveryStrategy

type RecoveryStrategy struct {
	Name        string
	Description string
	Handler     func(error) error
	Retries     int
	Timeout     time.Duration
}

RecoveryStrategy defines how to recover from specific error types

type ReducedModeError added in v0.7.7

type ReducedModeError struct {
	Error       string `json:"error"`
	Message     string `json:"message"`
	ReducedMode bool   `json:"reduced_mode"`
	Help        string `json:"help"`
}

ReducedModeError represents an error when AWS credentials are required but unavailable

type ResearchUserRequest

type ResearchUserRequest struct {
	Username    string `json:"username"`
	FullName    string `json:"full_name,omitempty"`
	DisplayName string `json:"display_name,omitempty"` // Accept display_name from frontend
	Email       string `json:"email,omitempty"`
}

ResearchUserRequest represents a request to create a research user

type ResearchUserSSHKeyRequest

type ResearchUserSSHKeyRequest struct {
	Username string `json:"username"`
	KeyType  string `json:"key_type,omitempty"` // "ed25519" or "rsa"
}

ResearchUserSSHKeyRequest represents a request to manage SSH keys

type Resource

type Resource string

Resource represents a resource type

const (
	// ResourceInstance represents an instance resource
	ResourceInstance Resource = "instance"

	// ResourceTemplate represents a template resource
	ResourceTemplate Resource = "template"

	// ResourceVolume represents a volume resource
	ResourceVolume Resource = "volume"

	// ResourceStorage represents a storage resource
	ResourceStorage Resource = "storage"

	// ResourceUser represents a user resource
	ResourceUser Resource = "user"

	// ResourceGroup represents a group resource
	ResourceGroup Resource = "group"

	// ResourceSystem represents system-level resources
	ResourceSystem Resource = "system"
)

type SSHTunnel

type SSHTunnel struct {
	InstanceName string
	ServiceName  string
	RemotePort   int
	LocalPort    int
	PublicIP     string
	Username     string
	KeyPath      string
	AuthToken    string // Authentication token (e.g., Jupyter token)
	// contains filtered or unexported fields
}

SSHTunnel represents an active SSH tunnel

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server represents the Prism daemon server

func NewServer

func NewServer(port string) (*Server, error)

NewServer creates a new daemon server

func NewServerForTesting added in v0.5.7

func NewServerForTesting(port string) (*Server, error)

NewServerForTesting creates a new daemon server with test mode enabled Test mode skips AWS operations to allow unit testing without AWS credentials

func (*Server) Cleanup

func (s *Server) Cleanup() error

Cleanup performs comprehensive cleanup for uninstallation

func (*Server) ExecuteHibernateAll

func (s *Server) ExecuteHibernateAll(projectID string) error

ExecuteHibernateAll hibernates all instances for a project

func (*Server) ExecutePreventLaunch

func (s *Server) ExecutePreventLaunch(projectID string) error

ExecutePreventLaunch sets a flag to prevent new launches for a project

func (*Server) ExecuteStopAll

func (s *Server) ExecuteStopAll(projectID string) error

ExecuteStopAll stops all instances for a project

func (*Server) IsReducedMode added in v0.7.7

func (s *Server) IsReducedMode() bool

IsReducedMode returns whether the server is running in reduced functionality mode

func (*Server) RegisterAMIRoutes

func (s *Server) RegisterAMIRoutes(mux *http.ServeMux, applyMiddleware func(http.HandlerFunc) http.HandlerFunc)

RegisterAMIRoutes registers all AMI-related API routes

func (*Server) RegisterCommunityRoutes added in v0.7.2

func (s *Server) RegisterCommunityRoutes(mux *http.ServeMux, applyMiddleware func(http.HandlerFunc) http.HandlerFunc)

RegisterCommunityRoutes registers community template API routes Simplified for v0.7.2 - full implementation in v0.7.3

func (*Server) RegisterConnectionProxyRoutes

func (s *Server) RegisterConnectionProxyRoutes(mux *http.ServeMux, applyMiddleware func(http.HandlerFunc) http.HandlerFunc)

RegisterConnectionProxyRoutes registers all connection proxy endpoints

func (*Server) RegisterCostHandlers

func (s *Server) RegisterCostHandlers(mux *http.ServeMux, applyMiddleware func(http.HandlerFunc) http.HandlerFunc)

RegisterCostHandlers registers all cost-related HTTP handlers

func (*Server) RegisterIdleRoutes

func (s *Server) RegisterIdleRoutes(mux *http.ServeMux, applyMiddleware func(http.HandlerFunc) http.HandlerFunc)

RegisterIdleRoutes registers all idle policy API routes

func (*Server) RegisterMarketplaceRoutes

func (s *Server) RegisterMarketplaceRoutes(mux *http.ServeMux, applyMiddleware func(http.HandlerFunc) http.HandlerFunc)

RegisterMarketplaceRoutes registers all marketplace-related API routes

func (*Server) RegisterPolicyRoutes

func (s *Server) RegisterPolicyRoutes(mux *http.ServeMux, applyMiddleware func(http.HandlerFunc) http.HandlerFunc)

RegisterPolicyRoutes registers all policy-related API endpoints

func (*Server) RegisterSleepWakeRoutes added in v0.5.13

func (s *Server) RegisterSleepWakeRoutes(mux *http.ServeMux, applyMiddleware func(http.HandlerFunc) http.HandlerFunc)

RegisterSleepWakeRoutes registers all sleep/wake API routes

func (*Server) SetAlerterOnBudgetTracker added in v0.12.0

func (s *Server) SetAlerterOnBudgetTracker(d alerting.AlertDispatcher)

SetAlerterOnBudgetTracker configures an AlertDispatcher on the budget tracker. Called at startup when PRISM_SLACK_WEBHOOK or another notifier is configured.

func (*Server) SetReducedMode added in v0.7.7

func (s *Server) SetReducedMode(enabled bool)

SetReducedMode sets the reduced functionality mode status This is primarily used during initialization when AWS credentials are unavailable

func (*Server) Start

func (s *Server) Start() error

func (*Server) Stop

func (s *Server) Stop() error

Stop stops the daemon server gracefully

type SetProjectBudgetRequest

type SetProjectBudgetRequest struct {
	TotalBudget     float64                  `json:"total_budget"`
	MonthlyLimit    *float64                 `json:"monthly_limit,omitempty"`
	DailyLimit      *float64                 `json:"daily_limit,omitempty"`
	AlertThresholds []types.BudgetAlert      `json:"alert_thresholds,omitempty"`
	AutoActions     []types.BudgetAutoAction `json:"auto_actions,omitempty"`
	BudgetPeriod    types.BudgetPeriod       `json:"budget_period"`
	EndDate         *time.Time               `json:"end_date,omitempty"`
}

SetProjectBudgetRequest represents a request to set or enable a project budget

func (*SetProjectBudgetRequest) Validate

func (r *SetProjectBudgetRequest) Validate() error

Validate validates the set budget request

type SingletonManager

type SingletonManager struct {
	// contains filtered or unexported fields
}

SingletonManager manages daemon singleton enforcement

func NewSingletonManager

func NewSingletonManager() (*SingletonManager, error)

NewSingletonManager creates a new singleton manager

func (*SingletonManager) Acquire

func (s *SingletonManager) Acquire() error

Acquire attempts to acquire the singleton lock If another daemon is running, it will attempt to gracefully shut it down

func (*SingletonManager) GetPID

func (s *SingletonManager) GetPID() (int, error)

GetPID returns the PID from the PID file, or 0 if not running

func (*SingletonManager) Release

func (s *SingletonManager) Release() error

Release releases the singleton lock

type StabilityManager

type StabilityManager struct {
	// contains filtered or unexported fields
}

StabilityManager manages daemon stability, memory, and error recovery

func NewStabilityManager

func NewStabilityManager(monitor *monitoring.PerformanceMonitor) *StabilityManager

NewStabilityManager creates a new stability manager

func (*StabilityManager) CheckMemoryPressure

func (sm *StabilityManager) CheckMemoryPressure() bool

CheckMemoryPressure checks if memory usage is too high

func (*StabilityManager) EnableForceGC

func (sm *StabilityManager) EnableForceGC(enabled bool)

EnableForceGC enables/disables forced garbage collection

func (*StabilityManager) ExecuteWithCircuitBreaker

func (sm *StabilityManager) ExecuteWithCircuitBreaker(name string, operation func() error) error

ExecuteWithCircuitBreaker executes a function with circuit breaker protection

func (*StabilityManager) ForceGarbageCollection

func (sm *StabilityManager) ForceGarbageCollection()

ForceGarbageCollection triggers garbage collection

func (*StabilityManager) GetCircuitBreaker

func (sm *StabilityManager) GetCircuitBreaker(name string) *CircuitBreaker

GetCircuitBreaker gets or creates a circuit breaker

func (*StabilityManager) GetCircuitBreakerStatus

func (sm *StabilityManager) GetCircuitBreakerStatus() map[string]*CircuitBreaker

GetCircuitBreakerStatus returns all circuit breaker statuses

func (*StabilityManager) GetErrorHistory

func (sm *StabilityManager) GetErrorHistory() []ErrorRecord

GetErrorHistory returns recent error history

func (*StabilityManager) GetStabilityMetrics

func (sm *StabilityManager) GetStabilityMetrics() StabilityMetrics

GetStabilityMetrics returns current stability metrics

func (*StabilityManager) IsHealthy

func (sm *StabilityManager) IsHealthy() bool

IsHealthy returns current health status

func (*StabilityManager) RecordError

func (sm *StabilityManager) RecordError(component, errorType, message string, severity ErrorSeverity)

RecordError records an error for stability tracking

func (*StabilityManager) RecordRecovery

func (sm *StabilityManager) RecordRecovery(component, errorType string)

RecordRecovery records successful error recovery

func (*StabilityManager) SetMemoryThreshold

func (sm *StabilityManager) SetMemoryThreshold(bytes int64)

SetMemoryThreshold sets memory threshold for triggering GC

func (*StabilityManager) Start

func (sm *StabilityManager) Start(ctx context.Context)

Start begins stability monitoring

type StabilityMetrics

type StabilityMetrics struct {
	Uptime              time.Duration `json:"uptime"`
	MemoryUsageMB       float64       `json:"memory_usage_mb"`
	GoroutineCount      int           `json:"goroutine_count"`
	GCCount             uint32        `json:"gc_count"`
	LastGCPause         time.Duration `json:"last_gc_pause"`
	TotalErrors         int           `json:"total_errors"`
	CriticalErrors      int           `json:"critical_errors"`
	RecoveredErrors     int           `json:"recovered_errors"`
	CircuitBreakersOpen int           `json:"circuit_breakers_open"`
	HealthScore         float64       `json:"health_score"`
}

StabilityMetrics tracks daemon stability metrics

type StateManager

type StateManager interface {
}

StateManager interface to avoid circular dependency

type StateMonitor added in v0.5.8

type StateMonitor struct {
	// contains filtered or unexported fields
}

StateMonitor monitors instance state changes in the background It polls AWS for instances in transitional states and updates local state

func NewStateMonitor added in v0.5.8

func NewStateMonitor(awsManager *aws.Manager, stateManager *state.Manager) *StateMonitor

NewStateMonitor creates a new state monitor

func (*StateMonitor) Start added in v0.5.8

func (sm *StateMonitor) Start() error

Start begins background state monitoring

func (*StateMonitor) Stop added in v0.5.8

func (sm *StateMonitor) Stop()

Stop gracefully stops the state monitor

type StatusTracker

type StatusTracker struct {
	// contains filtered or unexported fields
}

StatusTracker tracks daemon operational metrics

func NewStatusTracker

func NewStatusTracker() *StatusTracker

NewStatusTracker creates a new status tracker

func (*StatusTracker) EndOperation

func (s *StatusTracker) EndOperation()

EndOperation decrements the active operations counter

func (*StatusTracker) EndOperationWithType

func (s *StatusTracker) EndOperationWithType(opType string)

EndOperationWithType decrements the active operations counter for a specific type

func (*StatusTracker) GetActiveOperationCount

func (s *StatusTracker) GetActiveOperationCount() int

GetActiveOperationCount returns the current number of active operations

func (*StatusTracker) GetRecentlyActiveInstances

func (s *StatusTracker) GetRecentlyActiveInstances(within time.Duration) []string

GetRecentlyActiveInstances returns instances that had activity within the specified duration

func (*StatusTracker) GetRequestRate

func (s *StatusTracker) GetRequestRate() float64

GetRequestRate calculates the current request rate per minute

func (*StatusTracker) GetStatus

func (s *StatusTracker) GetStatus(version string, region string, awsProfile string) types.DaemonStatus

GetStatus returns the current daemon status

func (*StatusTracker) RecordInstanceActivity

func (s *StatusTracker) RecordInstanceActivity(instanceName string)

RecordInstanceActivity records that an instance had recent activity

func (*StatusTracker) RecordRequest

func (s *StatusTracker) RecordRequest()

RecordRequest records a request and updates metrics

func (*StatusTracker) StartOperation

func (s *StatusTracker) StartOperation() int64

StartOperation increments the active operations counter Returns an operation ID that can be used for tracking

func (*StatusTracker) StartOperationWithType

func (s *StatusTracker) StartOperationWithType(opType string) int64

StartOperationWithType increments the active operations counter for a specific type Returns an operation ID that can be used for tracking

type StorageStateMonitor added in v0.7.7

type StorageStateMonitor struct {
	// contains filtered or unexported fields
}

StorageStateMonitor monitors storage volume state changes in the background It polls AWS for volumes in transitional states and updates local state

func NewStorageStateMonitor added in v0.7.7

func NewStorageStateMonitor(awsManager *aws.Manager, stateManager *state.Manager) *StorageStateMonitor

NewStorageStateMonitor creates a new storage state monitor

func (*StorageStateMonitor) Start added in v0.7.7

func (ssm *StorageStateMonitor) Start() error

Start begins background storage state monitoring

func (*StorageStateMonitor) Stop added in v0.7.7

func (ssm *StorageStateMonitor) Stop()

Stop gracefully stops the storage state monitor

type SystemMetrics

type SystemMetrics struct {
	MemoryUsageMB   float64       `json:"memory_usage_mb"`
	GoroutineCount  int           `json:"goroutine_count"`
	GCCount         uint32        `json:"gc_count"`
	LastGCPause     time.Duration `json:"last_gc_pause"`
	Uptime          time.Duration `json:"uptime"`
	CPUUsagePercent float64       `json:"cpu_usage_percent"`
	LoadAverage     float64       `json:"load_average"`
}

SystemMetrics represents system-level metrics

type TransferRequest added in v0.5.7

type TransferRequest struct {
	// Type is the transfer operation type ("upload" or "download")
	Type string `json:"type"`

	// LocalPath is the local file path
	LocalPath string `json:"local_path"`

	// S3Bucket is the S3 bucket name
	S3Bucket string `json:"s3_bucket"`

	// S3Key is the S3 object key
	S3Key string `json:"s3_key"`

	// Options for transfer configuration (optional)
	Options *storage.TransferOptions `json:"options,omitempty"`
}

TransferRequest represents a request to start a file transfer

type TransferResponse added in v0.5.7

type TransferResponse struct {
	// TransferID is the unique identifier for the transfer
	TransferID string `json:"transfer_id"`

	// Status is the current transfer status
	Status storage.TransferStatus `json:"status"`

	// Progress contains detailed transfer progress
	Progress *storage.TransferProgress `json:"progress,omitempty"`

	// Error contains error message if transfer failed to start
	Error string `json:"error,omitempty"`
}

TransferResponse represents the response from a transfer request

type TunnelInfo

type TunnelInfo struct {
	InstanceName string `json:"instance_name"`
	ServiceName  string `json:"service_name"`
	ServiceDesc  string `json:"service_description"`
	RemotePort   int    `json:"remote_port"`
	LocalPort    int    `json:"local_port"`
	LocalURL     string `json:"local_url"`
	AuthToken    string `json:"auth_token,omitempty"` // Authentication token (e.g., Jupyter)
	Status       string `json:"status"`
	StartTime    string `json:"start_time,omitempty"`
}

TunnelInfo represents tunnel information for API responses

type TunnelManager

type TunnelManager struct {
	// contains filtered or unexported fields
}

TunnelManager manages SSH tunnels for instance services

func NewTunnelManager

func NewTunnelManager(state StateManager) *TunnelManager

NewTunnelManager creates a new tunnel manager

func (*TunnelManager) CloseAll

func (tm *TunnelManager) CloseAll()

CloseAll closes all tunnels

func (*TunnelManager) CloseInstanceTunnels

func (tm *TunnelManager) CloseInstanceTunnels(instanceName string)

CloseInstanceTunnels closes all tunnels for an instance

func (*TunnelManager) CloseTunnel

func (tm *TunnelManager) CloseTunnel(instanceName, serviceName string) error

CloseTunnel closes a specific tunnel

func (*TunnelManager) CreateTunnel

func (tm *TunnelManager) CreateTunnel(instance *types.Instance, service types.Service) (*SSHTunnel, error)

CreateTunnel creates an SSH tunnel for a service

func (*TunnelManager) GetInstanceTunnels

func (tm *TunnelManager) GetInstanceTunnels(instanceName string) []*SSHTunnel

GetInstanceTunnels returns all tunnels for an instance

func (*TunnelManager) GetTunnel

func (tm *TunnelManager) GetTunnel(instanceName, serviceName string) (*SSHTunnel, bool)

GetTunnel retrieves an existing tunnel

type UpdateProjectBudgetRequest

type UpdateProjectBudgetRequest struct {
	TotalBudget     *float64                 `json:"total_budget,omitempty"`
	MonthlyLimit    *float64                 `json:"monthly_limit,omitempty"`
	DailyLimit      *float64                 `json:"daily_limit,omitempty"`
	AlertThresholds []types.BudgetAlert      `json:"alert_thresholds,omitempty"`
	AutoActions     []types.BudgetAutoAction `json:"auto_actions,omitempty"`
	EndDate         *time.Time               `json:"end_date,omitempty"`
}

UpdateProjectBudgetRequest represents a request to update a project budget

type UserManager

type UserManager struct {
	// contains filtered or unexported fields
}

UserManager manages user-related operations in the daemon

func NewUserManager

func NewUserManager() *UserManager

NewUserManager creates a new user manager

func (*UserManager) Authenticate

func (m *UserManager) Authenticate(ctx context.Context, username, password string) (*usermgmt.AuthenticationResult, error)

Authenticate authenticates a user with the given credentials

func (*UserManager) Close

func (m *UserManager) Close() error

Close closes the user manager and releases resources

func (*UserManager) CreateUser

func (m *UserManager) CreateUser(ctx context.Context, user *usermgmt.User) (*usermgmt.User, error)

CreateUser creates a new user

func (*UserManager) DeleteUser

func (m *UserManager) DeleteUser(ctx context.Context, id string) error

DeleteUser deletes a user

func (*UserManager) DisableUser

func (m *UserManager) DisableUser(ctx context.Context, id string) error

DisableUser disables a user

func (*UserManager) EnableUser

func (m *UserManager) EnableUser(ctx context.Context, id string) error

EnableUser enables a user

func (*UserManager) GetDefaultProvisionOptions

func (m *UserManager) GetDefaultProvisionOptions() (*usermgmt.UserProvisionOptions, error)

GetDefaultProvisionOptions gets the default options for provisioning users

func (*UserManager) GetUser

func (m *UserManager) GetUser(ctx context.Context, id string) (*usermgmt.User, error)

GetUser gets a user by ID

func (*UserManager) GetUserByUsername

func (m *UserManager) GetUserByUsername(ctx context.Context, username string) (*usermgmt.User, error)

GetUserByUsername gets a user by username

func (*UserManager) GetUsers

GetUsers gets users matching the specified filter

func (*UserManager) Initialize

func (m *UserManager) Initialize() error

Initialize initializes the user manager

func (*UserManager) IsUserInRole

func (m *UserManager) IsUserInRole(ctx context.Context, userID string, role usermgmt.UserRole) (bool, error)

IsUserInRole checks if a user has the specified role

func (*UserManager) RegisterProvider

func (m *UserManager) RegisterProvider(provider usermgmt.UserManagementProvider) error

RegisterProvider registers a user management provider

func (*UserManager) SetDefaultProvisionOptions

func (m *UserManager) SetDefaultProvisionOptions(options *usermgmt.UserProvisionOptions) error

SetDefaultProvisionOptions sets the default options for provisioning users

func (*UserManager) SynchronizeUsers

func (m *UserManager) SynchronizeUsers(ctx context.Context, options *usermgmt.SyncOptions) (*usermgmt.SyncResult, error)

SynchronizeUsers synchronizes users from all providers

func (*UserManager) UnregisterProvider

func (m *UserManager) UnregisterProvider(providerType usermgmt.Provider) error

UnregisterProvider unregisters a user management provider

func (*UserManager) UpdateUser

func (m *UserManager) UpdateUser(ctx context.Context, user *usermgmt.User) (*usermgmt.User, error)

UpdateUser updates an existing user

Directories

Path Synopsis
Package logger provides structured logging for the Prism daemon with proper log levels.
Package logger provides structured logging for the Prism daemon with proper log levels.

Jump to

Keyboard shortcuts

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