This commit is contained in:
arsvolkov committed 2026-08-21 19:04:19 +04:00
1 parent f34fa6055c
commit 3c5157281e
1285 files changed
+4016 -3302

No files matched your search

+38 -3
View File
@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// Migrate struct to move disk to another sep, pool and storage policy
@@ -26,16 +26,51 @@ type MigrateRequest struct {
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
}
// Move moves disk to another sep, pool and storage policy
type wrapperMigrateRequest struct {
MigrateRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// Move moves disk to another sep, pool and storage policy in sync mode
func (c Disks) Migrate(ctx context.Context, req MigrateRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
wrappedReq := wrapperMigrateRequest{
MigrateRequest: req,
AsyncMode: false,
}
url := "/cloudbroker/disks/migrate"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return "", err
}
result := string(res)
return result, nil
}
// Move moves disk to another sep, pool and storage policy in async mode
func (c Disks) MigrateAsync(ctx context.Context, req MigrateRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
wrappedReq := wrapperMigrateRequest{
MigrateRequest: req,
AsyncMode: true,
}
url := "/cloudbroker/disks/migrate"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return "", err
}