Documentation
¶
Index ¶
- Variables
- func Disable(serviceName string) error
- func Enable(serviceName string) error
- func FileExist(path string) bool
- func GetServiceName(serviceName string) (string, error)
- func GetServicePath(serviceName string) (string, error)
- func InitializeGlobalManager() (err error)
- func InitializeServiceDiscovery()
- func IsActive(serviceName string) (bool, error)
- func IsEnable(serviceName string) (bool, error)
- func IsExist(serviceName string) (bool, error)
- func RegisterServiceAliases(aliases map[string][]string)
- func Restart(serviceName string) error
- func Start(serviceName string) error
- func Stop(serviceName string) error
- func ViewConfig(path string, opt ConfigOption) (string, error)
- type CommandError
- type ConfigOption
- type LogOption
- type ServiceConfig
- type ServiceHandler
- func (h *ServiceHandler) DisableService() (ServiceResult, error)
- func (h *ServiceHandler) EnableService() (ServiceResult, error)
- func (h *ServiceHandler) ExecuteAction(action string) (ServiceResult, error)
- func (h *ServiceHandler) GetServiceName() string
- func (h *ServiceHandler) GetServicePath() (string, error)
- func (h *ServiceHandler) IsActive() (ServiceStatus, error)
- func (h *ServiceHandler) IsEnabled() (ServiceStatus, error)
- func (h *ServiceHandler) IsExists() (ServiceStatus, error)
- func (h *ServiceHandler) ManagerName() string
- func (h *ServiceHandler) RestartService() (ServiceResult, error)
- func (h *ServiceHandler) StartService() (ServiceResult, error)
- func (h *ServiceHandler) StopService() (ServiceResult, error)
- type ServiceIsActive
- type ServiceIsEnabled
- type ServiceManager
- type ServiceResult
- type ServiceStatus
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrServiceNotFound = errors.New("service not found") ErrDiscoveryTimeout = errors.New("service discovery timeout for: %w") ErrServiceDiscovery = errors.New("service discovery failed for: %w") ErrNoValidService = errors.New("no valid service found for: %w") )
View Source
var ( BinaryPath = "/usr/local/bin" // 1panl service default path ErrServiceNotExist = errors.New("service does not exist") )
Functions ¶
func GetServiceName ¶
func GetServicePath ¶
func InitializeGlobalManager ¶
func InitializeGlobalManager() (err error)
func InitializeServiceDiscovery ¶
func InitializeServiceDiscovery()
func RegisterServiceAliases ¶
func ViewConfig ¶
func ViewConfig(path string, opt ConfigOption) (string, error)
Types ¶
type CommandError ¶
func (CommandError) Error ¶
func (e CommandError) Error() string
type ConfigOption ¶
type ConfigOption struct {
TailLines string
}
type ServiceConfig ¶
type ServiceHandler ¶
type ServiceHandler struct {
// contains filtered or unexported fields
}
func DefaultHandler ¶
func DefaultHandler(serviceName string) (*ServiceHandler, error)
func NewServiceHandler ¶
func NewServiceHandler(serviceNames map[string]string) *ServiceHandler
func (*ServiceHandler) DisableService ¶
func (h *ServiceHandler) DisableService() (ServiceResult, error)
func (*ServiceHandler) EnableService ¶
func (h *ServiceHandler) EnableService() (ServiceResult, error)
func (*ServiceHandler) ExecuteAction ¶
func (h *ServiceHandler) ExecuteAction(action string) (ServiceResult, error)
func (*ServiceHandler) GetServiceName ¶
func (h *ServiceHandler) GetServiceName() string
func (*ServiceHandler) GetServicePath ¶
func (h *ServiceHandler) GetServicePath() (string, error)
func (*ServiceHandler) IsActive ¶
func (h *ServiceHandler) IsActive() (ServiceStatus, error)
func (*ServiceHandler) IsEnabled ¶
func (h *ServiceHandler) IsEnabled() (ServiceStatus, error)
func (*ServiceHandler) IsExists ¶
func (h *ServiceHandler) IsExists() (ServiceStatus, error)
func (*ServiceHandler) ManagerName ¶
func (h *ServiceHandler) ManagerName() string
func (*ServiceHandler) RestartService ¶
func (h *ServiceHandler) RestartService() (ServiceResult, error)
func (*ServiceHandler) StartService ¶
func (h *ServiceHandler) StartService() (ServiceResult, error)
func (*ServiceHandler) StopService ¶
func (h *ServiceHandler) StopService() (ServiceResult, error)
type ServiceIsActive ¶
type ServiceIsEnabled ¶
type ServiceManager ¶
type ServiceManager interface { Name() string IsAvailable() bool ServiceExists(*ServiceConfig) (bool, error) BuildCommand(string, *ServiceConfig) ([]string, error) ParseStatus(string, *ServiceConfig, string) (bool, error) FindServices(string) ([]string, error) }
func GetGlobalManager ¶
func GetGlobalManager() ServiceManager
type ServiceResult ¶
type ServiceResult struct { Success bool `json:"success"` Message string `json:"message"` Output string `json:"output"` }
func CustomAction ¶
func CustomAction(action string, serviceName string) (ServiceResult, error)
Click to show internal directories.
Click to hide internal directories.