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

@@ -38,10 +38,6 @@ type GroupAddRequest struct {
// Required: true
ImageID uint64 `url:"imageId" json:"imageId" validate:"required"`
// Compute driver like a KVM_X86, etc.
// Required: true
Driver string `url:"driver" json:"driver" validate:"required"`
// Storage endpoint provider ID
// Required: false
SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`

View File

@@ -34,10 +34,6 @@ type ListRequest struct {
// Required: false
AccountId uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
// Find by resource group ID
// Required: false
RGID uint64 `url:"rgId,omitempty" json:"rgId,omitempty"`
// Find by id
// Required: false
ByID uint64 `url:"by_id,omitempty" json:"by_id,omitempty"`

View File

@@ -11,7 +11,7 @@ type RecordFLIPGroupCreated struct {
// IP
IP string `json:"ip"`
// Name
// Name
Name string `json:"name"`
// Network mask
@@ -85,12 +85,6 @@ type RecordFLIPGroup struct {
// Network
Network string `json:"network"`
// Resource group ID
RGID uint64 `json:"rgId"`
// Resource group name
RGName string `json:"rgName"`
// Status
Status string `json:"status"`

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 {

View File

@@ -20,8 +20,8 @@ type DelConsumerNodesRequest struct {
// The force flag must be set to true only if the node will never come back online
// Default: false
// Required: true
Force bool `url:"force" json:"force" validate:"required"`
// Required: false
Force bool `url:"force" json:"force"`
}
// DelConsumerNodes excludes consumer nodes from SEP parameters

View File

@@ -10,6 +10,9 @@ type ListZones struct {
// Detailed information about the zone record
type RecordZone struct {
// If true, all nodes belonging to the given zone will be marked for autostart
AutoStart bool `json:"autostart"`
// ID
ID uint64 `json:"id"`

View File

@@ -0,0 +1,43 @@
package zone
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/internal/validators"
)
// NodeAutoStartRequest struct to set node autostart in zone
type NodeAutoStartRequest struct {
// ID of zone
// Required: true
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
// AutoStart nodes in zone
// Required: true
AutoStart bool `url:"autostart" json:"autostart" validate:"required"`
}
// NodeAutoStart sets node autostart in zone
func (e Zone) NodeAutoStart(ctx context.Context, req NodeAutoStartRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/zone/node_autostart"
res, err := e.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

@@ -21,6 +21,10 @@ type UpdateRequest struct {
// Description
// Required: false
Description string `url:"description,omitempty" json:"description,omitempty"`
// If true, all nodes belonging to the given zone will be marked for autostart
// Required: false
AutoStart interface{} `url:"autostart,omitempty" json:"autostart,omitempty" validate:"omitempty,isBool"`
}
// Update updates zone object