This commit is contained in:
2026-06-05 17:30:36 +03:00
parent 3e2edf53a5
commit f1112e5a11
1246 changed files with 6117 additions and 1589 deletions

View File

@@ -2,9 +2,10 @@ package node
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// SetMemAllocationRatioRequest struct to set memory allocation ratio
@@ -15,22 +16,29 @@ type SetMemAllocationRatioRequest struct {
// Allocation ratio (zero or positive value)
// Required: true
Ratio float64 `url:"ratio" json:"ratio" validate:"required"`
Ratio uint64 `url:"ratio" json:"ratio" validate:"required"`
}
// SetMemAllocationRatio set memory allocation ratio
func (i Node) SetMemAllocationRatio(ctx context.Context, req SetMemAllocationRatioRequest) error {
func (i Node) SetMemAllocationRatio(ctx context.Context, req SetMemAllocationRatioRequest) (*ItemNode, error) {
err := validators.ValidateRequest(req)
if err != nil {
return validators.ValidationErrors(validators.GetErrors(err))
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/node/set_mem_allocation_ratio"
_, err = i.client.DecortApiCall(ctx, http.MethodPost, url, req)
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return err
return nil, err
}
return nil
info := ItemNode{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}