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

Method GetSSGVersion

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

GetSSGVersion fetches the server's embedded SSG version and available content files.

(ctx context.Context)

Source from the content-addressed store, hash-verified

322
323// GetSSGVersion fetches the server's embedded SSG version and available content files.
324func (c *Client) GetSSGVersion(ctx context.Context) (*SSGVersionResponse, error) {
325 url := fmt.Sprintf("%s/api/%s/compliance/ssg-version", c.config.PatchmonServer, c.config.APIVersion)
326
327 resp, err := c.client.R().
328 SetContext(ctx).
329 SetHeader("X-API-ID", c.credentials.APIID).
330 SetHeader("X-API-KEY", c.credentials.APIKey).
331 SetResult(&SSGVersionResponse{}).
332 Get(url)
333
334 if err != nil {
335 return nil, fmt.Errorf("ssg-version request failed: %w", err)
336 }
337 if resp.StatusCode() != 200 {
338 return nil, fmt.Errorf("ssg-version request failed with status %d", resp.StatusCode())
339 }
340 result, ok := resp.Result().(*SSGVersionResponse)
341 if !ok {
342 return nil, fmt.Errorf("invalid ssg-version response format")
343 }
344 return result, nil
345}
346
347// DownloadSSGContent downloads a specific SSG datastream file from the server.
348func (c *Client) DownloadSSGContent(ctx context.Context, filename, destPath string) error {

Callers

nothing calls this directly

Calls 1

GetMethod · 0.45

Tested by

no test coverage detected