This commit is contained in:
asteam
2025-09-26 19:17:30 +03:00
parent 48e2b0f2f9
commit 1ccc37a104
1022 changed files with 6440 additions and 1688 deletions

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// ApplyIpmiActionRequest struct to apply ipmi action on node

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// ConsumptionRequest struct to get node summary by resources and consumption

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// DecommissionRequest struct to set node status to DECOMMISSIONED

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// EnableRequest struct to enable node from maintenance status to enabled

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// EnableNodesRequest struct to enable nodes from maintenance status to enabled
@@ -13,9 +13,9 @@ type EnableNodesRequest struct {
// Required: true
NIDs []uint64 `url:"nids" json:"nids" validate:"required"`
// Message
// Reason
// Required: false
Message string `url:"message,omitempty" json:"message,omitempty"`
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
}
// EnableNodes enables nodes from maintenance status to enabled

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// GetRequest struct to get detailed information about node

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// ListRequest struct to get list of nodes

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// MaintenanceRequest struct to place node in maintenance state
@@ -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

@@ -371,7 +371,7 @@ type Bridges struct {
// Backplane1
type Backplane1 struct {
Interfaces []string `json:"interfaces"`
NumaNode uint64 `json:"numa_node"`
NumaNode int64 `json:"numa_node"`
}
// Role

View File

@@ -2,7 +2,7 @@
package node
import (
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/interfaces"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/interfaces"
)
// Structure for creating request to node

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// RestrictRequest struct to set node status to 'RESTRICTED'

View File

@@ -3,7 +3,7 @@ package node
import (
"encoding/json"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/serialization"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/serialization"
)
// Serialize returns JSON-serialized []byte. Used as a wrapper over json.Marshal and json.MarshalIndent functions.

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// SetCoreIsolationRequest struct to isolate selected cores on node boot

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// SetHugePagesRequest struct to set on-boot Huge Pages configuration

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// SetSRIOVStatusRequest struct to set Single-root input/output virtualization kernel config on node

View File

@@ -3,8 +3,9 @@ package node
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// SetVFsNumberRequest struct to set number of VFs for individual NIC on node
@@ -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/dynamix-golang-sdk/v11/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
}

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// UpdateRequest struct to update node for actual version