models

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: GPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NewAutobrrService     func() ServiceHealthChecker
	NewRadarrService      func() ServiceHealthChecker
	NewSonarrService      func() ServiceHealthChecker
	NewProwlarrService    func() ServiceHealthChecker
	NewOverseerrService   func() ServiceHealthChecker
	NewPlexService        func() ServiceHealthChecker
	NewOmegabrrService    func() ServiceHealthChecker
	NewTailscaleService   func() ServiceHealthChecker
	NewMaintainerrService func() ServiceHealthChecker
	NewGeneralService     func() ServiceHealthChecker
)

Service creation function types

Functions

This section is empty.

Types

type Service

type Service struct {
	ID             string `json:"id"`
	Type           string `json:"type"`
	URL            string `json:"url"`
	APIKey         string `json:"apiKey,omitempty"`
	Name           string `json:"name"`
	DisplayName    string `json:"displayName,omitempty"`
	HealthEndpoint string `json:"healthEndpoint,omitempty"`
}

Service represents a configured service instance

type ServiceConfiguration

type ServiceConfiguration struct {
	ID          int64  `json:"-"` // Hide ID from JSON response
	InstanceID  string `json:"instanceId" gorm:"uniqueIndex"`
	DisplayName string `json:"displayName"`
	URL         string `json:"url"`
	APIKey      string `json:"apiKey,omitempty"`
}

ServiceConfiguration is the database model

type ServiceCreator

type ServiceCreator interface {
	CreateService(serviceType string) ServiceHealthChecker
}

ServiceCreator is responsible for creating service instances

func NewServiceRegistry

func NewServiceRegistry() ServiceCreator

NewServiceRegistry creates a new instance of ServiceRegistry

type ServiceHealth

type ServiceHealth struct {
	Status          string                 `json:"status"`
	ResponseTime    int64                  `json:"responseTime"`
	LastChecked     time.Time              `json:"lastChecked"`
	Message         string                 `json:"message,omitempty"`
	Version         string                 `json:"version,omitempty"`
	UpdateAvailable bool                   `json:"updateAvailable,omitempty"`
	ServiceID       string                 `json:"serviceId"`
	Stats           map[string]interface{} `json:"stats,omitempty"`
	Details         map[string]interface{} `json:"details,omitempty"`
}

ServiceHealth represents the health status of a service

type ServiceHealthChecker

type ServiceHealthChecker interface {
	CheckHealth(url, apiKey string) (ServiceHealth, int)
}

ServiceHealthChecker defines the interface for service health checking

type ServiceRegistry

type ServiceRegistry struct{}

ServiceRegistry is the default implementation of ServiceCreator

func (*ServiceRegistry) CreateService

func (r *ServiceRegistry) CreateService(serviceType string) ServiceHealthChecker

CreateService returns a new service instance based on the service type

Jump to

Keyboard shortcuts

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