MCPcopy Create free account
hub / github.com/PatchMon/PatchMon / dbHostToModel

Function dbHostToModel

server-source-code/internal/store/convert.go:448–496  ·  view source on GitHub ↗
(h db.Host)

Source from the content-addressed store, hash-verified

446}
447
448func dbHostToModel(h db.Host) *models.Host {
449 return &models.Host{
450 ID: h.ID,
451 MachineID: h.MachineID,
452 FriendlyName: h.FriendlyName,
453 IP: h.Ip,
454 OSType: h.OsType,
455 OSVersion: h.OsVersion,
456 Architecture: h.Architecture,
457 LastUpdate: pgTime(h.LastUpdate),
458 Status: h.Status,
459 CreatedAt: pgTime(h.CreatedAt),
460 UpdatedAt: pgTime(h.UpdatedAt),
461 ApiID: h.ApiID,
462 ApiKey: h.ApiKey,
463 AgentVersion: h.AgentVersion,
464 AutoUpdate: h.AutoUpdate,
465 CPUCores: pgInt32ToInt(h.CpuCores),
466 CPUModel: h.CpuModel,
467 DiskDetails: models.JSON(h.DiskDetails),
468 DNSServers: models.JSON(h.DnsServers),
469 GatewayIP: h.GatewayIp,
470 Hostname: h.Hostname,
471 KernelVersion: h.KernelVersion,
472 InstalledKernelVersion: h.InstalledKernelVersion,
473 LoadAverage: models.JSON(h.LoadAverage),
474 NetworkInterfaces: models.JSON(h.NetworkInterfaces),
475 RamInstalled: h.RamInstalled,
476 SelinuxStatus: h.SelinuxStatus,
477 SwapSize: h.SwapSize,
478 SystemUptime: h.SystemUptime,
479 Notes: h.Notes,
480 NeedsReboot: h.NeedsReboot,
481 RebootReason: h.RebootReason,
482 DockerEnabled: h.DockerEnabled,
483 ComplianceEnabled: h.ComplianceEnabled,
484 ComplianceOnDemandOnly: h.ComplianceOnDemandOnly,
485 ComplianceOpenscapEnabled: h.ComplianceOpenscapEnabled,
486 ComplianceDockerBenchEnabled: h.ComplianceDockerBenchEnabled,
487 ComplianceScannerStatus: models.JSON(h.ComplianceScannerStatus),
488 ComplianceScannerUpdatedAt: pgTimePtr(h.ComplianceScannerUpdatedAt),
489 ComplianceDefaultProfileID: h.ComplianceDefaultProfileID,
490 HostDownAlertsEnabled: h.HostDownAlertsEnabled,
491 ExpectedPlatform: h.ExpectedPlatform,
492 PackageManager: h.PackageManager,
493 PrimaryInterface: h.PrimaryInterface,
494 AwaitingPostPatchReportRunID: h.AwaitingPostPatchReportRunID,
495 }
496}
497
498func pgTime(t pgtype.Timestamp) time.Time {
499 if t.Valid {

Callers 4

ListMethod · 0.85
GetByIDsMethod · 0.85
GetByApiIDMethod · 0.85
GetHostDockerDetailMethod · 0.85

Calls 3

pgInt32ToIntFunction · 0.85
pgTimePtrFunction · 0.85
pgTimeFunction · 0.70

Tested by

no test coverage detected