This commit is contained in:
dayterr
2026-03-06 16:31:33 +03:00
parent c2c810504d
commit c701001bb6
15 changed files with 93 additions and 55 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) (ListCloneAbort, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/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))
var result ListCloneAbort
err = json.Unmarshal(res, &result)
if err != nil {
return false, err
return nil, err
}
return result, nil

View File

@@ -843,6 +843,9 @@ type ItemComputeDisk struct {
// Image ID
ImageID uint64 `json:"imageId"`
// Independent
Independent bool `json:"independent"`
// List image IDs
Images []uint64 `json:"images"`
@@ -1382,6 +1385,21 @@ type RecordCloneStatus struct {
Status CloneStatus `json:"status"`
}
// Information about aborted clone disk
type RecordCloneAbort struct {
// Disk ID
DiskID uint64 `json:"disk_id"`
// Aborted
Aborted bool `json:"aborted"`
// Blockcopy abort job ID
BlockcopyAbortJobID string `json:"blockcopy_abort_job_id"`
}
// List of aborted clone disks
type ListCloneAbort []RecordCloneAbort
type CloneStatus struct {
// Type
Type int `json:"type"`

View File

@@ -39,9 +39,8 @@ type NetAttachRequest struct {
// Required: false
MACAddr string `url:"mac_addr,omitempty" json:"mac_addr,omitempty"`
// Used only for EXTNET and DPDK
// For DPDK must be 1-9216
// For EXTNET must be 1500-9216
// Used for EXTNET, TRUNK and DPDK
// Must be 1500-9216
// Required: false
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`