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

Method SendPatchOutput

agent-source-code/internal/client/client.go:368–398  ·  view source on GitHub ↗

SendPatchOutput sends patch run output/status to the server (agent-facing patching endpoint)

(ctx context.Context, patchRunID, stage, output, errorMessage string)

Source from the content-addressed store, hash-verified

366
367// SendPatchOutput sends patch run output/status to the server (agent-facing patching endpoint)
368func (c *Client) SendPatchOutput(ctx context.Context, patchRunID, stage, output, errorMessage string) error {
369 url := fmt.Sprintf("%s/api/%s/patching/runs/%s/output", c.config.PatchmonServer, c.config.APIVersion, patchRunID)
370
371 body := map[string]interface{}{
372 "stage": stage,
373 }
374 if output != "" {
375 body["output"] = output
376 }
377 if errorMessage != "" {
378 body["error_message"] = errorMessage
379 }
380
381 resp, err := c.client.R().
382 SetContext(ctx).
383 SetHeader("Content-Type", "application/json").
384 SetHeader("X-API-ID", c.credentials.APIID).
385 SetHeader("X-API-KEY", c.credentials.APIKey).
386 SetBody(body).
387 Post(url)
388
389 if err != nil {
390 return fmt.Errorf("patch output request failed: %w", err)
391 }
392
393 if resp.StatusCode() != 200 {
394 return fmt.Errorf("patch output request failed with status %d: %s", resp.StatusCode(), truncateResponse(resp.String(), 200))
395 }
396
397 return nil
398}
399
400// WindowsUpdateResult reports the outcome of a single Windows Update installation.
401type WindowsUpdateResult struct {

Callers 3

FlushMethod · 0.80
runPatchFunction · 0.80
runPatchWindowsFunction · 0.80

Calls 1

truncateResponseFunction · 0.85

Tested by

no test coverage detected