This commit is contained in:
2026-09-25 16:32:09 +03:00
parent bf932e5ef9
commit 69f056616f
33 changed files with 2074 additions and 594 deletions

View File

@@ -0,0 +1,51 @@
package compute
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// MigrateResolveRequest to resolve a migration
type MigrateV2ResolveRequest struct {
// Workflow job ID
// Required: true
WorkflowJobID string `url:"workflow_job_id" json:"workflow_job_id" validate:"required"`
// Take over cleanup
// Required: false
TakeOverCleanup interface{} `url:"take_over_cleanup,omitempty" json:"take_over_cleanup,omitempty" validate:"omitempty,isBool"`
}
// MigrateV2Resolve resolves a migration of a compute
func (c Compute) MigrateV2Resolve(ctx context.Context, req MigrateV2ResolveRequest) (*MigrateV2ResolveRecord, error) {
res, err := c.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 migration of a compute and returns an array of bytes
func (c Compute) MigrateV2ResolveRaw(ctx context.Context, req MigrateV2ResolveRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/migrate_v2_resolve"
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
return res, err
}