This commit is contained in:
dayterr
2026-01-23 16:36:21 +03:00
parent 25fa57f583
commit 403574496b
16 changed files with 145 additions and 61 deletions

View File

@@ -0,0 +1,42 @@
package node
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/internal/validators"
)
// AutoStartRequest struct to set node autostart
type AutoStartRequest struct {
// Node ID
// Required: true
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
// Auto start
// Required: true
AutoStart bool `url:"autostart" json:"autostart" validate:"required"`
}
// AutoStart sets node autostart
func (n Node) AutoStart(ctx context.Context, req AutoStartRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/node/autostart"
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

@@ -26,6 +26,11 @@ type MaintenanceRequest struct {
// Reason
// Required: false
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
// Allow node auto-enable
// Default: false
// Required: false
AutoStart bool `url:"autostart" json:"autostart"`
}
// Maintenance places node in maintenance state

View File

@@ -85,6 +85,12 @@ type RecordNode struct {
// CPU used by the node
UsableCPUs []string `json:"usable_cpus"`
// AutoStart
AutoStart bool `json:"autostart"`
// AutoStart Count
AutoStartCount uint64 `json:"autostart_count"`
}
// Resource consumption of the node
@@ -301,6 +307,12 @@ type ItemNode struct {
// CPU used by the node
UsableCPUs []string `json:"usable_cpus"`
// AutoStart
AutoStart bool `json:"autostart"`
// AutoStart Count
AutoStartCount uint64 `json:"autostart_count"`
}
type PackageInfo struct {