DownloadSSGContent downloads a specific SSG datastream file from the server.
(ctx context.Context, filename, destPath string)
| 346 | |
| 347 | // DownloadSSGContent downloads a specific SSG datastream file from the server. |
| 348 | func (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) |
| 368 | func (c *Client) SendPatchOutput(ctx context.Context, patchRunID, stage, output, errorMessage string) error { |