v15.5.0
This commit is contained in:
dayterr
2026-07-10 15:44:33 +03:00
parent 55fe76d12e
commit 0595b5ae39
15 changed files with 571 additions and 100 deletions

View File

@@ -2,8 +2,8 @@ package compute
import (
"context"
"encoding/json"
"net/http"
"strings"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
@@ -16,20 +16,35 @@ type MigrateStorageInfoRequest struct {
}
// MigrateStorageInfo gets info about last (include ongoing) storage migration
func (c Compute) MigrateStorageInfo(ctx context.Context, req MigrateStorageInfoRequest) (string, error) {
func (c Compute) MigrateStorageInfo(ctx context.Context, req MigrateStorageInfoRequest) (*RecordMigrateStorageInfo, error) {
res, err := c.MigrateStorageInfoRaw(ctx, req)
if err != nil {
return nil, err
}
info := RecordMigrateStorageInfo{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}
// MigrateStorageInfoRaw gets info about last (include ongoing) storage migration as an array of bytes
func (c Compute) MigrateStorageInfoRaw(ctx context.Context, req MigrateStorageInfoRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/migrateStorageInfo"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return "", err
return nil, err
}
result := strings.ReplaceAll(string(res), "\"", "")
return result, nil
return res, nil
}