package compute import ( "context" "net/http" "strconv" "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) // DiskMigrateRequest struct to migrate compute's disk to target disk type DiskMigrateRequest struct { // ID of compute instance // Required: true ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` // ID source disk // Required: true DiskID uint64 `url:"diskId" json:"diskId" validate:"required"` // ID target disk // Required: true TargetDiskID uint64 `url:"targetDiskId" json:"targetDiskId" validate:"required"` // Migration mode. 1 - Data migration and domain update were already completed by third-party software. // Use this if target disk already connected to compute and you only need to save changes for next reboot. // Required: false Mode int64 `url:"mode,omitempty" json:"mode,omitempty"` } // DiskMigrate - migrate compute's disk to target disk. Source disk will be detached, target disk will be attached to the same PCI slot. // (WARNING) Current realisation is limited. No actual data migration will be performed. // Use this API if target disk already connected to compute and you only need to save changes for next reboot (mode: 1). func (c Compute) DiskMigrate(ctx context.Context, req DiskMigrateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/diskMigrate" res, err := c.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 }