From e5a48f101981d02c6ac79e93f07fb876850102d8 Mon Sep 17 00:00:00 2001 From: Sivaanand Murugesan Date: Fri, 26 Jul 2024 15:26:31 +0530 Subject: [PATCH] added comment --- client/cluster.go | 13 +++++++------ client/cluster_host_config.go | 1 + client/node_actions.go | 4 ++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/client/cluster.go b/client/cluster.go index 4f8c483e..70758817 100644 --- a/client/cluster.go +++ b/client/cluster.go @@ -314,12 +314,13 @@ func (h *V1Client) DownloadLogs(uid string, logFetcherUID string) (io.Writer, er return logfile, nil } +// 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) - //params = params.WithUID(clusterUID).WithBody(upgradeSetting) - //_, err := h.Client.V1SpectroClustersUIDUpgradeSettings(params) - //if err != nil { - // return err - //} + params := clientv1.NewV1SpectroClustersUIDUpgradeSettingsParamsWithContext(h.ctx) + params = params.WithUID(clusterUID).WithBody(upgradeSetting) + _, err := h.Client.V1SpectroClustersUIDUpgradeSettings(params) + if err != nil { + return err + } return nil } diff --git a/client/cluster_host_config.go b/client/cluster_host_config.go index dce9310c..61bf7326 100644 --- a/client/cluster_host_config.go +++ b/client/cluster_host_config.go @@ -14,6 +14,7 @@ func (h *V1Client) UpdateClusterHostConfig(uid string, config *models.V1HostClus return err } +// ApplyClusterHostConfig applies the specified host configuration to the cluster identified by the given UID. func (h *V1Client) ApplyClusterHostConfig(uid string, config *models.V1HostClusterConfigEntity) error { policy, err := h.GetClusterScanConfig(uid) if err != nil { diff --git a/client/node_actions.go b/client/node_actions.go index 4c4dc78b..ce18dcaf 100644 --- a/client/node_actions.go +++ b/client/node_actions.go @@ -5,6 +5,7 @@ import ( "github.com/spectrocloud/palette-api-go/models" ) +// GetMaintenanceStatus defines a function type that retrieves the maintenance status of a machine. type GetMaintenanceStatus func(string, string, string) (*models.V1MachineMaintenanceStatus, error) // ToggleMaintenanceOnNode updates maintenance configuration for a node. @@ -20,6 +21,7 @@ func (h *V1Client) ToggleMaintenanceOnNode(nodeMaintenance *models.V1MachineMain return err } +// GetNodeMaintenanceStatus retrieves the maintenance status of a specific node. func (h *V1Client) GetNodeMaintenanceStatus(fn GetMaintenanceStatus, configUid, machineName, nodeId string) (*models.V1MachineMaintenanceStatus, error) { return fn(configUid, machineName, nodeId) } @@ -165,6 +167,8 @@ func (h *V1Client) GetNodeMaintenanceStatusGke(configUID, machineName, nodeID st return resp.Payload.Status.MaintenanceStatus, nil } +// GetNodeMaintenanceStatusGke retrieves maintenance status for a Libvirt node. +// TODO: libevirt deprecation func (h *V1Client) GetNodeMaintenanceStatusLibvirt(ConfigUID, MachineName, NodeId string) (*models.V1MachineMaintenanceStatus, error) { //params := clientv1.NewV1CloudConfigsLibvirtPoolMachinesUIDGetParamsWithContext(h.ctx).