Documentation
¶
Index ¶
- func GenerateRandomID(prefix string) string
- type AddressProbeResult
- type AgentDetailResponse
- type AgentResponse
- type ConnectivityReport
- type ConnectivityRequest
- type ConnectivityResult
- type CreateRequest
- type DetailRequest
- type EnrollRequest
- type EnrollResponse
- type FullSyncRequest
- type FullSyncResponse
- type FullSyncResult
- type GenerateEnrollmentTokenRequest
- type GenerateEnrollmentTokenResponse
- type Handler
- func (h *Handler) CheckConnectivity(c *app.Context, req ConnectivityRequest) (ConnectivityReport, error)
- func (h *Handler) Create(c *app.Context, req CreateRequest) (api.Created[models.Agent], error)
- func (h *Handler) Delete(c *app.Context, req api.IDPathRequest) (api.StatusResponse, error)
- func (h *Handler) Detail(c *app.Context, req DetailRequest) (AgentDetailResponse, error)
- func (h *Handler) Enroll(c *app.Context, req EnrollRequest) (api.Created[EnrollResponse], error)
- func (h *Handler) FullSync(c *app.Context, req FullSyncRequest) (FullSyncResponse, error)
- func (h *Handler) GenerateEnrollmentToken(c *app.Context, req GenerateEnrollmentTokenRequest) (GenerateEnrollmentTokenResponse, error)
- func (h *Handler) Get(c *app.Context, req api.IDPathRequest) (models.Agent, error)
- func (h *Handler) GetConnectivity(c *app.Context, req ConnectivityRequest) (*ConnectivityReport, error)
- func (h *Handler) List(c *app.Context, req ListRequest) (api.PaginatedResponse[AgentResponse], error)
- func (h *Handler) Online(c *app.Context, _ api.EmptyRequest) ([]OnlineAgentInfo, error)
- func (h *Handler) Update(c *app.Context, req UpdateRequest) (models.Agent, error)
- type ListRequest
- type OnlineAgentInfo
- type RuntimeInfo
- type UpdateRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateRandomID ¶
Types ¶
type AddressProbeResult ¶
type AgentDetailResponse ¶
type AgentDetailResponse struct {
models.Agent
Runtime *RuntimeInfo `json:"runtime"`
ConfiguredHTTPAddresses string `json:"configured_http_addresses,omitempty"`
EffectiveHTTPAddresses string `json:"effective_http_addresses,omitempty"`
}
type AgentResponse ¶
type AgentResponse struct {
ID uint `json:"id"`
AgentID string `json:"agent_id"`
Name string `json:"name"`
Status int `json:"status"`
LastSeen int64 `json:"last_seen"`
CreatedAt int64 `json:"created_at"`
HTTPAddresses string `json:"http_addresses,omitempty"` // Legacy: effective addresses
ConfiguredHTTPAddresses string `json:"configured_http_addresses,omitempty"` // DB-configured addresses
EffectiveHTTPAddresses string `json:"effective_http_addresses,omitempty"` // Merged effective addresses
Tags string `json:"tags"`
}
type ConnectivityReport ¶
type ConnectivityReport struct {
AgentID string `json:"agent_id"`
CheckedAt int64 `json:"checked_at"`
Results []ConnectivityResult `json:"results"`
}
type ConnectivityRequest ¶
type ConnectivityRequest struct {
ID string `uri:"id" binding:"required"`
}
type ConnectivityResult ¶
type ConnectivityResult struct {
TargetAgentID string `json:"target_agent_id"`
TargetName string `json:"target_name"`
Results []AddressProbeResult `json:"results"`
}
type CreateRequest ¶
type DetailRequest ¶
type DetailRequest struct {
ID string `uri:"id" binding:"required"`
}
type EnrollRequest ¶
type EnrollResponse ¶
type FullSyncRequest ¶
type FullSyncResponse ¶
type FullSyncResponse struct {
Results []FullSyncResult `json:"results"`
}
type FullSyncResult ¶
type GenerateEnrollmentTokenRequest ¶
type GenerateEnrollmentTokenRequest struct {
TTL int64 `json:"ttl"`
}
type Handler ¶
type Handler struct {
GetOnlineAgentIDs func() []string
GetRuntime func(agentID string) *msync.AgentRuntime
HubCall func(agentID string, method string, params any, timeout time.Duration) (json.RawMessage, error)
Hub *msync.Hub // 用于获取合并后的地址
}
func (*Handler) CheckConnectivity ¶
func (h *Handler) CheckConnectivity(c *app.Context, req ConnectivityRequest) (ConnectivityReport, error)
func (*Handler) Delete ¶
func (h *Handler) Delete(c *app.Context, req api.IDPathRequest) (api.StatusResponse, error)
func (*Handler) Detail ¶
func (h *Handler) Detail(c *app.Context, req DetailRequest) (AgentDetailResponse, error)
func (*Handler) Enroll ¶
func (h *Handler) Enroll(c *app.Context, req EnrollRequest) (api.Created[EnrollResponse], error)
func (*Handler) FullSync ¶
func (h *Handler) FullSync(c *app.Context, req FullSyncRequest) (FullSyncResponse, error)
func (*Handler) GenerateEnrollmentToken ¶
func (h *Handler) GenerateEnrollmentToken(c *app.Context, req GenerateEnrollmentTokenRequest) (GenerateEnrollmentTokenResponse, error)
func (*Handler) GetConnectivity ¶
func (h *Handler) GetConnectivity(c *app.Context, req ConnectivityRequest) (*ConnectivityReport, error)
func (*Handler) List ¶
func (h *Handler) List(c *app.Context, req ListRequest) (api.PaginatedResponse[AgentResponse], error)
func (*Handler) Online ¶
func (h *Handler) Online(c *app.Context, _ api.EmptyRequest) ([]OnlineAgentInfo, error)
type ListRequest ¶
type ListRequest struct {
api.PaginationQuery
Search string `form:"search"`
Status string `form:"status"`
}
type OnlineAgentInfo ¶
type OnlineAgentInfo struct {
AgentID string `json:"agent_id"`
Name string `json:"name"`
Tags string `json:"tags"`
HTTPAddresses string `json:"http_addresses,omitempty"` // Legacy: effective addresses
ConfiguredHTTPAddresses string `json:"configured_http_addresses,omitempty"` // DB-configured addresses
EffectiveHTTPAddresses string `json:"effective_http_addresses,omitempty"` // Merged effective addresses
LastSeen int64 `json:"last_seen"`
}
type RuntimeInfo ¶
type RuntimeInfo struct {
Uptime int64 `json:"uptime"`
CachedTokens int `json:"cached_tokens"`
CachedChannels int `json:"cached_channels"`
CachedModels int `json:"cached_models"`
ActiveConnections int `json:"active_connections"`
Version int64 `json:"version"`
MasterVersion int64 `json:"master_version"`
CacheStats map[string]protocol.CacheEntityStats `json:"cache_stats,omitempty"`
}
type UpdateRequest ¶
type UpdateRequest struct {
ID string `uri:"id" binding:"required"`
Fields map[string]any `json:"-"`
}
func (*UpdateRequest) SetBodyMap ¶
func (r *UpdateRequest) SetBodyMap(fields map[string]any)
Click to show internal directories.
Click to hide internal directories.