This commit is contained in:
dayterr
2026-02-27 17:02:27 +03:00
parent b834e5d074
commit c2c810504d
34 changed files with 118 additions and 268 deletions

View File

@@ -2,8 +2,8 @@ package compute
import (
"context"
"encoding/json"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
@@ -17,22 +17,24 @@ type CloneAbortRequest struct {
}
// CloneAbort aborts a compute clone
func (c Compute) CloneAbort(ctx context.Context, req CloneAbortRequest) (bool, error) {
func (c Compute) CloneAbort(ctx context.Context, req CloneAbortRequest) ([]RecordCloneAbort, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/clone_abort"
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return false, err
return nil, err
}
result, err := strconv.ParseBool(string(res))
result := make([]RecordCloneAbort, 0)
err = json.Unmarshal(res, &result)
if err != nil {
return false, err
return nil, err
}
return result, nil

View File

@@ -31,13 +31,6 @@ type DiskAddRequest struct {
// Required: true
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
// Type of the disk
// Should be one of:
// - D
// - B
// Required: false
DiskType string `url:"diskType,omitempty" json:"diskType,omitempty" validate:"omitempty,computeDiskType"`
// Pool name
// By default will be chosen automatically
// Required: false

View File

@@ -18,10 +18,6 @@ type DiskAttachRequest struct {
// Required: true
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
// Type of the disk B;D
// Required: false
DiskType string `url:"diskType,omitempty" json:"diskType,omitempty"`
// Desired PCI slot (hex string, e.g. "0x1A")
// Required: false
PCISlot string `url:"pci_slot,omitempty" json:"pci_slot,omitempty"`

View File

@@ -891,6 +891,9 @@ type InfoCompute struct {
// VINS connected
VINSConnected uint64 `json:"vinsConnected"`
// Weight
Weight uint64 `json:"weight"`
// Zone ID
ZoneID uint64 `json:"zoneId"`
}
@@ -1178,6 +1181,9 @@ type RecordCompute struct {
// VNC password
VNCPassword string `json:"vncPasswd"`
// Weight
Weight uint64 `json:"weight"`
// Zone ID
ZoneID uint64 `json:"zoneId"`
@@ -1469,6 +1475,14 @@ type MigrateStorageItem struct {
TargetNodeID uint64 `json:"targetNodeId"`
}
type RecordCloneAbort struct {
// Disk ID
DiskID uint64 `json:"disk_id"`
// Abort status
Status bool `json:"status"`
}
type RecordCloneStatus struct {
// Disk ID
DiskID int `json:"disk_id"`

View File

@@ -69,6 +69,10 @@ type UpdateRequest struct {
// The OS version that will be installed on the virtual machine
// Required: false
OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"`
// Priority weight of the compute: higher value means higher priority and later migration
// Required: false
Weight uint64 `url:"weight,omitempty" json:"weight,omitempty"`
}
// Update updates some properties of the compute