Files
dynamix-golang-sdk/pkg/cloudbroker/disks/migrate_v2_resolve.go
T

52 lines
1.5 KiB
Go
Raw Normal View History

2026-10-30 16:04:15 +03:00
package disks
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// MigrateV2ResolveRequest struct to resolve a disks migration
type MigrateV2ResolveRequest struct {
// Migration workflow job ID
// Required: true
WorkflowJobID string `url:"workflow_job_id" json:"workflow_job_id" validate:"required"`
// Take over cleanup
// Default: false
// Required: false
TakeOverCleanup interface{} `url:"take_over_cleanup,omitempty" json:"take_over_cleanup,omitempty" validate:"omitempty,isBool"`
}
// MigrateV2Resolve resolves a disks migration
func (d Disks) MigrateV2Resolve(ctx context.Context, req MigrateV2ResolveRequest) (*MigrateV2ResolveRecord, error) {
res, err := d.MigrateV2ResolveRaw(ctx, req)
if err != nil {
return nil, err
}
info := MigrateV2ResolveRecord{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}
// MigrateV2ResolveRaw resolves a disks migration and returns an array of bytes
func (d Disks) MigrateV2ResolveRaw(ctx context.Context, req MigrateV2ResolveRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/disks/migrate_v2_resolve"
res, err := d.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
return res, err
}