This commit is contained in:
2024-11-22 12:09:50 +03:00
parent 80491ed643
commit 9ec34c6bfc
21 changed files with 57 additions and 156 deletions

View File

@@ -165,7 +165,7 @@ type CreateRequest struct {
// Type of the emulated system, Q35 or i440fx
// Required: false
Chipset string `url:"chipset,omitempty" json:"chipset,omitempty"`
Chipset string `url:"chipset,omitempty" json:"chipset,omitempty" validate:"omitempty,chipset"`
}
// GetRAM returns RAM field values

View File

@@ -24,7 +24,7 @@ type WorkerAddRequest struct {
// Type of the emulated system, Q35 or i440fx
// Required: false
Chipset string `url:"chipset,omitempty" json:"chipset,omitempty"`
Chipset string `url:"chipset,omitempty" json:"chipset,omitempty" validate:"omitempty,chipset"`
}
// WorkerAdd adds worker nodes to a Kubernetes cluster

View File

@@ -3,7 +3,6 @@ package k8s
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
@@ -63,7 +62,7 @@ type WorkersGroupAddRequest struct {
// Type of the emulated system, Q35 or i440fx
// Required: false
Chipset string `url:"chipset,omitempty" json:"chipset,omitempty"`
Chipset string `url:"chipset,omitempty" json:"chipset,omitempty" validate:"omitempty,chipset"`
}
// GetRAM returns RAM field values
@@ -77,23 +76,18 @@ func (r WorkersGroupAddRequest) GetRAM() map[string]uint64 {
}
// WorkersGroupAdd adds workers group to Kubernetes cluster
func (k8s K8S) WorkersGroupAdd(ctx context.Context, req WorkersGroupAddRequest) (uint64, error) {
func (k8s K8S) WorkersGroupAdd(ctx context.Context, req WorkersGroupAddRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return 0, validators.ValidationErrors(validators.GetErrors(err))
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/k8s/workersGroupAdd"
res, err := k8s.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return 0, err
return "", err
}
result, err := strconv.ParseUint(string(res), 10, 64)
if err != nil {
return 0, err
}
return result, nil
return string(res), nil
}