(h *models.Host, groups []models.HostGroup)
| 1228 | } |
| 1229 | |
| 1230 | func hostToResponse(h *models.Host, groups []models.HostGroup) map[string]interface{} { |
| 1231 | res := map[string]interface{}{ |
| 1232 | "id": h.ID, "friendly_name": h.FriendlyName, "hostname": h.Hostname, "ip": h.IP, |
| 1233 | "os_type": h.OSType, "os_version": h.OSVersion, "architecture": h.Architecture, |
| 1234 | "last_update": h.LastUpdate, "status": h.Status, "api_id": h.ApiID, "agent_version": h.AgentVersion, |
| 1235 | "auto_update": h.AutoUpdate, "created_at": h.CreatedAt, "notes": h.Notes, |
| 1236 | "system_uptime": h.SystemUptime, "needs_reboot": h.NeedsReboot, |
| 1237 | "docker_enabled": h.DockerEnabled, "compliance_enabled": h.ComplianceEnabled, |
| 1238 | "package_manager": h.PackageManager, "primary_interface": h.PrimaryInterface, |
| 1239 | "awaiting_post_patch_report_run_id": h.AwaitingPostPatchReportRunID, |
| 1240 | } |
| 1241 | hg := make([]map[string]interface{}, len(groups)) |
| 1242 | for i, g := range groups { |
| 1243 | hg[i] = map[string]interface{}{"id": g.ID, "name": g.Name, "color": g.Color} |
| 1244 | } |
| 1245 | res["host_group_memberships"] = hg |
| 1246 | return res |
| 1247 | } |
| 1248 | |
| 1249 | func generateApiCredentials() (apiID, apiKey, apiKeyHash string, err error) { |
| 1250 | b := make([]byte, 8) |
no outgoing calls
no test coverage detected