MCPcopy Index your code
hub / github.com/PatchMon/PatchMon / hostToResponse

Function hostToResponse

server-source-code/internal/handler/hosts.go:1230–1247  ·  view source on GitHub ↗
(h *models.Host, groups []models.HostGroup)

Source from the content-addressed store, hash-verified

1228}
1229
1230func 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
1249func generateApiCredentials() (apiID, apiKey, apiKeyHash string, err error) {
1250 b := make([]byte, 8)

Callers 9

AdminListMethod · 0.85
GetByIDMethod · 0.85
UpdateGroupsMethod · 0.85
UpdateFriendlyNameMethod · 0.85
UpdateNotesMethod · 0.85
UpdateConnectionMethod · 0.85
SetPrimaryInterfaceMethod · 0.85
BulkUpdateGroupsMethod · 0.85
GetHostsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected