From a924c898aca60d3863a4c00bb9b4b2e7d96e9346 Mon Sep 17 00:00:00 2001 From: Sivaanand Murugesan Date: Fri, 18 Oct 2024 10:34:54 +0530 Subject: [PATCH] PLT-1439:Add support for node deletion and get machine lists Signed-off-by: Sivaanand Murugesan --- client/node_actions.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/client/node_actions.go b/client/node_actions.go index bdbeb6ef..f6403b1b 100644 --- a/client/node_actions.go +++ b/client/node_actions.go @@ -223,3 +223,40 @@ func (h *V1Client) GetNodeMaintenanceStatusVsphere(configUID, machineName, nodeI } return resp.Payload.Status.MaintenanceStatus, nil } + +// GetNodeListInEdgeNativeMachinePool retrieves machine in the edge-native machine pool +func (h *V1Client) GetNodeListInEdgeNativeMachinePool(configUID, machineName string) (*models.V1EdgeNativeMachines, error) { + params := clientv1.NewV1CloudConfigsEdgeNativePoolMachinesListParamsWithContext(h.ctx). + WithConfigUID(configUID). + WithMachinePoolName(machineName) + resp, err := h.Client.V1CloudConfigsEdgeNativePoolMachinesList(params) + if err != nil { + return nil, err + } + return resp.Payload, nil +} + +// GetNodeInEdgeNativeMachinePool retrieves specific machine in the edge-native machine pool. +func (h *V1Client) GetNodeInEdgeNativeMachinePool(configUID, machineName, machineID string) (*models.V1EdgeNativeMachine, error) { + params := clientv1.NewV1CloudConfigsEdgeNativePoolMachinesUIDGetParamsWithContext(h.ctx). + WithConfigUID(configUID). + WithMachinePoolName(machineName).WithMachineUID(machineID) + resp, err := h.Client.V1CloudConfigsEdgeNativePoolMachinesUIDGet(params) + if err != nil { + return nil, err + } + return resp.Payload, nil +} + +// DeleteNodeInEdgeNativeMachinePool delete the specific node in the edge-native machine pool +func (h *V1Client) DeleteNodeInEdgeNativeMachinePool(configUID, machineName, machineID string) error { + params := clientv1.NewV1CloudConfigsEdgeNativePoolMachinesUIDDeleteParamsWithContext(h.ctx). + WithConfigUID(configUID). + WithMachinePoolName(machineName). + WithMachineUID(machineID) + _, err := h.Client.V1CloudConfigsEdgeNativePoolMachinesUIDDelete(params) + if err != nil { + return err + } + return nil +}