( ctx context.Context, operationID string, dst io.Writer, )
| 1695 | } |
| 1696 | |
| 1697 | func (c *unixSocketClient) DownloadSupportBundle( |
| 1698 | ctx context.Context, |
| 1699 | operationID string, |
| 1700 | dst io.Writer, |
| 1701 | ) (err error) { |
| 1702 | if dst == nil { |
| 1703 | return errors.New("cli: support bundle download writer is required") |
| 1704 | } |
| 1705 | response, err := c.doRequest(ctx, http.MethodGet, supportBundleOperationPath(operationID)+"/download", nil, nil) |
| 1706 | if err != nil { |
| 1707 | return err |
| 1708 | } |
| 1709 | defer func() { |
| 1710 | if closeErr := response.Body.Close(); closeErr != nil { |
| 1711 | closeErr = fmt.Errorf("cli: close support bundle download response: %w", closeErr) |
| 1712 | if err == nil { |
| 1713 | err = closeErr |
| 1714 | return |
| 1715 | } |
| 1716 | err = errors.Join(err, closeErr) |
| 1717 | } |
| 1718 | }() |
| 1719 | if response.StatusCode < 200 || response.StatusCode >= 300 { |
| 1720 | return readAPIError(response) |
| 1721 | } |
| 1722 | if _, err := io.Copy(dst, response.Body); err != nil { |
| 1723 | return fmt.Errorf("cli: download support bundle: %w", err) |
| 1724 | } |
| 1725 | return nil |
| 1726 | } |
| 1727 | |
| 1728 | func supportBundleOperationPath(operationID string) string { |
| 1729 | return "/api/support/bundles/" + url.PathEscape(strings.TrimSpace(operationID)) |
nothing calls this directly
no test coverage detected