v16.7.0
This commit is contained in:
dayterr committed 2026-10-09 16:28:36 +03:00
1 parent 025a1274f4
commit 70edc100d5
83 files changed
+2240 -554

No files matched your search

+42 -5
View File
@@ -3,6 +3,7 @@ package compute
import (
"context"
"net/http"
"strconv"
"strings"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
@@ -25,17 +26,48 @@ type MigrateStorageRequest struct {
// Target node ID
// Required: true
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
}
// Async API call
// Required: true
Async interface{} `url:"async_mode" json:"async_mode" validate:"required,isBool"`
type wrapperMigrateStorageRequest struct {
MigrateStorageRequest
AsyncMode bool `url:"async_mode,omitempty"`
}
// MigrateStorage gets complex compute migration
// Compute will be migrated to specified node, and compute disks will
// be migrated to specified SEP to specified pool.
// This action can take up to 84 hours
func (c Compute) MigrateStorage(ctx context.Context, req MigrateStorageRequest) (string, error) {
func (c Compute) MigrateStorage(ctx context.Context, req MigrateStorageRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/migrateStorage"
aReq := wrapperMigrateStorageRequest{
MigrateStorageRequest: req,
AsyncMode: false,
}
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
// MigrateStorageAsync gets complex compute migration in async mode
// Compute will be migrated to specified node, and compute disks will
// be migrated to specified SEP to specified pool.
// This action can take up to 84 hours
func (c Compute) MigrateStorageAsync(ctx context.Context, req MigrateStorageRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
@@ -43,7 +75,12 @@ func (c Compute) MigrateStorage(ctx context.Context, req MigrateStorageRequest)
url := "/cloudbroker/compute/migrateStorage"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
aReq := wrapperMigrateStorageRequest{
MigrateStorageRequest: req,
AsyncMode: true,
}
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
if err != nil {
return "", err
}