This commit is contained in:
asteam
2025-12-08 16:30:08 +03:00
parent 06992b8949
commit 3eaf0df772
1225 changed files with 1690 additions and 2333 deletions

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/internal/validators"
)
// AddSSHIdentityRequest struct to add node ssh information

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/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/v12/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/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/v12/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/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/v12/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/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/v12/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/internal/validators"
)
// EnableNodesRequest struct to enable nodes from maintenance status to enabled

View File

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

View File

@@ -0,0 +1,38 @@
package node
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/internal/validators"
)
// GetLogicalCoresCountRequest struct to get logical cores count by node
type GetLogicalCoresCountRequest struct {
// Node ID
// Required: true
NodeId uint64 `url:"node_id" json:"node_id" validate:"required"`
}
// GetLogicalCoresCount get logical cores count by node
func (i Node) GetLogicalCoresCount(ctx context.Context, req GetLogicalCoresCountRequest) (uint64, error) {
err := validators.ValidateRequest(req)
if err != nil {
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/node/get_logical_cores_count"
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return 0, err
}
result, err := strconv.ParseUint(string(res), 10, 64)
if err != nil {
return 0, err
}
return result, nil
}

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/internal/validators"
)
// GetSSHIdentityRequest struct to get node ssh information

View File

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

View File

@@ -53,9 +53,6 @@ type RecordNode struct {
// SriovEnabled
SriovEnabled bool `json:"sriovEnabled"`
// StackID
StackID uint64 `json:"stackId"`
// Status
Status string `json:"status"`
@@ -76,6 +73,15 @@ type RecordNode struct {
// Zone ID
ZoneID uint64 `json:"zoneId"`
// OpenvSwitch Bridges
OpenvSwitchBridges []string `json:"openvswitch_bridges"`
// Description
Description string `json:"description"`
// SDN Hypervisor Name
SDNHypervisorName string `json:"sdn_hypervisor_name"`
}
// Resource consumption of the node
@@ -102,7 +108,7 @@ type FreeResourcesInfo struct {
RAM float64 `json:"RAM"`
// VCPU
VCPU uint64 `json:"vCPU"`
VCPU uint64 `json:"vCPUs"`
}
// Resources Info
@@ -136,6 +142,12 @@ type CpuInfo struct {
// PhysCount
PhysCount uint64 `json:"physCount"`
// Flags
Flags []string `json:"flags"`
// Mddel name
ModelName string `json:"model_name"`
}
// Main information about node
@@ -245,9 +257,6 @@ type ItemNode struct {
// SriovEnabled
SriovEnabled bool `json:"sriovEnabled"`
// StackID
StackID uint64 `json:"stackId"`
// Status
Status string `json:"status"`
@@ -265,6 +274,34 @@ type ItemNode struct {
// Zone ID
ZoneID uint64 `json:"zoneId"`
// OpenvSwitch Bridges
OpenvSwitchBridges []string `json:"openvswitch_bridges"`
// APIUrl
APIUrl string `json:"apiUrl"`
// Drivers
Drivers []string `json:"drivers"`
// Old Compat LVM ID
OldCompatLVMID uint64 `json:"old_compat_lvm_id"`
// CPU Allocation ratio
CPUAllocationRatio float64 `json:"cpu_allocation_ratio"`
// MemAllocationRatio
MemAllocationRatio float64 `json:"mem_allocation_ratio"`
// Packages
Packages map[string]PackageInfo `json:"packages"`
}
type PackageInfo struct {
// Installed size
InstalledSize string `json:"installed_size"`
// Version
Ver string `json:"ver"`
}
// Numa Topology Info

View File

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

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/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/v12/internal/serialization"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/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/v12/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/internal/validators"
)
// SetCoreIsolationRequest struct to isolate selected cores on node boot

View File

@@ -0,0 +1,36 @@
package node
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/internal/validators"
)
// SetCpuAllocationRatioRequest struct to set CPU allocation ratio
type SetCpuAllocationRatioRequest struct {
// Node ID
// Required: true
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
// Allocation ratio (zero or positive value)
// Required: true
Ratio float64 `url:"ratio" json:"ratio" validate:"required"`
}
// SetCpuAllocationRatio set CPU allocation ratio
func (i Node) SetCpuAllocationRatio(ctx context.Context, req SetCpuAllocationRatioRequest) error {
err := validators.ValidateRequest(req)
if err != nil {
return validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/node/set_cpu_allocation_ratio"
_, err = i.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return err
}
return nil
}

View File

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

View File

@@ -0,0 +1,36 @@
package node
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/internal/validators"
)
// SetMemAllocationRatioRequest struct to set memory allocation ratio
type SetMemAllocationRatioRequest struct {
// Node ID
// Required: true
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
// Allocation ratio (zero or positive value)
// Required: true
Ratio float64 `url:"ratio" json:"ratio" validate:"required"`
}
// SetMemAllocationRatio set memory allocation ratio
func (i Node) SetMemAllocationRatio(ctx context.Context, req SetMemAllocationRatioRequest) error {
err := validators.ValidateRequest(req)
if err != nil {
return validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/node/set_mem_allocation_ratio"
_, err = i.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return err
}
return nil
}

View File

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

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/internal/validators"
)
// SetVFsNumberRequest struct to set number of VFs for individual NIC on node

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/internal/validators"
)
type VFParam struct {

View File

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

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/internal/validators"
)
// UpdateDescriptionRequest struct to update description of the node