Documentation
¶
Overview ¶
Package service provides the service layer for the opampcommander application.
Index ¶
- Variables
- type AgentByLabelsIndexer
- type AgentGroupPersistencePort
- type AgentGroupService
- func (s *AgentGroupService) DeleteAgentGroup(ctx context.Context, name string, deletedAt time.Time, deletedBy string) error
- func (s *AgentGroupService) GetAgentGroup(ctx context.Context, name string) (*agentgroup.AgentGroup, error)
- func (s *AgentGroupService) ListAgentGroups(ctx context.Context, options *model.ListOptions) (*model.ListResponse[*agentgroup.AgentGroup], error)
- func (s *AgentGroupService) ListAgentsByAgentGroup(ctx context.Context, agentGroup *agentgroup.AgentGroup, ...) (*model.ListResponse[*model.Agent], error)
- func (s *AgentGroupService) SaveAgentGroup(ctx context.Context, name string, agentGroup *agentgroup.AgentGroup) error
- type AgentService
- func (s *AgentService) GetAgent(ctx context.Context, instanceUID uuid.UUID) (*model.Agent, error)
- func (s *AgentService) GetOrCreateAgent(ctx context.Context, instanceUID uuid.UUID) (*model.Agent, error)
- func (s *AgentService) ListAgents(ctx context.Context, options *model.ListOptions) (*model.ListResponse[*model.Agent], error)
- func (s *AgentService) SaveAgent(ctx context.Context, agent *model.Agent) error
- func (s *AgentService) UpdateAgentConfig(ctx context.Context, instanceUID uuid.UUID, config any) error
- type CommandService
- func (s *CommandService) GetCommand(ctx context.Context, commandID uuid.UUID) (*model.Command, error)
- func (s *CommandService) GetCommandByInstanceUID(ctx context.Context, instanceUID uuid.UUID) ([]*model.Command, error)
- func (s *CommandService) ListCommands(context.Context, *model.ListOptions) (*model.ListResponse[*model.Command], error)
- func (s *CommandService) SaveCommand(ctx context.Context, command *model.Command) error
- type Service
- func (s *Service) DeleteConnection(_ context.Context, connection *model.Connection) error
- func (s *Service) GetConnectionByID(_ context.Context, id any) (*model.Connection, error)
- func (s *Service) GetConnectionByInstanceUID(_ context.Context, instanceUID uuid.UUID) (*model.Connection, error)
- func (s *Service) ListConnections(_ context.Context, options *model.ListOptions) (*model.ListResponse[*model.Connection], error)
- func (s *Service) SaveConnection(_ context.Context, connection *model.Connection) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotImplemented is returned when a method is not implemented. ErrNotImplemented = errors.New("not implemented") )
Functions ¶
This section is empty.
Types ¶
type AgentByLabelsIndexer ¶ added in v0.1.18
type AgentByLabelsIndexer interface {
// ListAgentsByIdentifyingAttributes lists agents by their identifying attributes such as labels.
ListAgentsByAttributes(
ctx context.Context,
identifyingAttributes map[string]string,
nonIdentifyingAttributes map[string]string,
options *model.ListOptions,
) (*model.ListResponse[*model.Agent], error)
}
AgentByLabelsIndexer is an interface that defines the methods for listing agents by their labels.
type AgentGroupPersistencePort ¶ added in v0.1.18
type AgentGroupPersistencePort = port.AgentGroupPersistencePort
AgentGroupPersistencePort is an alias for port.AgentGroupPersistencePort.
type AgentGroupService ¶ added in v0.1.18
type AgentGroupService struct {
// contains filtered or unexported fields
}
AgentGroupService is a struct that implements the AgentGroupUsecase interface.
func NewAgentGroupService ¶ added in v0.1.18
func NewAgentGroupService( persistencePort AgentGroupPersistencePort, _ *slog.Logger, ) *AgentGroupService
NewAgentGroupService creates a new instance of AgentGroupService.
func (*AgentGroupService) DeleteAgentGroup ¶ added in v0.1.18
func (s *AgentGroupService) DeleteAgentGroup( ctx context.Context, name string, deletedAt time.Time, deletedBy string, ) error
DeleteAgentGroup marks an agent group as deleted.
func (*AgentGroupService) GetAgentGroup ¶ added in v0.1.18
func (s *AgentGroupService) GetAgentGroup( ctx context.Context, name string, ) (*agentgroup.AgentGroup, error)
GetAgentGroup retrieves an agent group by its ID.
func (*AgentGroupService) ListAgentGroups ¶ added in v0.1.18
func (s *AgentGroupService) ListAgentGroups( ctx context.Context, options *model.ListOptions, ) (*model.ListResponse[*agentgroup.AgentGroup], error)
ListAgentGroups retrieves a list of agent groups with pagination options.
func (*AgentGroupService) ListAgentsByAgentGroup ¶ added in v0.1.18
func (s *AgentGroupService) ListAgentsByAgentGroup( ctx context.Context, agentGroup *agentgroup.AgentGroup, options *model.ListOptions, ) (*model.ListResponse[*model.Agent], error)
ListAgentsByAgentGroup lists agents that belong to the specified agent group.
func (*AgentGroupService) SaveAgentGroup ¶ added in v0.1.18
func (s *AgentGroupService) SaveAgentGroup( ctx context.Context, name string, agentGroup *agentgroup.AgentGroup, ) error
SaveAgentGroup saves the agent group.
type AgentService ¶
type AgentService struct {
// contains filtered or unexported fields
}
AgentService is a struct that implements the AgentUsecase interface.
func NewAgentService ¶
func NewAgentService( agentPersistencePort port.AgentPersistencePort, ) *AgentService
NewAgentService creates a new instance of AgentService.
func (*AgentService) GetOrCreateAgent ¶
func (s *AgentService) GetOrCreateAgent(ctx context.Context, instanceUID uuid.UUID) (*model.Agent, error)
GetOrCreateAgent retrieves an agent by its instance UID.
func (*AgentService) ListAgents ¶
func (s *AgentService) ListAgents( ctx context.Context, options *model.ListOptions, ) (*model.ListResponse[*model.Agent], error)
ListAgents retrieves all agents from the persistence layer.
func (*AgentService) UpdateAgentConfig ¶ added in v0.0.2
func (s *AgentService) UpdateAgentConfig(ctx context.Context, instanceUID uuid.UUID, config any) error
UpdateAgentConfig updates the agent configuration.
type CommandService ¶
type CommandService struct {
// contains filtered or unexported fields
}
CommandService is a struct that implements the CommandUsecase interface.
func NewCommandService ¶
func NewCommandService( commandPersistencePort port.CommandPersistencePort, ) *CommandService
NewCommandService creates a new instance of CommandService.
func (*CommandService) GetCommand ¶
func (s *CommandService) GetCommand(ctx context.Context, commandID uuid.UUID) (*model.Command, error)
GetCommand retrieves a command by its ID.
func (*CommandService) GetCommandByInstanceUID ¶
func (s *CommandService) GetCommandByInstanceUID(ctx context.Context, instanceUID uuid.UUID) ([]*model.Command, error)
GetCommandByInstanceUID retrieves a command by its instance UID.
func (*CommandService) ListCommands ¶ added in v0.0.2
func (s *CommandService) ListCommands( context.Context, *model.ListOptions, ) (*model.ListResponse[*model.Command], error)
ListCommands implements port.CommandUsecase.
func (*CommandService) SaveCommand ¶
SaveCommand saves the command to the persistence layer.
type Service ¶ added in v0.0.15
type Service struct {
// contains filtered or unexported fields
}
Service is a struct that implements the ConnectionUsecase interface.
func NewConnectionService ¶ added in v0.0.15
func NewConnectionService( agentUsecase port.AgentUsecase, logger *slog.Logger, ) *Service
NewConnectionService creates a new instance of the Service struct.
func (*Service) DeleteConnection ¶ added in v0.0.15
DeleteConnection implements port.ConnectionUsecase.
func (*Service) GetConnectionByID ¶ added in v0.0.15
GetConnectionByID implements port.ConnectionUsecase.
func (*Service) GetConnectionByInstanceUID ¶ added in v0.0.15
func (s *Service) GetConnectionByInstanceUID(_ context.Context, instanceUID uuid.UUID) (*model.Connection, error)
GetConnectionByInstanceUID implements port.ConnectionUsecase.
func (*Service) ListConnections ¶ added in v0.0.15
func (s *Service) ListConnections( _ context.Context, options *model.ListOptions, ) (*model.ListResponse[*model.Connection], error)
ListConnections implements port.ConnectionUsecase.
func (*Service) SaveConnection ¶ added in v0.0.15
SaveConnection implements port.ConnectionUsecase.