working on system management
This commit is contained in:
@@ -115,3 +115,19 @@ func (h *Handler) GenerateSupportBundle(c *gin.Context) {
|
||||
c.JSON(http.StatusAccepted, gin.H{"task_id": taskID})
|
||||
}
|
||||
|
||||
// ListNetworkInterfaces lists all network interfaces
|
||||
func (h *Handler) ListNetworkInterfaces(c *gin.Context) {
|
||||
interfaces, err := h.service.ListNetworkInterfaces(c.Request.Context())
|
||||
if err != nil {
|
||||
h.logger.Error("Failed to list network interfaces", "error", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to list network interfaces"})
|
||||
return
|
||||
}
|
||||
|
||||
// Ensure we return an empty array instead of null
|
||||
if interfaces == nil {
|
||||
interfaces = []NetworkInterface{}
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{"interfaces": interfaces})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user