Documentation
¶
Overview ¶
Package admin provides the admin HTTP API server.
Index ¶
- Variables
- func IsInvalidState(err error) bool
- func IsValidation(err error) bool
- func WriteError(w http.ResponseWriter, status int, code, message string)
- func WriteJSON(w http.ResponseWriter, status int, v any)
- type APIKeyAdapter
- func (a *APIKeyAdapter) Create(ctx context.Context, opts CreateAPIKeyOptions) (*store.APIKey, string, error)
- func (a *APIKeyAdapter) Get(ctx context.Context, id string) (*store.APIKey, error)
- func (a *APIKeyAdapter) List(ctx context.Context, opts ListAPIKeysOptions) (*ListResult[store.APIKey], error)
- func (a *APIKeyAdapter) Revoke(ctx context.Context, id, reason string) error
- type APIKeyService
- type ActionLogService
- type ActionLogStore
- type ActionLogStoreAdapter
- type AgentConfigService
- type Config
- type CreateAPIKeyOptions
- type CreateAPIKeyRequest
- type CreateAPIKeyResponse
- type CreateAgentConfigOptions
- type CreateAgentConfigRequest
- type CreateProfileOptions
- type CreateProfileRequest
- type CreateProviderConfigOptions
- type CreateProviderConfigRequest
- type CreateRunnerTokenOptions
- type CreateRunnerTokenRequest
- type CreateRunnerTokenResponse
- type CreateWebhookInput
- type CreateWebhookRequest
- type CreateWebhookResponse
- type ErrorResponse
- type HealthResponse
- type HealthService
- type InvalidStateError
- type ListAPIKeysOptions
- type ListActionLogsOptions
- type ListAgentConfigsOptions
- type ListProfilesOptions
- type ListProviderConfigsOptions
- type ListResult
- type ListRunnerTokensOptions
- type ListRunnersOptions
- type MockAPIKeyService
- func (m *MockAPIKeyService) AddKey(key *store.APIKey)
- func (m *MockAPIKeyService) ClearInternalError()
- func (m *MockAPIKeyService) Create(_ context.Context, opts CreateAPIKeyOptions) (*store.APIKey, string, error)
- func (m *MockAPIKeyService) Get(_ context.Context, id string) (*store.APIKey, error)
- func (m *MockAPIKeyService) List(_ context.Context, opts ListAPIKeysOptions) (*ListResult[store.APIKey], error)
- func (m *MockAPIKeyService) Revoke(_ context.Context, id, reason string) error
- func (m *MockAPIKeyService) SetInternalError(err error)
- type MockActionLogService
- func (m *MockActionLogService) AddLog(log *store.ActionLog)
- func (m *MockActionLogService) Get(_ context.Context, id string) (*store.ActionLog, error)
- func (m *MockActionLogService) List(_ context.Context, opts ListActionLogsOptions) (*ListResult[store.ActionLog], error)
- func (m *MockActionLogService) Reset()
- func (m *MockActionLogService) SetInternalError(err error)
- type MockAgentConfigService
- func (m *MockAgentConfigService) AddConfig(config *store.AgentConfig)
- func (m *MockAgentConfigService) ClearInternalError()
- func (m *MockAgentConfigService) ClearValidationError()
- func (m *MockAgentConfigService) Create(_ context.Context, opts CreateAgentConfigOptions) (*store.AgentConfig, error)
- func (m *MockAgentConfigService) Delete(_ context.Context, id string) error
- func (m *MockAgentConfigService) Get(_ context.Context, id string) (*store.AgentConfig, error)
- func (m *MockAgentConfigService) List(_ context.Context, opts ListAgentConfigsOptions) (*ListResult[store.AgentConfig], error)
- func (m *MockAgentConfigService) SetInternalError(err error)
- func (m *MockAgentConfigService) SetValidationError(field, message string)
- func (m *MockAgentConfigService) Update(_ context.Context, id string, opts UpdateAgentConfigOptions) (*store.AgentConfig, error)
- type MockProfileService
- func (m *MockProfileService) AddProfile(profile *store.Profile)
- func (m *MockProfileService) ClearInternalError()
- func (m *MockProfileService) ClearValidationError()
- func (m *MockProfileService) Create(_ context.Context, opts CreateProfileOptions) (*store.Profile, error)
- func (m *MockProfileService) Delete(_ context.Context, id string) error
- func (m *MockProfileService) Get(_ context.Context, id string) (*store.Profile, error)
- func (m *MockProfileService) List(_ context.Context, opts ListProfilesOptions) (*ListResult[store.Profile], error)
- func (m *MockProfileService) SetInternalError(err error)
- func (m *MockProfileService) SetValidationError(field, message string)
- func (m *MockProfileService) Update(_ context.Context, id string, opts UpdateProfileOptions) (*store.Profile, error)
- type MockProviderConfigService
- func (m *MockProviderConfigService) AddConfig(config *store.ProviderConfig)
- func (m *MockProviderConfigService) ClearInternalError()
- func (m *MockProviderConfigService) ClearValidationError()
- func (m *MockProviderConfigService) Create(_ context.Context, opts CreateProviderConfigOptions) (*store.ProviderConfig, error)
- func (m *MockProviderConfigService) Delete(_ context.Context, id string) error
- func (m *MockProviderConfigService) Get(_ context.Context, id string) (*store.ProviderConfig, error)
- func (m *MockProviderConfigService) List(_ context.Context, opts ListProviderConfigsOptions) (*ListResult[store.ProviderConfig], error)
- func (m *MockProviderConfigService) SetInternalError(err error)
- func (m *MockProviderConfigService) SetValidationError(field, message string)
- func (m *MockProviderConfigService) Update(_ context.Context, id string, opts UpdateProviderConfigOptions) (*store.ProviderConfig, error)
- type MockRunnerAdminService
- func (m *MockRunnerAdminService) AddRunner(runner *store.Runner)
- func (m *MockRunnerAdminService) ClearInternalError()
- func (m *MockRunnerAdminService) ClearValidationError()
- func (m *MockRunnerAdminService) Destroy(_ context.Context, id string) error
- func (m *MockRunnerAdminService) Get(_ context.Context, id string) (*store.Runner, error)
- func (m *MockRunnerAdminService) List(_ context.Context, opts ListRunnersOptions) (*ListResult[store.Runner], error)
- func (m *MockRunnerAdminService) SetInternalError(err error)
- func (m *MockRunnerAdminService) SetValidationError(field, message string)
- func (m *MockRunnerAdminService) Spawn(_ context.Context, opts SpawnRunnerOptions) (*store.Runner, error)
- type Option
- func WithAPIKeyService(s APIKeyService) Option
- func WithActionLogService(s ActionLogService) Option
- func WithAgentConfigService(s AgentConfigService) Option
- func WithHealthService(hs HealthService) Option
- func WithMiddleware(m func(http.Handler) http.Handler) Option
- func WithProfileService(s ProfileService) Option
- func WithProviderConfigService(s ProviderConfigService) Option
- func WithRunnerAdminService(s RunnerAdminService) Option
- func WithRunnerTokenAdminService(s RunnerTokenAdminService) Option
- func WithSessionActivator(s SessionActivator) Option
- func WithSignalingHandler(h *SignalingHandler) Option
- func WithStreamsHandler(h *StreamsHandler) Option
- func WithWebhookService(s WebhookService) Option
- type ProfileAdapter
- func (a *ProfileAdapter) Create(ctx context.Context, opts CreateProfileOptions) (*store.Profile, error)
- func (a *ProfileAdapter) Delete(ctx context.Context, profileID string) error
- func (a *ProfileAdapter) Get(ctx context.Context, profileID string) (*store.Profile, error)
- func (a *ProfileAdapter) List(ctx context.Context, opts ListProfilesOptions) (*ListResult[store.Profile], error)
- func (a *ProfileAdapter) Update(ctx context.Context, profileID string, opts UpdateProfileOptions) (*store.Profile, error)
- type ProfileService
- type ProfileStore
- type ProviderConfigService
- type ResolutionRequest
- type RevokeAPIKeyRequest
- type RevokeRunnerTokenRequest
- type RotateRunnerTokenResponse
- type RotateSecretResponse
- type RunnerAdminService
- type RunnerTokenAdapter
- func (a *RunnerTokenAdapter) Create(ctx context.Context, opts CreateRunnerTokenOptions) (*store.RunnerToken, string, error)
- func (a *RunnerTokenAdapter) Get(ctx context.Context, id string) (*store.RunnerToken, error)
- func (a *RunnerTokenAdapter) List(ctx context.Context, opts ListRunnerTokensOptions) (*ListResult[store.RunnerToken], error)
- func (a *RunnerTokenAdapter) Revoke(ctx context.Context, id, reason string) error
- func (a *RunnerTokenAdapter) Rotate(ctx context.Context, id string) (*store.RunnerToken, string, error)
- type RunnerTokenAdminService
- type Server
- type ServiceRegistry
- type ServiceStatus
- type SessionActivator
- type SignalingConfig
- type SignalingHandler
- type SpawnRunnerOptions
- type SpawnRunnerRequest
- type StatusResponse
- type StreamCommandSender
- type StreamManager
- type StreamRequest
- type StreamResponse
- type StreamsHandler
- func (h *StreamsHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *StreamsHandler) Get(w http.ResponseWriter, r *http.Request)
- func (h *StreamsHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *StreamsHandler) Routes() chi.Router
- func (h *StreamsHandler) Stop(w http.ResponseWriter, r *http.Request)
- type UpdateAgentConfigOptions
- type UpdateAgentConfigRequest
- type UpdateProfileOptions
- type UpdateProfileRequest
- type UpdateProviderConfigOptions
- type UpdateProviderConfigRequest
- type UpdateWebhookInput
- type UpdateWebhookRequest
- type ValidationError
- type WebhookAdapter
- func (a *WebhookAdapter) Create(ctx context.Context, input *CreateWebhookInput) (*store.Webhook, string, error)
- func (a *WebhookAdapter) Delete(ctx context.Context, webhookID string) error
- func (a *WebhookAdapter) Get(ctx context.Context, webhookID string) (*store.Webhook, error)
- func (a *WebhookAdapter) GetEvent(ctx context.Context, eventID string) (*store.WebhookEvent, error)
- func (a *WebhookAdapter) List(ctx context.Context, opts store.ListWebhooksOptions) (*store.ListResult[store.Webhook], error)
- func (a *WebhookAdapter) ListEvents(ctx context.Context, opts store.ListWebhookEventsOptions) (*store.ListResult[store.WebhookEvent], error)
- func (a *WebhookAdapter) RetryEvent(ctx context.Context, eventID string) error
- func (a *WebhookAdapter) RotateSecret(ctx context.Context, webhookID string) (string, error)
- func (a *WebhookAdapter) Update(ctx context.Context, webhookID string, input *UpdateWebhookInput) error
- type WebhookService
Constants ¶
This section is empty.
Variables ¶
var ( ErrWebhookNameExists = errors.New("webhook name already exists") ErrInvalidEventPattern = errors.New("invalid event pattern") ErrWebhookNotFound = errors.New("webhook not found") ErrWebhookEventNotFound = errors.New("webhook event not found") )
Webhook-related sentinel errors for admin package.
var Registry = &ServiceRegistry{ services: make(map[string]ServiceStatus), }
Registry is the global service registry, set by main.go after starting services.
Functions ¶
func IsInvalidState ¶
IsInvalidState returns true if the error is an InvalidStateError.
func IsValidation ¶
IsValidation returns true if the error is a ValidationError.
func WriteError ¶
func WriteError(w http.ResponseWriter, status int, code, message string)
WriteError writes an error response.
Types ¶
type APIKeyAdapter ¶
type APIKeyAdapter struct {
// contains filtered or unexported fields
}
APIKeyAdapter adapts auth.APIKeyService to admin.APIKeyService.
func NewAPIKeyAdapter ¶
func NewAPIKeyAdapter(service *auth.APIKeyService) *APIKeyAdapter
NewAPIKeyAdapter creates a new APIKeyAdapter.
func (*APIKeyAdapter) Create ¶
func (a *APIKeyAdapter) Create(ctx context.Context, opts CreateAPIKeyOptions) (*store.APIKey, string, error)
Create creates a new API key and returns the key and plaintext token.
func (*APIKeyAdapter) List ¶
func (a *APIKeyAdapter) List(ctx context.Context, opts ListAPIKeysOptions) (*ListResult[store.APIKey], error)
List returns API keys matching the given options.
type APIKeyService ¶
type APIKeyService interface {
// Create creates a new API key and returns the key and plaintext token.
Create(ctx context.Context, opts CreateAPIKeyOptions) (*store.APIKey, string, error)
// Get retrieves an API key by ID.
Get(ctx context.Context, id string) (*store.APIKey, error)
// List returns API keys matching the given options.
List(ctx context.Context, opts ListAPIKeysOptions) (*ListResult[store.APIKey], error)
// Revoke revokes an API key with an optional reason.
Revoke(ctx context.Context, id, reason string) error
}
APIKeyService defines the interface for API key management.
type ActionLogService ¶
type ActionLogService interface {
// Get retrieves an action log by ID.
Get(ctx context.Context, id string) (*store.ActionLog, error)
// List returns action logs matching the given options.
List(ctx context.Context, opts ListActionLogsOptions) (*ListResult[store.ActionLog], error)
}
ActionLogService defines the interface for querying action logs.
type ActionLogStore ¶
type ActionLogStore interface {
GetActionLog(ctx context.Context, id string) (*store.ActionLog, error)
ListActionLogs(ctx context.Context, opts store.ListActionLogsOptions) (*store.ListResult[store.ActionLog], error)
}
ActionLogStore defines the store operations needed for action logs. This interface is a subset of store.Store for better testability.
type ActionLogStoreAdapter ¶
type ActionLogStoreAdapter struct {
// contains filtered or unexported fields
}
ActionLogStoreAdapter adapts ActionLogStore to ActionLogService.
func NewActionLogStoreAdapter ¶
func NewActionLogStoreAdapter(s ActionLogStore) *ActionLogStoreAdapter
NewActionLogStoreAdapter creates a new ActionLogStoreAdapter.
func (*ActionLogStoreAdapter) List ¶
func (a *ActionLogStoreAdapter) List(ctx context.Context, opts ListActionLogsOptions) (*ListResult[store.ActionLog], error)
List returns action logs matching the given options.
type AgentConfigService ¶
type AgentConfigService interface {
// Create creates a new agent configuration.
Create(ctx context.Context, opts CreateAgentConfigOptions) (*store.AgentConfig, error)
// Get retrieves an agent configuration by ID.
Get(ctx context.Context, id string) (*store.AgentConfig, error)
// List returns agent configurations matching the given options.
List(ctx context.Context, opts ListAgentConfigsOptions) (*ListResult[store.AgentConfig], error)
// Update updates an agent configuration.
Update(ctx context.Context, id string, opts UpdateAgentConfigOptions) (*store.AgentConfig, error)
// Delete deletes an agent configuration.
Delete(ctx context.Context, id string) error
}
AgentConfigService defines the interface for agent configuration management.
type Config ¶
type Config struct {
Host string
Port int
Username string // Basic auth username
Password string // Basic auth password
}
Config holds configuration for the admin server.
type CreateAPIKeyOptions ¶
type CreateAPIKeyOptions struct {
Name string `json:"name"`
Scopes []string `json:"scopes,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
}
CreateAPIKeyOptions defines options for creating an API key.
type CreateAPIKeyRequest ¶
type CreateAPIKeyRequest struct {
Name string `json:"name"`
Scopes []string `json:"scopes,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
}
CreateAPIKeyRequest is the request body for creating an API key.
type CreateAPIKeyResponse ¶
type CreateAPIKeyResponse struct {
Key *store.APIKey `json:"key"`
RawToken string `json:"raw_token"`
}
CreateAPIKeyResponse is the response for creating an API key.
type CreateAgentConfigOptions ¶
type CreateAgentConfigOptions struct {
Name string `json:"name"`
Agent string `json:"agent"`
APIKey string `json:"api_key"`
Model string `json:"model,omitempty"`
BaseURL string `json:"base_url,omitempty"`
Extra map[string]any `json:"extra,omitempty"`
IsDefault bool `json:"is_default,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
CreateAgentConfigOptions defines options for creating an agent configuration.
type CreateAgentConfigRequest ¶
type CreateAgentConfigRequest struct {
Name string `json:"name"`
Agent string `json:"agent"`
APIKey string `json:"api_key"`
Model string `json:"model,omitempty"`
BaseURL string `json:"base_url,omitempty"`
Extra map[string]any `json:"extra,omitempty"`
IsDefault bool `json:"is_default,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
CreateAgentConfigRequest is the request body for creating an agent config.
type CreateProfileOptions ¶
type CreateProfileOptions struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
ProviderConfigID string `json:"provider_config_id,omitempty"`
Resources map[string]any `json:"resources,omitempty"`
Network map[string]any `json:"network,omitempty"`
InitScript string `json:"init_script,omitempty"`
CleanupScript string `json:"cleanup_script,omitempty"`
Tunnels []map[string]any `json:"tunnels,omitempty"`
Selector map[string]any `json:"selector,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
}
CreateProfileOptions defines options for creating a profile.
type CreateProfileRequest ¶
type CreateProfileRequest struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
ProviderConfigID string `json:"provider_config_id,omitempty"`
Resources map[string]any `json:"resources,omitempty"`
Network map[string]any `json:"network,omitempty"`
InitScript string `json:"init_script,omitempty"`
CleanupScript string `json:"cleanup_script,omitempty"`
Tunnels []map[string]any `json:"tunnels,omitempty"`
Selector map[string]any `json:"selector,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
}
CreateProfileRequest is the request body for creating a profile.
type CreateProviderConfigOptions ¶
type CreateProviderConfigOptions struct {
Name string `json:"name"`
Provider string `json:"provider"`
Config map[string]any `json:"config,omitempty"`
SuspendConfig map[string]any `json:"suspend_config,omitempty"`
IsDefault bool `json:"is_default,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
CreateProviderConfigOptions defines options for creating a provider configuration.
type CreateProviderConfigRequest ¶
type CreateProviderConfigRequest struct {
Name string `json:"name"`
Provider string `json:"provider"`
Config map[string]any `json:"config,omitempty"`
SuspendConfig map[string]any `json:"suspend_config,omitempty"`
IsDefault bool `json:"is_default,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
CreateProviderConfigRequest is the request body for creating a provider config.
type CreateRunnerTokenOptions ¶
type CreateRunnerTokenOptions struct {
PoolName string `json:"pool_name"`
Labels map[string]string `json:"labels,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
}
CreateRunnerTokenOptions defines options for creating a runner token.
type CreateRunnerTokenRequest ¶
type CreateRunnerTokenRequest struct {
PoolName string `json:"pool_name"`
Labels map[string]string `json:"labels,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
}
CreateRunnerTokenRequest is the request body for creating a runner token.
type CreateRunnerTokenResponse ¶
type CreateRunnerTokenResponse struct {
Token *store.RunnerToken `json:"token"`
RawToken string `json:"raw_token"`
}
CreateRunnerTokenResponse is the response for creating a runner token.
type CreateWebhookInput ¶
type CreateWebhookInput struct {
Name string
URL string
Events []string
MaxRetries *int
RetryDelaySeconds *int
TimeoutSeconds *int
Headers map[string]string
TenantID *string
Labels map[string]string
Annotations map[string]string
}
CreateWebhookInput defines input for creating a webhook.
type CreateWebhookRequest ¶
type CreateWebhookRequest struct {
Name string `json:"name"`
URL string `json:"url"`
Events []string `json:"events"`
MaxRetries *int `json:"max_retries,omitempty"`
RetryDelaySeconds *int `json:"retry_delay_seconds,omitempty"`
TimeoutSeconds *int `json:"timeout_seconds,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
}
CreateWebhookRequest is the request body for creating a webhook.
type CreateWebhookResponse ¶
type CreateWebhookResponse struct {
Webhook *store.Webhook `json:"webhook"`
Secret string `json:"secret"`
}
CreateWebhookResponse is the response for creating a webhook.
type ErrorResponse ¶
ErrorResponse represents an error response.
type HealthResponse ¶
type HealthResponse struct {
Status string `json:"status"`
Version string `json:"version"`
Service string `json:"service"`
}
HealthResponse is the response for health check endpoints.
type HealthService ¶
type HealthService interface {
CheckLiveness(ctx context.Context) health.Response
CheckReadiness(ctx context.Context) health.Response
}
HealthService defines the interface for health checking.
type InvalidStateError ¶
InvalidStateError represents an invalid state transition error.
func (*InvalidStateError) Error ¶
func (e *InvalidStateError) Error() string
type ListAPIKeysOptions ¶
type ListAPIKeysOptions struct {
Limit int `json:"limit,omitempty"`
Cursor string `json:"cursor,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
ListAPIKeysOptions defines options for listing API keys.
type ListActionLogsOptions ¶
type ListActionLogsOptions struct {
// Pagination
Limit int `json:"limit,omitempty"`
Cursor string `json:"cursor,omitempty"`
// Actor filters
ActorType string `json:"actor_type,omitempty"` // user, api_key, system, runner
ActorID string `json:"actor_id,omitempty"`
// Action filters
Action string `json:"action,omitempty"` // Exact match
ActionPrefix string `json:"action_prefix,omitempty"` // Prefix match (e.g., "permission.")
// Resource filters
ResourceType string `json:"resource_type,omitempty"`
ResourceID string `json:"resource_id,omitempty"`
// Context filters
SessionID string `json:"session_id,omitempty"`
TaskID string `json:"task_id,omitempty"`
// Result filters
Success *bool `json:"success,omitempty"` // nil = all, true = success only, false = failure only
// Time range filters (RFC3339 format)
From *time.Time `json:"from,omitempty"` // created_at >= from
To *time.Time `json:"to,omitempty"` // created_at <= to
}
ListActionLogsOptions defines options for listing action logs.
type ListAgentConfigsOptions ¶
type ListAgentConfigsOptions struct {
Limit int `json:"limit,omitempty"`
Cursor string `json:"cursor,omitempty"`
Agent string `json:"agent,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
ListAgentConfigsOptions defines options for listing agent configurations.
type ListProfilesOptions ¶
type ListProfilesOptions struct {
Limit int `json:"limit,omitempty"`
Cursor string `json:"cursor,omitempty"`
ProviderConfigID string `json:"provider_config_id,omitempty"`
IncludeBuiltin bool `json:"include_builtin,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
ListProfilesOptions defines options for listing profiles.
type ListProviderConfigsOptions ¶
type ListProviderConfigsOptions struct {
Limit int `json:"limit,omitempty"`
Cursor string `json:"cursor,omitempty"`
Provider string `json:"provider,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
ListProviderConfigsOptions defines options for listing provider configurations.
type ListResult ¶
type ListResult[T any] struct { Items []*T `json:"items"` NextCursor string `json:"next_cursor,omitempty"` TotalCount int64 `json:"total_count,omitempty"` }
ListResult is a generic paginated list result.
type ListRunnerTokensOptions ¶
type ListRunnerTokensOptions struct {
Limit int `json:"limit,omitempty"`
Cursor string `json:"cursor,omitempty"`
PoolName string `json:"pool_name,omitempty"`
Status []string `json:"status,omitempty"`
IncludeRevoked bool `json:"include_revoked,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
ListRunnerTokensOptions defines options for listing runner tokens.
type ListRunnersOptions ¶
type ListRunnersOptions struct {
Limit int `json:"limit,omitempty"`
Cursor string `json:"cursor,omitempty"`
Status []string `json:"status,omitempty"`
PoolName string `json:"pool_name,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
ListRunnersOptions defines options for listing runners.
type MockAPIKeyService ¶
type MockAPIKeyService struct {
// contains filtered or unexported fields
}
MockAPIKeyService is a mock implementation of APIKeyService for testing.
func NewMockAPIKeyService ¶
func NewMockAPIKeyService() *MockAPIKeyService
NewMockAPIKeyService creates a new mock API key service.
func (*MockAPIKeyService) AddKey ¶
func (m *MockAPIKeyService) AddKey(key *store.APIKey)
AddKey adds a key to the mock for testing.
func (*MockAPIKeyService) ClearInternalError ¶
func (m *MockAPIKeyService) ClearInternalError()
ClearInternalError clears the internal error.
func (*MockAPIKeyService) Create ¶
func (m *MockAPIKeyService) Create(_ context.Context, opts CreateAPIKeyOptions) (*store.APIKey, string, error)
Create creates a new API key.
func (*MockAPIKeyService) List ¶
func (m *MockAPIKeyService) List(_ context.Context, opts ListAPIKeysOptions) (*ListResult[store.APIKey], error)
List returns API keys matching the given options.
func (*MockAPIKeyService) Revoke ¶
func (m *MockAPIKeyService) Revoke(_ context.Context, id, reason string) error
Revoke revokes an API key.
func (*MockAPIKeyService) SetInternalError ¶
func (m *MockAPIKeyService) SetInternalError(err error)
SetInternalError sets an internal error to be returned on next operation.
type MockActionLogService ¶
type MockActionLogService struct {
// contains filtered or unexported fields
}
MockActionLogService is a mock implementation of ActionLogService for testing.
func NewMockActionLogService ¶
func NewMockActionLogService() *MockActionLogService
NewMockActionLogService creates a new mock action log service.
func (*MockActionLogService) AddLog ¶
func (m *MockActionLogService) AddLog(log *store.ActionLog)
AddLog adds a log entry for testing.
func (*MockActionLogService) List ¶
func (m *MockActionLogService) List(_ context.Context, opts ListActionLogsOptions) (*ListResult[store.ActionLog], error)
List returns action logs matching the given options.
func (*MockActionLogService) Reset ¶
func (m *MockActionLogService) Reset()
Reset clears all logs and errors.
func (*MockActionLogService) SetInternalError ¶
func (m *MockActionLogService) SetInternalError(err error)
SetInternalError sets an error to be returned by subsequent calls.
type MockAgentConfigService ¶
type MockAgentConfigService struct {
// contains filtered or unexported fields
}
MockAgentConfigService is a mock implementation of AgentConfigService for testing.
func NewMockAgentConfigService ¶
func NewMockAgentConfigService() *MockAgentConfigService
NewMockAgentConfigService creates a new mock agent config service.
func (*MockAgentConfigService) AddConfig ¶
func (m *MockAgentConfigService) AddConfig(config *store.AgentConfig)
AddConfig adds a config to the mock for testing.
func (*MockAgentConfigService) ClearInternalError ¶
func (m *MockAgentConfigService) ClearInternalError()
ClearInternalError clears the internal error.
func (*MockAgentConfigService) ClearValidationError ¶
func (m *MockAgentConfigService) ClearValidationError()
ClearValidationError clears the validation error.
func (*MockAgentConfigService) Create ¶
func (m *MockAgentConfigService) Create(_ context.Context, opts CreateAgentConfigOptions) (*store.AgentConfig, error)
Create creates a new agent configuration.
func (*MockAgentConfigService) Delete ¶
func (m *MockAgentConfigService) Delete(_ context.Context, id string) error
Delete deletes an agent configuration.
func (*MockAgentConfigService) Get ¶
func (m *MockAgentConfigService) Get(_ context.Context, id string) (*store.AgentConfig, error)
Get retrieves an agent configuration by ID.
func (*MockAgentConfigService) List ¶
func (m *MockAgentConfigService) List(_ context.Context, opts ListAgentConfigsOptions) (*ListResult[store.AgentConfig], error)
List returns agent configurations matching the given options.
func (*MockAgentConfigService) SetInternalError ¶
func (m *MockAgentConfigService) SetInternalError(err error)
SetInternalError sets an internal error to be returned on next operation.
func (*MockAgentConfigService) SetValidationError ¶
func (m *MockAgentConfigService) SetValidationError(field, message string)
SetValidationError sets a validation error to be returned on next update.
func (*MockAgentConfigService) Update ¶
func (m *MockAgentConfigService) Update(_ context.Context, id string, opts UpdateAgentConfigOptions) (*store.AgentConfig, error)
Update updates an agent configuration.
type MockProfileService ¶
type MockProfileService struct {
// contains filtered or unexported fields
}
MockProfileService is a mock implementation of ProfileService for testing.
func NewMockProfileService ¶
func NewMockProfileService() *MockProfileService
NewMockProfileService creates a new mock profile service.
func (*MockProfileService) AddProfile ¶
func (m *MockProfileService) AddProfile(profile *store.Profile)
AddProfile adds a profile to the mock for testing.
func (*MockProfileService) ClearInternalError ¶
func (m *MockProfileService) ClearInternalError()
ClearInternalError clears the internal error.
func (*MockProfileService) ClearValidationError ¶
func (m *MockProfileService) ClearValidationError()
ClearValidationError clears the validation error.
func (*MockProfileService) Create ¶
func (m *MockProfileService) Create(_ context.Context, opts CreateProfileOptions) (*store.Profile, error)
Create creates a new profile.
func (*MockProfileService) Delete ¶
func (m *MockProfileService) Delete(_ context.Context, id string) error
Delete deletes a profile.
func (*MockProfileService) List ¶
func (m *MockProfileService) List(_ context.Context, opts ListProfilesOptions) (*ListResult[store.Profile], error)
List returns profiles matching the given options.
func (*MockProfileService) SetInternalError ¶
func (m *MockProfileService) SetInternalError(err error)
SetInternalError sets an internal error to be returned on next operation.
func (*MockProfileService) SetValidationError ¶
func (m *MockProfileService) SetValidationError(field, message string)
SetValidationError sets a validation error to be returned on next update.
func (*MockProfileService) Update ¶
func (m *MockProfileService) Update(_ context.Context, id string, opts UpdateProfileOptions) (*store.Profile, error)
Update updates a profile.
type MockProviderConfigService ¶
type MockProviderConfigService struct {
// contains filtered or unexported fields
}
MockProviderConfigService is a mock implementation of ProviderConfigService for testing.
func NewMockProviderConfigService ¶
func NewMockProviderConfigService() *MockProviderConfigService
NewMockProviderConfigService creates a new mock provider config service.
func (*MockProviderConfigService) AddConfig ¶
func (m *MockProviderConfigService) AddConfig(config *store.ProviderConfig)
AddConfig adds a config to the mock for testing.
func (*MockProviderConfigService) ClearInternalError ¶
func (m *MockProviderConfigService) ClearInternalError()
ClearInternalError clears the internal error.
func (*MockProviderConfigService) ClearValidationError ¶
func (m *MockProviderConfigService) ClearValidationError()
ClearValidationError clears the validation error.
func (*MockProviderConfigService) Create ¶
func (m *MockProviderConfigService) Create(_ context.Context, opts CreateProviderConfigOptions) (*store.ProviderConfig, error)
Create creates a new provider configuration.
func (*MockProviderConfigService) Delete ¶
func (m *MockProviderConfigService) Delete(_ context.Context, id string) error
Delete deletes a provider configuration.
func (*MockProviderConfigService) Get ¶
func (m *MockProviderConfigService) Get(_ context.Context, id string) (*store.ProviderConfig, error)
Get retrieves a provider configuration by ID.
func (*MockProviderConfigService) List ¶
func (m *MockProviderConfigService) List(_ context.Context, opts ListProviderConfigsOptions) (*ListResult[store.ProviderConfig], error)
List returns provider configurations matching the given options.
func (*MockProviderConfigService) SetInternalError ¶
func (m *MockProviderConfigService) SetInternalError(err error)
SetInternalError sets an internal error to be returned on next operation.
func (*MockProviderConfigService) SetValidationError ¶
func (m *MockProviderConfigService) SetValidationError(field, message string)
SetValidationError sets a validation error to be returned on next update.
func (*MockProviderConfigService) Update ¶
func (m *MockProviderConfigService) Update(_ context.Context, id string, opts UpdateProviderConfigOptions) (*store.ProviderConfig, error)
Update updates a provider configuration.
type MockRunnerAdminService ¶
type MockRunnerAdminService struct {
// contains filtered or unexported fields
}
MockRunnerAdminService is a mock implementation of RunnerAdminService for testing.
func NewMockRunnerAdminService ¶
func NewMockRunnerAdminService() *MockRunnerAdminService
NewMockRunnerAdminService creates a new mock runner admin service.
func (*MockRunnerAdminService) AddRunner ¶
func (m *MockRunnerAdminService) AddRunner(runner *store.Runner)
AddRunner adds a runner to the mock for testing.
func (*MockRunnerAdminService) ClearInternalError ¶
func (m *MockRunnerAdminService) ClearInternalError()
ClearInternalError clears the internal error.
func (*MockRunnerAdminService) ClearValidationError ¶
func (m *MockRunnerAdminService) ClearValidationError()
ClearValidationError clears the validation error.
func (*MockRunnerAdminService) Destroy ¶
func (m *MockRunnerAdminService) Destroy(_ context.Context, id string) error
Destroy terminates and removes a runner.
func (*MockRunnerAdminService) List ¶
func (m *MockRunnerAdminService) List(_ context.Context, opts ListRunnersOptions) (*ListResult[store.Runner], error)
List returns runners matching the given options.
func (*MockRunnerAdminService) SetInternalError ¶
func (m *MockRunnerAdminService) SetInternalError(err error)
SetInternalError sets an internal error to be returned on next operation.
func (*MockRunnerAdminService) SetValidationError ¶
func (m *MockRunnerAdminService) SetValidationError(field, message string)
SetValidationError sets a validation error to be returned on next operation.
func (*MockRunnerAdminService) Spawn ¶
func (m *MockRunnerAdminService) Spawn(_ context.Context, opts SpawnRunnerOptions) (*store.Runner, error)
Spawn creates a new runner using the specified provider.
type Option ¶
type Option func(*Server)
Option is a functional option for configuring the server.
func WithAPIKeyService ¶
func WithAPIKeyService(s APIKeyService) Option
WithAPIKeyService sets the API key service.
func WithActionLogService ¶
func WithActionLogService(s ActionLogService) Option
WithActionLogService sets the action log service.
func WithAgentConfigService ¶
func WithAgentConfigService(s AgentConfigService) Option
WithAgentConfigService sets the agent config service.
func WithHealthService ¶
func WithHealthService(hs HealthService) Option
WithHealthService sets the health service for liveness/readiness probes.
func WithMiddleware ¶
WithMiddleware adds a middleware to the server. Middlewares are applied in the order they are added.
func WithProfileService ¶
func WithProfileService(s ProfileService) Option
WithProfileService sets the profile service.
func WithProviderConfigService ¶
func WithProviderConfigService(s ProviderConfigService) Option
WithProviderConfigService sets the provider config service.
func WithRunnerAdminService ¶
func WithRunnerAdminService(s RunnerAdminService) Option
WithRunnerAdminService sets the runner admin service.
func WithRunnerTokenAdminService ¶
func WithRunnerTokenAdminService(s RunnerTokenAdminService) Option
WithRunnerTokenAdminService sets the runner token admin service.
func WithSessionActivator ¶
func WithSessionActivator(s SessionActivator) Option
WithSessionActivator sets the session activator (for testing).
func WithSignalingHandler ¶
func WithSignalingHandler(h *SignalingHandler) Option
WithSignalingHandler sets the signaling handler.
func WithStreamsHandler ¶
func WithStreamsHandler(h *StreamsHandler) Option
WithStreamsHandler sets the streams handler.
func WithWebhookService ¶
func WithWebhookService(s WebhookService) Option
WithWebhookService sets the webhook service.
type ProfileAdapter ¶
type ProfileAdapter struct {
// contains filtered or unexported fields
}
ProfileAdapter adapts a ProfileStore to admin.ProfileService.
func NewProfileAdapter ¶
func NewProfileAdapter(s ProfileStore) *ProfileAdapter
NewProfileAdapter creates a new ProfileAdapter.
func (*ProfileAdapter) Create ¶
func (a *ProfileAdapter) Create(ctx context.Context, opts CreateProfileOptions) (*store.Profile, error)
Create creates a new profile.
func (*ProfileAdapter) Delete ¶
func (a *ProfileAdapter) Delete(ctx context.Context, profileID string) error
Delete deletes a profile.
func (*ProfileAdapter) List ¶
func (a *ProfileAdapter) List(ctx context.Context, opts ListProfilesOptions) (*ListResult[store.Profile], error)
List returns profiles matching the given options.
func (*ProfileAdapter) Update ¶
func (a *ProfileAdapter) Update(ctx context.Context, profileID string, opts UpdateProfileOptions) (*store.Profile, error)
Update updates a profile.
type ProfileService ¶
type ProfileService interface {
// Create creates a new profile.
Create(ctx context.Context, opts CreateProfileOptions) (*store.Profile, error)
// Get retrieves a profile by ID.
Get(ctx context.Context, id string) (*store.Profile, error)
// List returns profiles matching the given options.
List(ctx context.Context, opts ListProfilesOptions) (*ListResult[store.Profile], error)
// Update updates a profile.
Update(ctx context.Context, id string, opts UpdateProfileOptions) (*store.Profile, error)
// Delete deletes a profile.
Delete(ctx context.Context, id string) error
}
ProfileService defines the interface for profile management.
type ProfileStore ¶
type ProfileStore interface {
CreateProfile(ctx context.Context, profile *store.Profile) error
GetProfile(ctx context.Context, id string) (*store.Profile, error)
ListProfiles(ctx context.Context, opts store.ListProfilesOptions) (*store.ListResult[store.Profile], error)
UpdateProfile(ctx context.Context, id string, updates store.ProfileUpdates) error
DeleteProfile(ctx context.Context, id string) error
}
ProfileStore defines the store operations needed for profiles.
type ProviderConfigService ¶
type ProviderConfigService interface {
// Create creates a new provider configuration.
Create(ctx context.Context, opts CreateProviderConfigOptions) (*store.ProviderConfig, error)
// Get retrieves a provider configuration by ID.
Get(ctx context.Context, id string) (*store.ProviderConfig, error)
// List returns provider configurations matching the given options.
List(ctx context.Context, opts ListProviderConfigsOptions) (*ListResult[store.ProviderConfig], error)
// Update updates a provider configuration.
Update(ctx context.Context, id string, opts UpdateProviderConfigOptions) (*store.ProviderConfig, error)
// Delete deletes a provider configuration.
Delete(ctx context.Context, id string) error
}
ProviderConfigService defines the interface for provider configuration management.
type ResolutionRequest ¶
ResolutionRequest represents resolution in a request.
type RevokeAPIKeyRequest ¶
type RevokeAPIKeyRequest struct {
Reason string `json:"reason,omitempty"`
}
RevokeAPIKeyRequest is the request body for revoking an API key.
type RevokeRunnerTokenRequest ¶
type RevokeRunnerTokenRequest struct {
Reason string `json:"reason,omitempty"`
}
RevokeRunnerTokenRequest is the request body for revoking a runner token.
type RotateRunnerTokenResponse ¶
type RotateRunnerTokenResponse struct {
Token *store.RunnerToken `json:"token"`
RawToken string `json:"raw_token"`
}
RotateRunnerTokenResponse is the response for rotating a runner token.
type RotateSecretResponse ¶
type RotateSecretResponse struct {
Secret string `json:"secret"`
SecretPrefix string `json:"secret_prefix"`
}
RotateSecretResponse is the response for rotating a webhook secret.
type RunnerAdminService ¶
type RunnerAdminService interface {
// Spawn creates a new runner using the specified provider.
Spawn(ctx context.Context, opts SpawnRunnerOptions) (*store.Runner, error)
// Destroy terminates and removes a runner.
Destroy(ctx context.Context, id string) error
// Get retrieves a runner by ID.
Get(ctx context.Context, id string) (*store.Runner, error)
// List returns runners matching the given options.
List(ctx context.Context, opts ListRunnersOptions) (*ListResult[store.Runner], error)
}
RunnerAdminService defines the interface for runner administrative operations.
type RunnerTokenAdapter ¶
type RunnerTokenAdapter struct {
// contains filtered or unexported fields
}
RunnerTokenAdapter adapts auth.RunnerTokenService to admin.RunnerTokenAdminService.
func NewRunnerTokenAdapter ¶
func NewRunnerTokenAdapter(service *auth.RunnerTokenService) *RunnerTokenAdapter
NewRunnerTokenAdapter creates a new RunnerTokenAdapter.
func (*RunnerTokenAdapter) Create ¶
func (a *RunnerTokenAdapter) Create(ctx context.Context, opts CreateRunnerTokenOptions) (*store.RunnerToken, string, error)
Create creates a new runner token and returns the token and plaintext secret.
func (*RunnerTokenAdapter) Get ¶
func (a *RunnerTokenAdapter) Get(ctx context.Context, id string) (*store.RunnerToken, error)
Get retrieves a runner token by ID.
func (*RunnerTokenAdapter) List ¶
func (a *RunnerTokenAdapter) List(ctx context.Context, opts ListRunnerTokensOptions) (*ListResult[store.RunnerToken], error)
List returns runner tokens matching the given options.
func (*RunnerTokenAdapter) Revoke ¶
func (a *RunnerTokenAdapter) Revoke(ctx context.Context, id, reason string) error
Revoke revokes a runner token with an optional reason.
func (*RunnerTokenAdapter) Rotate ¶
func (a *RunnerTokenAdapter) Rotate(ctx context.Context, id string) (*store.RunnerToken, string, error)
Rotate rotates a runner token and returns the new plaintext secret.
type RunnerTokenAdminService ¶
type RunnerTokenAdminService interface {
// Create creates a new runner token and returns the token and plaintext secret.
Create(ctx context.Context, opts CreateRunnerTokenOptions) (*store.RunnerToken, string, error)
// Get retrieves a runner token by ID.
Get(ctx context.Context, id string) (*store.RunnerToken, error)
// List returns runner tokens matching the given options.
List(ctx context.Context, opts ListRunnerTokensOptions) (*ListResult[store.RunnerToken], error)
// Revoke revokes a runner token with an optional reason.
Revoke(ctx context.Context, id, reason string) error
// Rotate rotates a runner token and returns the new plaintext secret.
Rotate(ctx context.Context, id string) (*store.RunnerToken, string, error)
}
RunnerTokenAdminService defines the interface for runner token management.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the admin API HTTP server.
func (*Server) BasicAuthMiddleware ¶
BasicAuthMiddleware returns a middleware that validates basic auth credentials.
type ServiceRegistry ¶
type ServiceRegistry struct {
// contains filtered or unexported fields
}
ServiceRegistry tracks running services.
func (*ServiceRegistry) GetAll ¶
func (r *ServiceRegistry) GetAll() []ServiceStatus
GetAll returns all registered services.
type ServiceStatus ¶
type ServiceStatus struct {
Name string `json:"name"`
Port int `json:"port"`
Status string `json:"status"` // "ok", "error", "unknown"
Message string `json:"message,omitempty"`
}
ServiceStatus represents the status of a service.
type SessionActivator ¶
type SessionActivator interface {
// Activate activates a session with the given runner.
Activate(ctx context.Context, sessionID, runnerID string) error
// Suspend suspends a session with the given strategy.
Suspend(ctx context.Context, sessionID, strategy string) error
}
SessionActivator defines the interface for activating sessions (for testing).
type SignalingConfig ¶
type SignalingConfig struct {
ReadBufferSize int
WriteBufferSize int
WriteWait time.Duration
PongWait time.Duration
PingPeriod time.Duration
MaxMessageSize int64
AllowedOrigins []string
}
SignalingConfig contains configuration for the signaling handler.
func DefaultSignalingConfig ¶
func DefaultSignalingConfig() SignalingConfig
DefaultSignalingConfig returns default signaling configuration.
type SignalingHandler ¶
type SignalingHandler struct {
// contains filtered or unexported fields
}
SignalingHandler handles WebSocket connections for WebRTC signaling.
func NewSignalingHandler ¶
func NewSignalingHandler(handler *sfu.SignalingHandler, config SignalingConfig, logger *zap.Logger) *SignalingHandler
NewSignalingHandler creates a new SignalingHandler.
func (*SignalingHandler) ServeHTTP ¶
func (h *SignalingHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles WebSocket upgrade and signaling messages.
type SpawnRunnerOptions ¶
type SpawnRunnerOptions struct {
Name string `json:"name,omitempty"`
ProviderConfigID string `json:"provider_config_id,omitempty"`
Provider string `json:"provider,omitempty"`
ProfileID string `json:"profile_id,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
WorkspaceID string `json:"workspace_id,omitempty"` // Optional workspace ID for mount
WorkspaceMount string `json:"workspace_mount,omitempty"` // Host path to mount as workspace
}
SpawnRunnerOptions defines options for spawning a runner.
type SpawnRunnerRequest ¶
type SpawnRunnerRequest struct {
Name string `json:"name,omitempty"`
ProviderConfigID string `json:"provider_config_id"`
ProfileID string `json:"profile_id,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
SpawnRunnerRequest is the request body for spawning a runner.
type StatusResponse ¶
type StatusResponse struct {
Services []ServiceStatus `json:"services"`
}
StatusResponse contains the status of all services.
type StreamCommandSender ¶
type StreamCommandSender interface {
SendCommand(runnerID string, cmd *pb.ServerCommand) error
}
StreamCommandSender sends stream commands to runners.
type StreamManager ¶
type StreamManager interface {
StartStream(ctx context.Context, opts streaming.StreamOptions) (*streaming.Stream, error)
StopStream(ctx context.Context, streamID string) error
GetStream(ctx context.Context, streamID string) (*streaming.Stream, error)
GetStreamBySession(ctx context.Context, sessionID string, streamType streaming.StreamType) (*streaming.Stream, error)
ListStreams(ctx context.Context, params streaming.ListStreamsParams) ([]*streaming.Stream, int, error)
ListSessionStreams(ctx context.Context, sessionID string) ([]*streaming.Stream, error)
}
StreamManager interface for stream operations.
type StreamRequest ¶
type StreamRequest struct {
SessionID string `json:"session_id"`
RunnerID string `json:"runner_id,omitempty"`
Type streaming.StreamType `json:"type"`
Resolution *ResolutionRequest `json:"resolution,omitempty"`
FrameRate int `json:"frame_rate,omitempty"`
BitRate int `json:"bitrate,omitempty"`
AudioEnabled bool `json:"audio_enabled,omitempty"`
InputEnabled bool `json:"input_enabled,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
StreamRequest represents the request body for creating a stream.
type StreamResponse ¶
type StreamResponse struct {
ID string `json:"id"`
SessionID string `json:"session_id"`
RunnerID string `json:"runner_id,omitempty"`
Type string `json:"type"`
State string `json:"state"`
SignalingURL string `json:"signaling_url,omitempty"`
Resolution *ResolutionRequest `json:"resolution,omitempty"`
FrameRate int `json:"frame_rate,omitempty"`
BitRate int `json:"bitrate,omitempty"`
VideoCodec string `json:"video_codec,omitempty"`
AudioCodec string `json:"audio_codec,omitempty"`
AudioEnabled bool `json:"audio_enabled"`
InputEnabled bool `json:"input_enabled"`
ProviderName string `json:"provider_name"`
ProviderStreamID string `json:"provider_stream_id,omitempty"`
Error string `json:"error,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
StartedAt string `json:"started_at,omitempty"`
StoppedAt string `json:"stopped_at,omitempty"`
}
StreamResponse represents a stream in API responses.
type StreamsHandler ¶
type StreamsHandler struct {
// contains filtered or unexported fields
}
StreamsHandler handles stream-related HTTP requests.
func NewStreamsHandler ¶
func NewStreamsHandler(mgr StreamManager, cmdSender StreamCommandSender, logger *zap.Logger) *StreamsHandler
NewStreamsHandler creates a new StreamsHandler.
func (*StreamsHandler) Create ¶
func (h *StreamsHandler) Create(w http.ResponseWriter, r *http.Request)
Create creates a new stream.
func (*StreamsHandler) Get ¶
func (h *StreamsHandler) Get(w http.ResponseWriter, r *http.Request)
Get gets a stream by ID.
func (*StreamsHandler) List ¶
func (h *StreamsHandler) List(w http.ResponseWriter, r *http.Request)
List lists streams with optional filters.
func (*StreamsHandler) Routes ¶
func (h *StreamsHandler) Routes() chi.Router
Routes returns the handler's routes.
func (*StreamsHandler) Stop ¶
func (h *StreamsHandler) Stop(w http.ResponseWriter, r *http.Request)
Stop stops a stream.
type UpdateAgentConfigOptions ¶
type UpdateAgentConfigOptions struct {
Name *string `json:"name,omitempty"`
APIKey *string `json:"api_key,omitempty"`
Model *string `json:"model,omitempty"`
BaseURL *string `json:"base_url,omitempty"`
Extra *map[string]any `json:"extra,omitempty"`
IsDefault *bool `json:"is_default,omitempty"`
Labels *map[string]string `json:"labels,omitempty"`
}
UpdateAgentConfigOptions defines options for updating an agent configuration.
type UpdateAgentConfigRequest ¶
type UpdateAgentConfigRequest struct {
Name *string `json:"name,omitempty"`
APIKey *string `json:"api_key,omitempty"`
Model *string `json:"model,omitempty"`
BaseURL *string `json:"base_url,omitempty"`
Extra *map[string]any `json:"extra,omitempty"`
IsDefault *bool `json:"is_default,omitempty"`
Labels *map[string]string `json:"labels,omitempty"`
}
UpdateAgentConfigRequest is the request body for updating an agent config.
type UpdateProfileOptions ¶
type UpdateProfileOptions struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
ProviderConfigID *string `json:"provider_config_id,omitempty"`
Resources *map[string]any `json:"resources,omitempty"`
Network *map[string]any `json:"network,omitempty"`
InitScript *string `json:"init_script,omitempty"`
CleanupScript *string `json:"cleanup_script,omitempty"`
Tunnels *[]map[string]any `json:"tunnels,omitempty"`
Selector *map[string]any `json:"selector,omitempty"`
Labels *map[string]string `json:"labels,omitempty"`
Annotations *map[string]string `json:"annotations,omitempty"`
}
UpdateProfileOptions defines options for updating a profile.
type UpdateProfileRequest ¶
type UpdateProfileRequest struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
ProviderConfigID *string `json:"provider_config_id,omitempty"`
Resources *map[string]any `json:"resources,omitempty"`
Network *map[string]any `json:"network,omitempty"`
InitScript *string `json:"init_script,omitempty"`
CleanupScript *string `json:"cleanup_script,omitempty"`
Tunnels *[]map[string]any `json:"tunnels,omitempty"`
Selector *map[string]any `json:"selector,omitempty"`
Labels *map[string]string `json:"labels,omitempty"`
Annotations *map[string]string `json:"annotations,omitempty"`
}
UpdateProfileRequest is the request body for updating a profile.
type UpdateProviderConfigOptions ¶
type UpdateProviderConfigOptions struct {
Name *string `json:"name,omitempty"`
Config *map[string]any `json:"config,omitempty"`
SuspendConfig *map[string]any `json:"suspend_config,omitempty"`
IsDefault *bool `json:"is_default,omitempty"`
Labels *map[string]string `json:"labels,omitempty"`
}
UpdateProviderConfigOptions defines options for updating a provider configuration.
type UpdateProviderConfigRequest ¶
type UpdateProviderConfigRequest struct {
Name *string `json:"name,omitempty"`
Config *map[string]any `json:"config,omitempty"`
SuspendConfig *map[string]any `json:"suspend_config,omitempty"`
IsDefault *bool `json:"is_default,omitempty"`
Labels *map[string]string `json:"labels,omitempty"`
}
UpdateProviderConfigRequest is the request body for updating a provider config.
type UpdateWebhookInput ¶
type UpdateWebhookInput struct {
Name *string
URL *string
Events []string
IsActive *bool
MaxRetries *int
RetryDelaySeconds *int
TimeoutSeconds *int
Headers map[string]string
Labels map[string]string
Annotations map[string]string
}
UpdateWebhookInput defines input for updating a webhook.
type UpdateWebhookRequest ¶
type UpdateWebhookRequest struct {
Name *string `json:"name,omitempty"`
URL *string `json:"url,omitempty"`
Events []string `json:"events,omitempty"`
IsActive *bool `json:"is_active,omitempty"`
MaxRetries *int `json:"max_retries,omitempty"`
RetryDelaySeconds *int `json:"retry_delay_seconds,omitempty"`
TimeoutSeconds *int `json:"timeout_seconds,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
}
UpdateWebhookRequest is the request body for updating a webhook.
type ValidationError ¶
ValidationError represents a validation error.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
type WebhookAdapter ¶
type WebhookAdapter struct {
// contains filtered or unexported fields
}
WebhookAdapter adapts core.WebhookManager to the admin.WebhookService interface.
func NewWebhookAdapter ¶
func NewWebhookAdapter(manager *core.WebhookManager) *WebhookAdapter
NewWebhookAdapter creates a new WebhookAdapter.
func (*WebhookAdapter) Create ¶
func (a *WebhookAdapter) Create(ctx context.Context, input *CreateWebhookInput) (*store.Webhook, string, error)
Create creates a new webhook and returns the webhook and plaintext secret.
func (*WebhookAdapter) Delete ¶
func (a *WebhookAdapter) Delete(ctx context.Context, webhookID string) error
Delete deletes a webhook.
func (*WebhookAdapter) GetEvent ¶
func (a *WebhookAdapter) GetEvent(ctx context.Context, eventID string) (*store.WebhookEvent, error)
GetEvent retrieves a webhook event by ID.
func (*WebhookAdapter) List ¶
func (a *WebhookAdapter) List(ctx context.Context, opts store.ListWebhooksOptions) (*store.ListResult[store.Webhook], error)
List returns webhooks matching the given options.
func (*WebhookAdapter) ListEvents ¶
func (a *WebhookAdapter) ListEvents(ctx context.Context, opts store.ListWebhookEventsOptions) (*store.ListResult[store.WebhookEvent], error)
ListEvents returns webhook events matching the given options.
func (*WebhookAdapter) RetryEvent ¶
func (a *WebhookAdapter) RetryEvent(ctx context.Context, eventID string) error
RetryEvent manually retries a failed webhook event.
func (*WebhookAdapter) RotateSecret ¶
RotateSecret generates a new secret for a webhook.
func (*WebhookAdapter) Update ¶
func (a *WebhookAdapter) Update(ctx context.Context, webhookID string, input *UpdateWebhookInput) error
Update updates a webhook.
type WebhookService ¶
type WebhookService interface {
// Create creates a new webhook and returns the webhook and plaintext secret.
Create(ctx context.Context, input *CreateWebhookInput) (*store.Webhook, string, error)
// Get retrieves a webhook by ID.
Get(ctx context.Context, webhookID string) (*store.Webhook, error)
// List returns webhooks matching the given options.
List(ctx context.Context, opts store.ListWebhooksOptions) (*store.ListResult[store.Webhook], error)
// Update updates a webhook.
Update(ctx context.Context, webhookID string, input *UpdateWebhookInput) error
// Delete deletes a webhook.
Delete(ctx context.Context, webhookID string) error
// RotateSecret generates a new secret for a webhook.
RotateSecret(ctx context.Context, webhookID string) (string, error)
// GetEvent retrieves a webhook event by ID.
GetEvent(ctx context.Context, eventID string) (*store.WebhookEvent, error)
// ListEvents returns webhook events matching the given options.
ListEvents(ctx context.Context, opts store.ListWebhookEventsOptions) (*store.ListResult[store.WebhookEvent], error)
// RetryEvent manually retries a failed webhook event.
RetryEvent(ctx context.Context, eventID string) error
}
WebhookService defines the interface for webhook management.
Source Files
¶
- actionlog_adapter.go
- actionlog_handler.go
- agentconfig_handler.go
- apikey_adapter.go
- health.go
- helpers.go
- interfaces.go
- keys_handler.go
- middleware.go
- mock_actionlog.go
- mock_agentconfig.go
- mock_apikey.go
- mock_profile.go
- mock_providerconfig.go
- mock_runner.go
- openapi.go
- profile_adapter.go
- profile_handler.go
- providerconfig_handler.go
- runners_handler.go
- runnertoken_adapter.go
- runnertoken_handler.go
- server.go
- signaling_handler.go
- static.go
- status.go
- streams_handler.go
- webhook_adapter.go
- webhook_handler.go