From 775c1ae44538997630bc527e29ff959062cc8eb8 Mon Sep 17 00:00:00 2001 From: Ahmad Ibrahim Date: Thu, 5 Dec 2024 16:59:17 -0800 Subject: [PATCH] feat: add UpdateAwsHybridMachinePool and DeleteAwsHybridMachinePool funcs --- client/hybrid.go | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/client/hybrid.go b/client/hybrid.go index ffdc66f1..488315af 100644 --- a/client/hybrid.go +++ b/client/hybrid.go @@ -27,11 +27,32 @@ func (h *V1Client) PutAwsHybridConfig(configUID string, hybridConfig *models.V1A } // CreateAwsHybridMachinePool creates a Hybrid AWS cloud config's Edge-Native machine pool -func (h *V1Client) CreateAwsHybridMachinePool(configUID string, machinePool *models.V1HybridEdgeNativeMachinePoolConfigEntity) error { +func (h *V1Client) CreateAwsHybridMachinePool(configUID string, machinePoolConfig *models.V1HybridEdgeNativeMachinePoolConfigEntity) error { params := clientv1.NewV1AwsCloudConfigsEdgeNativeUIDMachinePoolCreateParamsWithContext(h.ctx). - WithBody(machinePool). + WithBody(machinePoolConfig). WithConfigUID(configUID) _, err := h.Client.V1AwsCloudConfigsEdgeNativeUIDMachinePoolCreate(params) return err } + +// UpdateAwsHybridMachinePool updates the specified Hybrid AWS cluster cloud config's Edge-Native machine pool +func (h *V1Client) UpdateAwsHybridMachinePool(configUID, machinePoolName string, machinePoolConfig *models.V1HybridEdgeNativeMachinePoolConfigUpdateEntity) error { + params := clientv1.NewV1AwsCloudConfigsEdgeNativeMachinePoolUpdateParamsWithContext(h.ctx). + WithBody(machinePoolConfig). + WithMachinePoolName(machinePoolName). + WithConfigUID(configUID) + + _, err := h.Client.V1AwsCloudConfigsEdgeNativeMachinePoolUpdate(params) + return err +} + +// DeleteAwsHybridMachinePool deletes the specified Edge-Native machine pool of hybrid AWS cluster +func (h *V1Client) DeleteAwsHybridMachinePool(configUID, machinePoolName string) error { + params := clientv1.NewV1AwsCloudConfigsEdgeNativeMachinePoolDeleteParamsWithContext(h.ctx). + WithMachinePoolName(machinePoolName). + WithConfigUID(configUID) + + _, err := h.Client.V1AwsCloudConfigsEdgeNativeMachinePoolDelete(params) + return err +}