Skip to content

Commit

Permalink
Refactor DeleteWorker function to use ClusterDeleteWorkerRequest inst…
Browse files Browse the repository at this point in the history
…ead of ClusterDeleteNodeRequest in kubernetes_workers.go file.
  • Loading branch information
hrybun authored and DevMike committed Jan 2, 2024
1 parent 6a0f287 commit 1bf65d8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ah/kubernetes_clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ type KubernetesClustersAPI interface {
CreateWorkerPool(context.Context, string, *CreateKubernetesWorkerPoolRequest) (*KubernetesWorkerPool, error)
UpdateWorkerPool(context.Context, string, string, *UpdateKubernetesWorkerPoolRequest) error
DeleteWorkerPool(context.Context, string, string, bool) error
DeleteWorker(context.Context, string, string, string, *ClusterDeleteNodeRequest) error
DeleteWorker(context.Context, string, string, string, *ClusterDeleteWorkerRequest) error
}

// KubernetesClustersService implements ClustersAPI interface.
Expand Down
4 changes: 2 additions & 2 deletions ah/kubernetes_workers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ type KubernetesWorker struct {
CloudServerID string `json:"cloud_server_id,omitempty"`
}

type ClusterDeleteNodeRequest struct {
type ClusterDeleteWorkerRequest struct {
Replace bool `json:"replace,omitempty"`
}

// DeleteWorker deletes worker pool
func (kcs *KubernetesClustersService) DeleteWorker(ctx context.Context, clusterID, workerPoolID, workerID string, request *ClusterDeleteNodeRequest) error {
func (kcs *KubernetesClustersService) DeleteWorker(ctx context.Context, clusterID, workerPoolID, workerID string, request *ClusterDeleteWorkerRequest) error {
path := fmt.Sprintf("api/v2/kubernetes/clusters/%s/worker_pools/%s/workers/%s", clusterID, workerPoolID, workerID)
req, err := kcs.client.newRequest(http.MethodDelete, path, nil)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion ah/kubernetes_workers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func TestWorkerDelete(t *testing.T) {

ctx := context.Background()

req := &ClusterDeleteNodeRequest{
req := &ClusterDeleteWorkerRequest{
Replace: false,
}

Expand Down

0 comments on commit 1bf65d8

Please sign in to comment.