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

@@ -37,7 +37,7 @@ type UpdateRequest 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"`
// Use Huge Pages to allocate RAM of the virtual machine. The system must be pre-configured by allocating Huge Pages on the physical node
// Required: false

View File

@@ -44,7 +44,7 @@ type ListRequest struct {
// Find by list of clientIds
// Required: false
ClientIDs []string `url:"clientIds,omitempty" json:"clientIds,omitempty"`
ClientIDs []uint64 `url:"clientIds,omitempty" json:"clientIds,omitempty"`
// Page number
// Required: false

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
}

View File

@@ -153,7 +153,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"`
// Use Huge Pages to allocate RAM of the virtual machine. The system must be pre-configured by allocating Huge Pages on the physical node
// Required: false

View File

@@ -63,7 +63,7 @@ type CreateBlankRequest 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"`
// Text description of this VM
// Required: false

View File

@@ -22,12 +22,12 @@ type CreateRequest struct {
Name string `url:"name" json:"name" validate:"required"`
// External network to connect this load balancer to
// Required: true
ExtNetID uint64 `url:"extnetId" json:"extnetId" validate:"required"`
// Required: true, can be 0
ExtNetID uint64 `url:"extnetId" json:"extnetId"`
// Internal network (VINS) to connect this load balancer to
// Required: true
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
// Required: true, can be 0
VINSID uint64 `url:"vinsId" json:"vinsId"`
// Custom sysctl values for Load Balancer instance. Applied on boot
// Required: false

View File

@@ -37,7 +37,7 @@ type UpdateRequest 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"`
// Use Huge Pages to allocate RAM of the virtual machine. The system must be pre-configured by allocating Huge Pages on the physical node
// Required: false

View File

@@ -167,7 +167,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 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

@@ -65,7 +65,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

View File

@@ -157,7 +157,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"`
// Use Huge Pages to allocate RAM of the virtual machine. The system must be pre-configured by allocating Huge Pages on the physical node
// Required: false

View File

@@ -67,7 +67,7 @@ type CreateBlankRequest 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

@@ -78,7 +78,7 @@ type MassCreateRequest 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"`
}
type asyncWrapperMassCreateRequest struct {

View File

@@ -22,12 +22,12 @@ type CreateRequest struct {
Name string `url:"name" json:"name" validate:"required"`
// External network to connect this load balancer to
// Required: true
ExtNetID int64 `url:"extnetId" json:"extnetId" validate:"required"`
// Required: true, can be 0
ExtNetID int64 `url:"extnetId" json:"extnetId"`
// Internal network (VINS) to connect this load balancer to
// Required: true
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
// Required: true, can be 0
VINSID uint64 `url:"vinsId" json:"vinsId"`
// Start now Load balancer
// Required: true