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

Method GetByID

server-source-code/internal/handler/hosts.go:119–128  ·  view source on GitHub ↗

GetByID handles GET /hosts/:hostId.

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

117
118// GetByID handles GET /hosts/:hostId.
119func (h *HostsHandler) GetByID(w http.ResponseWriter, r *http.Request) {
120 hostID := chi.URLParam(r, "hostId")
121 host, err := h.hosts.GetByID(r.Context(), hostID)
122 if err != nil || host == nil {
123 Error(w, http.StatusNotFound, "Host not found")
124 return
125 }
126 groups, _ := h.hosts.GetHostGroups(r.Context(), host.ID)
127 JSON(w, http.StatusOK, hostToResponse(host, groups))
128}
129
130// Create handles POST /hosts/create.
131func (h *HostsHandler) Create(w http.ResponseWriter, r *http.Request) {

Callers 15

HostQueueMethod · 0.45
GetHostStatsMethod · 0.45
GetHostInfoMethod · 0.45
GetHostNetworkMethod · 0.45
GetHostSystemMethod · 0.45
GetHostPackagesMethod · 0.45
GetHostPackageReportsMethod · 0.45
GetHostAgentQueueMethod · 0.45
GetHostNotesMethod · 0.45
GetHostIntegrationsMethod · 0.45
DeleteHostMethod · 0.45
GetMethod · 0.45

Calls 4

ErrorFunction · 0.85
hostToResponseFunction · 0.85
GetHostGroupsMethod · 0.80
JSONFunction · 0.70

Tested by

no test coverage detected