mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-18 11:02:54 +00:00
- Extract Invoice, Payment, Subscriber types and GetInvoices, GetPayments, GenerateInvoice methods to billing.go - Extract CarrierInfo, ConnectivityStatus, ProfileInfo types and carrier connector methods to carrier.go - Extract CreditCheckRequest/Response, CreditBalanceResponse types and charging engine methods to charging.go - Add PacketStats, CreditInfo types and GetPacketStats, GetCreditInfo
63 lines
1.6 KiB
Go
63 lines
1.6 KiB
Go
package api
|
|
|
|
import "time"
|
|
|
|
// Alert represents a monitoring alert
|
|
type Alert struct {
|
|
ID string `json:"id"`
|
|
Severity string `json:"severity"`
|
|
Service string `json:"service"`
|
|
Message string `json:"message"`
|
|
Time time.Time `json:"time"`
|
|
}
|
|
|
|
// ListAlerts returns alerts
|
|
func (c *Client) ListAlerts() ([]Alert, error) {
|
|
var resp struct {
|
|
Data []Alert `json:"data"`
|
|
}
|
|
if err := c.doGetJSON("/api/v1/alerts", &resp); err != nil {
|
|
return nil, err
|
|
}
|
|
return resp.Data, nil
|
|
}
|
|
|
|
// SystemStats represents system health/metrics
|
|
type SystemStats struct {
|
|
ActiveSessions int `json:"active_sessions"`
|
|
TotalAccounts int `json:"total_accounts"`
|
|
BlockedUsers int `json:"blocked_users"`
|
|
LowBalanceAlerts int `json:"low_balance_alerts"`
|
|
CPUUsage float64 `json:"cpu_usage"`
|
|
MemoryUsage float64 `json:"memory_usage"`
|
|
Uptime string `json:"uptime"`
|
|
}
|
|
|
|
// GetSystemStats retrieves system stats
|
|
func (c *Client) GetSystemStats() (*SystemStats, error) {
|
|
var stats SystemStats
|
|
if err := c.doGetJSON("/api/v1/system/stats", &stats); err != nil {
|
|
return nil, err
|
|
}
|
|
return &stats, nil
|
|
}
|
|
|
|
// HealthStatus represents a health check result
|
|
type HealthStatus struct {
|
|
Service string `json:"service"`
|
|
Status string `json:"status"`
|
|
Uptime string `json:"uptime"`
|
|
LastCheck time.Time `json:"last_check"`
|
|
}
|
|
|
|
// GetHealth returns per-service health
|
|
func (c *Client) GetHealth() ([]HealthStatus, error) {
|
|
var resp struct {
|
|
Data []HealthStatus `json:"data"`
|
|
}
|
|
if err := c.doGetJSON("/api/v1/health", &resp); err != nil {
|
|
return nil, err
|
|
}
|
|
return resp.Data, nil
|
|
}
|