Files
decort-golang-sdk/pkg/cloudbroker/compute/migrate_v2_cleanup.go
2026-09-25 16:32:09 +03:00

42 lines
1.1 KiB
Go

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"
)
// MigrateV2CleanupRequest to clean up after a migration of a compute
type MigrateV2CleanupRequest struct {
// Original migration workflow IDs, not agent, cleanup or recovery job IDs
// Required: true
WorkflowJobID string `url:"workflow_job_id" json:"workflow_job_id" validate:"required"`
}
// MigrateV2Cleanup cleans up after a migration of a compute
func (c Compute) MigrateV2Cleanup(ctx context.Context, req MigrateV2CleanupRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/migrate_v2_cleanup"
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return "", err
}
var resp string
err = json.Unmarshal(res, &resp)
if err != nil {
return "", err
}
return resp, nil
}