You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dynamix-golang-sdk/pkg/cloudbroker/node/set_vfs_number.go

52 lines
1.2 KiB

2 months ago
package node
import (
"context"
"net/http"
1 month ago
"strconv"
2 months ago
1 month ago
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
2 months ago
)
// SetVFsNumberRequest struct to set number of VFs for individual NIC on node
type SetVFsNumberRequest struct {
// Node ID
// Required: true
NID uint64 `url:"nid" json:"nid" validate:"required"`
// PCI address or NIC name
// Required: true
1 month ago
NICID string `url:"nicId" json:"nicId" validate:"required"`
2 months ago
// Number of VF to assign
// Required: true
VFNum uint64 `url:"vfNum" json:"vfNum" validate:"required"`
1 month ago
// Number of VF to assign
1 month ago
// Required: true
1 month ago
VFParams []VFParam `url:"vfParams" json:"vfParams" validate:"required"`
2 months ago
}
// SetVFsNumber sets number of VFs for individual NIC on node
1 month ago
func (n Node) SetVFsNumber(ctx context.Context, req SetVFsNumberRequest) (bool, error) {
2 months ago
err := validators.ValidateRequest(req)
if err != nil {
1 month ago
return false, validators.ValidationErrors(validators.GetErrors(err))
2 months ago
}
url := "/cloudbroker/node/setVFsNumber"
res, err := n.client.DecortApiCall(ctx, http.MethodPost, url, req)
1 month ago
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
2 months ago
if err != nil {
1 month ago
return false, err
2 months ago
}
1 month ago
return result, nil
2 months ago
}