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

Method DownloadSSGContent

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

DownloadSSGContent downloads a specific SSG datastream file from the server.

(ctx context.Context, filename, destPath string)

Source from the content-addressed store, hash-verified

346
347// DownloadSSGContent downloads a specific SSG datastream file from the server.
348func (c *Client) DownloadSSGContent(ctx context.Context, filename, destPath string) error {
349 url := fmt.Sprintf("%s/api/%s/compliance/ssg-content/%s", c.config.PatchmonServer, c.config.APIVersion, filename)
350
351 resp, err := c.client.R().
352 SetContext(ctx).
353 SetHeader("X-API-ID", c.credentials.APIID).
354 SetHeader("X-API-KEY", c.credentials.APIKey).
355 SetOutput(destPath).
356 Get(url)
357
358 if err != nil {
359 return fmt.Errorf("ssg-content download failed: %w", err)
360 }
361 if resp.StatusCode() != 200 {
362 return fmt.Errorf("ssg-content download failed with status %d", resp.StatusCode())
363 }
364 return nil
365}
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 {

Callers

nothing calls this directly

Calls 1

GetMethod · 0.45

Tested by

no test coverage detected