Documentation
¶
Overview ¶
Package grpc provides the gRPC API server for AgentManager.
Index ¶
- type AgentEvent
- type AgentFilter
- type CatalogAgent
- type CheckUpdatesResponse
- type GetAgentRequest
- type GetAgentResponse
- type GetCatalogAgentRequest
- type GetCatalogAgentResponse
- type GetChangelogRequest
- type GetChangelogResponse
- type InstallAgentRequest
- type InstallAgentResponse
- type InstallMethodDef
- type Installation
- type ListAgentsRequest
- type ListAgentsResponse
- type ListCatalogRequest
- type ListCatalogResponse
- type Option
- type RefreshCatalogResponse
- type Release
- type SearchCatalogRequest
- type SearchCatalogResponse
- type Server
- func (s *Server) Address() string
- func (s *Server) CheckUpdates(ctx context.Context) (*CheckUpdatesResponse, error)
- func (s *Server) ForceStop()
- func (s *Server) GetAgent(ctx context.Context, req *GetAgentRequest) (*GetAgentResponse, error)
- func (s *Server) GetCatalogAgent(ctx context.Context, req *GetCatalogAgentRequest) (*GetCatalogAgentResponse, error)
- func (s *Server) GetChangelog(ctx context.Context, req *GetChangelogRequest) (*GetChangelogResponse, error)
- func (s *Server) GetStatus(ctx context.Context) (*StatusResponse, error)
- func (s *Server) InstallAgent(ctx context.Context, req *InstallAgentRequest) (*InstallAgentResponse, error)
- func (s *Server) ListAgents(ctx context.Context, req *ListAgentsRequest) (*ListAgentsResponse, error)
- func (s *Server) ListCatalog(ctx context.Context, req *ListCatalogRequest) (*ListCatalogResponse, error)
- func (s *Server) RefreshCatalog(ctx context.Context) (*RefreshCatalogResponse, error)
- func (s *Server) SearchCatalog(ctx context.Context, req *SearchCatalogRequest) (*SearchCatalogResponse, error)
- func (s *Server) Start(ctx context.Context, cfg ServerConfig) error
- func (s *Server) Stop(ctx context.Context) error
- func (s *Server) Subscribe() <-chan *AgentEvent
- func (s *Server) UninstallAgent(ctx context.Context, req *UninstallAgentRequest) (*UninstallAgentResponse, error)
- func (s *Server) Unsubscribe(ch <-chan *AgentEvent)
- func (s *Server) UpdateAgent(ctx context.Context, req *UpdateAgentRequest) (*UpdateAgentResponse, error)
- type ServerConfig
- type StatusResponse
- type UninstallAgentRequest
- type UninstallAgentResponse
- type UpdateAgentRequest
- type UpdateAgentResponse
- type UpdateInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentEvent ¶
type AgentEvent struct {
Type string `json:"type"` // "added", "updated", "removed", "update_available"
Installation *Installation `json:"installation,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
AgentEvent represents an agent-related event.
type AgentFilter ¶
type AgentFilter struct {
AgentIDs []string `json:"agent_ids,omitempty"`
Methods []string `json:"methods,omitempty"`
HasUpdate *bool `json:"has_update,omitempty"`
IsGlobal *bool `json:"is_global,omitempty"`
Query string `json:"query,omitempty"`
}
AgentFilter for listing agents.
type CatalogAgent ¶
type CatalogAgent struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Homepage string `json:"homepage,omitempty"`
Repository string `json:"repository,omitempty"`
InstallMethods []InstallMethodDef `json:"install_methods"`
}
CatalogAgent represents an agent in the catalog in API format.
func FromCatalogAgentDef ¶
func FromCatalogAgentDef(def *catalog.AgentDef) *CatalogAgent
FromCatalogAgentDef converts from pkg/catalog.AgentDef to API format.
type CheckUpdatesResponse ¶
type CheckUpdatesResponse struct {
Updates []*UpdateInfo `json:"updates"`
Total int `json:"total"`
}
CheckUpdatesResponse contains update check results.
type GetAgentRequest ¶
type GetAgentRequest struct {
Key string `json:"key"`
}
GetAgentRequest requests a specific agent.
type GetAgentResponse ¶
type GetAgentResponse struct {
Agent *Installation `json:"agent,omitempty"`
}
GetAgentResponse contains the agent details.
type GetCatalogAgentRequest ¶
type GetCatalogAgentRequest struct {
AgentID string `json:"agent_id"`
}
GetCatalogAgentRequest requests a catalog agent.
type GetCatalogAgentResponse ¶
type GetCatalogAgentResponse struct {
Agent *CatalogAgent `json:"agent,omitempty"`
}
GetCatalogAgentResponse contains the catalog agent.
type GetChangelogRequest ¶
type GetChangelogRequest struct {
AgentID string `json:"agent_id"`
FromVersion string `json:"from_version"`
ToVersion string `json:"to_version"`
}
GetChangelogRequest requests a changelog.
type GetChangelogResponse ¶
type GetChangelogResponse struct {
Changelog string `json:"changelog"`
Releases []*Release `json:"releases,omitempty"`
}
GetChangelogResponse contains the changelog.
type InstallAgentRequest ¶
type InstallAgentRequest struct {
AgentID string `json:"agent_id"`
Method string `json:"method"`
Global bool `json:"global"`
}
InstallAgentRequest requests agent installation.
type InstallAgentResponse ¶
type InstallAgentResponse struct {
Installation *Installation `json:"installation,omitempty"`
Success bool `json:"success"`
Message string `json:"message,omitempty"`
}
InstallAgentResponse contains the installation result.
type InstallMethodDef ¶
type InstallMethodDef struct {
Method string `json:"method"`
Package string `json:"package,omitempty"`
Command string `json:"command"`
Platforms []string `json:"platforms"`
}
InstallMethodDef defines an installation method in API format.
type Installation ¶
type Installation struct {
Key string `json:"key"`
AgentID string `json:"agent_id"`
AgentName string `json:"agent_name"`
InstallMethod string `json:"install_method"`
InstalledVersion string `json:"installed_version"`
LatestVersion string `json:"latest_version,omitempty"`
ExecutablePath string `json:"executable_path"`
InstallPath string `json:"install_path,omitempty"`
IsGlobal bool `json:"is_global"`
DetectedAt time.Time `json:"detected_at"`
LastChecked time.Time `json:"last_checked"`
Metadata map[string]string `json:"metadata,omitempty"`
HasUpdate bool `json:"has_update"`
Status string `json:"status"`
}
Installation represents an installed agent in API format.
func FromAgentInstallation ¶
func FromAgentInstallation(inst *agent.Installation) *Installation
FromAgentInstallation converts from pkg/agent.Installation to API format.
type ListAgentsRequest ¶
type ListAgentsRequest struct {
Filter *AgentFilter `json:"filter,omitempty"`
SortBy string `json:"sort_by,omitempty"`
SortOrder string `json:"sort_order,omitempty"`
Limit int `json:"limit,omitempty"`
Offset int `json:"offset,omitempty"`
}
ListAgentsRequest requests a list of agents.
type ListAgentsResponse ¶
type ListAgentsResponse struct {
Agents []*Installation `json:"agents"`
Total int `json:"total"`
}
ListAgentsResponse contains the list of agents.
type ListCatalogRequest ¶
type ListCatalogRequest struct {
Platform string `json:"platform,omitempty"`
}
ListCatalogRequest requests the catalog list.
type ListCatalogResponse ¶
type ListCatalogResponse struct {
Agents []*CatalogAgent `json:"agents"`
Total int `json:"total"`
}
ListCatalogResponse contains the catalog list.
type Option ¶ added in v1.1.0
type Option func(*Server)
Option configures a gRPC Server during construction.
func WithStartTime ¶ added in v1.1.0
WithStartTime overrides the server's start time (primarily for tests).
func WithVersion ¶ added in v1.1.0
WithVersion sets the server version string reported by GetStatus.
type RefreshCatalogResponse ¶
type RefreshCatalogResponse struct {
Success bool `json:"success"`
Updated bool `json:"updated"`
Message string `json:"message,omitempty"`
Version string `json:"version,omitempty"`
AgentCount int `json:"agent_count"`
}
RefreshCatalogResponse contains the refresh result.
type Release ¶
type Release struct {
Version string `json:"version"`
Title string `json:"title"`
Body string `json:"body"`
Highlights []string `json:"highlights,omitempty"`
PublishedAt time.Time `json:"published_at"`
URL string `json:"url,omitempty"`
}
Release represents a single release.
type SearchCatalogRequest ¶
type SearchCatalogRequest struct {
Query string `json:"query"`
Platform string `json:"platform,omitempty"`
}
SearchCatalogRequest requests a catalog search.
type SearchCatalogResponse ¶
type SearchCatalogResponse struct {
Agents []*CatalogAgent `json:"agents"`
Total int `json:"total"`
}
SearchCatalogResponse contains the search results.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the gRPC API server.
func NewServer ¶
func NewServer( cfg *config.Config, plat platform.Platform, store storage.Store, det *detector.Detector, cat *catalog.Manager, inst *installer.Manager, opts ...Option, ) *Server
NewServer creates a new gRPC server.
func (*Server) CheckUpdates ¶
func (s *Server) CheckUpdates(ctx context.Context) (*CheckUpdatesResponse, error)
CheckUpdates checks for available updates.
func (*Server) ForceStop ¶ added in v1.2.0
func (s *Server) ForceStop()
ForceStop immediately stops the gRPC server without waiting for in-flight RPCs to complete. Intended as a fallback when a bounded GracefulStop does not return in time (e.g. a wedged streaming handler during helper exit).
func (*Server) GetAgent ¶
func (s *Server) GetAgent(ctx context.Context, req *GetAgentRequest) (*GetAgentResponse, error)
GetAgent returns a specific agent by key.
func (*Server) GetCatalogAgent ¶
func (s *Server) GetCatalogAgent(ctx context.Context, req *GetCatalogAgentRequest) (*GetCatalogAgentResponse, error)
GetCatalogAgent returns a specific catalog agent.
func (*Server) GetChangelog ¶
func (s *Server) GetChangelog(ctx context.Context, req *GetChangelogRequest) (*GetChangelogResponse, error)
GetChangelog gets the changelog for an agent.
func (*Server) GetStatus ¶
func (s *Server) GetStatus(ctx context.Context) (*StatusResponse, error)
GetStatus returns the service status.
func (*Server) InstallAgent ¶
func (s *Server) InstallAgent(ctx context.Context, req *InstallAgentRequest) (*InstallAgentResponse, error)
InstallAgent installs an agent.
func (*Server) ListAgents ¶
func (s *Server) ListAgents(ctx context.Context, req *ListAgentsRequest) (*ListAgentsResponse, error)
ListAgents returns a list of detected agents.
func (*Server) ListCatalog ¶
func (s *Server) ListCatalog(ctx context.Context, req *ListCatalogRequest) (*ListCatalogResponse, error)
ListCatalog returns the catalog agents.
func (*Server) RefreshCatalog ¶
func (s *Server) RefreshCatalog(ctx context.Context) (*RefreshCatalogResponse, error)
RefreshCatalog refreshes the catalog.
func (*Server) SearchCatalog ¶
func (s *Server) SearchCatalog(ctx context.Context, req *SearchCatalogRequest) (*SearchCatalogResponse, error)
SearchCatalog searches the catalog.
func (*Server) Start ¶
func (s *Server) Start(ctx context.Context, cfg ServerConfig) error
Start starts the gRPC server.
func (*Server) Subscribe ¶
func (s *Server) Subscribe() <-chan *AgentEvent
Subscribe subscribes to agent events.
func (*Server) UninstallAgent ¶
func (s *Server) UninstallAgent(ctx context.Context, req *UninstallAgentRequest) (*UninstallAgentResponse, error)
UninstallAgent uninstalls an agent.
func (*Server) Unsubscribe ¶
func (s *Server) Unsubscribe(ch <-chan *AgentEvent)
Unsubscribe unsubscribes from agent events.
func (*Server) UpdateAgent ¶
func (s *Server) UpdateAgent(ctx context.Context, req *UpdateAgentRequest) (*UpdateAgentResponse, error)
UpdateAgent updates an agent.
type ServerConfig ¶
ServerConfig configures the gRPC server.
type StatusResponse ¶
type StatusResponse struct {
Running bool `json:"running"`
UptimeSeconds int64 `json:"uptime_seconds"`
AgentCount int `json:"agent_count"`
UpdatesAvailable int `json:"updates_available"`
LastCatalogRefresh time.Time `json:"last_catalog_refresh"`
LastUpdateCheck time.Time `json:"last_update_check"`
Version string `json:"version"`
}
StatusResponse contains the service status.
type UninstallAgentRequest ¶
type UninstallAgentRequest struct {
Key string `json:"key"`
}
UninstallAgentRequest requests agent uninstallation.
type UninstallAgentResponse ¶
type UninstallAgentResponse struct {
Success bool `json:"success"`
Message string `json:"message,omitempty"`
}
UninstallAgentResponse contains the uninstallation result.
type UpdateAgentRequest ¶
type UpdateAgentRequest struct {
Key string `json:"key"`
}
UpdateAgentRequest requests an agent update.
type UpdateAgentResponse ¶
type UpdateAgentResponse struct {
Installation *Installation `json:"installation,omitempty"`
FromVersion string `json:"from_version"`
ToVersion string `json:"to_version"`
Success bool `json:"success"`
Message string `json:"message,omitempty"`
}
UpdateAgentResponse contains the update result.
type UpdateInfo ¶
type UpdateInfo struct {
Installation *Installation `json:"installation"`
FromVersion string `json:"from_version"`
ToVersion string `json:"to_version"`
}
UpdateInfo contains information about an available update.