From 8de9797b33bbac76e5f51254843b9e6db5a94a82 Mon Sep 17 00:00:00 2001 From: Ragavi916 Date: Tue, 29 Oct 2024 12:43:01 +0530 Subject: [PATCH] PQA-2256: Added Download scan reports --- client/cluster.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/client/cluster.go b/client/cluster.go index 94e5902f..6c93d093 100644 --- a/client/cluster.go +++ b/client/cluster.go @@ -314,6 +314,39 @@ func (h *V1Client) DownloadLogs(uid string, logFetcherUID string) (io.Writer, er return logfile, nil } +// DownloadKubeBenchReport downloads the KubeBench report for the specified cluster. +func (h *V1Client) DownloadKubeBenchReport(uid, logUID string, writer io.Writer) error { + params := clientv1.NewV1ClusterFeatureDriverLogDownloadParams(). + WithUID(uid). + WithLogUID(logUID). + WithDriver("KubeBench") + + _, err := h.Client.V1ClusterFeatureDriverLogDownload(params, writer) + return err +} + +// DownloadKubeHunterReport downloads the KubeHunter report for the specified cluster. +func (h *V1Client) DownloadKubeHunterReport(uid, logUID string, writer io.Writer) error { + params := clientv1.NewV1ClusterFeatureDriverLogDownloadParams(). + WithUID(uid). + WithLogUID(logUID). + WithDriver("KubeHunter") + + _, err := h.Client.V1ClusterFeatureDriverLogDownload(params, writer) + return err +} + +// DownloadSonobuoyReport downloads the Sonobuoy report for the specified cluster. +func (h *V1Client) DownloadSonobuoyReport(uid, logUID string, writer io.Writer) error { + params := clientv1.NewV1ClusterFeatureDriverLogDownloadParams(). + WithUID(uid). + WithLogUID(logUID). + WithDriver("Sonobuoy") + + _, err := h.Client.V1ClusterFeatureDriverLogDownload(params, writer) + return err +} + // UpdatePauseAgentUpgradeSettingCluster updates the upgrade settings of a specific cluster to pause the agent upgrade process. func (h *V1Client) UpdatePauseAgentUpgradeSettingCluster(upgradeSetting *models.V1ClusterUpgradeSettingsEntity, clusterUID string) error { params := clientv1.NewV1SpectroClustersUIDUpgradeSettingsParamsWithContext(h.ctx).WithUID(clusterUID).WithBody(upgradeSetting)