This commit is contained in:
2025-04-09 11:21:07 +03:00
parent 3f21a89e80
commit 8a101c6fcb
115 changed files with 2342 additions and 429 deletions

View File

@@ -23,10 +23,6 @@ type MaintenanceRequest struct {
// Required: false
Offline bool `url:"offline" json:"offline"`
// VDiskAction
// Required: false
VDiskAction string `url:"vdiskaction,omitempty" json:"vdiskaction,omitempty"`
// Reason
// Required: false
Reason string `url:"reason,omitempty" json:"reason,omitempty"`

View File

@@ -3,6 +3,7 @@ package node
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
@@ -15,34 +16,36 @@ type SetVFsNumberRequest struct {
// PCI address or NIC name
// Required: true
NicID string `url:"nicId" json:"nicId" validate:"required"`
NICID string `url:"nicId" json:"nicId" validate:"required"`
// Number of VF to assign
// Required: true
VFNum uint64 `url:"vfNum" json:"vfNum" validate:"required"`
// Trust
// Number of VF to assign
// Required: true
Trust bool `url:"trust" json:"trust" validate:"required"`
// Enable spoof checking
// Required: true
Spoofchk bool `url:"spoofchk" json:"spoofchk" validate:"required"`
VFParams []VFParam `url:"vfParams" json:"vfParams" validate:"required"`
}
// SetVFsNumber sets number of VFs for individual NIC on node
func (n Node) SetVFsNumber(ctx context.Context, req SetVFsNumberRequest) (string, error) {
func (n Node) SetVFsNumber(ctx context.Context, req SetVFsNumberRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/node/setVFsNumber"
res, err := n.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return "", err
return false, err
}
return string(res), nil
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}

View File

@@ -0,0 +1,61 @@
package node
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
type VFParam struct {
// Number of VF to assign
// Required: true
VFNum uint64 `url:"vfNum" json:"vfNum" validate:"required"`
// Trust
// Required: true
Trust bool `url:"trust" json:"trust" validate:"required"`
// Enable spoof checking
// Required: true
SpoofChk bool `url:"spoofchk" json:"spoofchk" validate:"required"`
}
// SetVFsParamsRequest struct to set params of VFs for individual NIC on node
type SetVFsParamsRequest struct {
// Node ID
// Required: true
NID uint64 `url:"nid" json:"nid" validate:"required"`
// PCI address or NIC name
// Required: true
NICID string `url:"nicId" json:"nicId" validate:"required"`
// Number of VF to assign
// Required: true
VFParams []VFParam `url:"vfParams" json:"vfParams" validate:"required"`
}
// SetVFsParams sets params of VFs for individual NIC on node
func (n Node) SetVFsParams(ctx context.Context, req SetVFsParamsRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/node/setVFsParams"
res, err := n.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}