Files
dynamix-golang-sdk/pkg/cloudbroker/disks/migrate_v2_cleanup.go
T
2026-10-30 16:04:15 +03:00

42 lines
1.1 KiB
Go

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"
)
// MigrateV2CleanupRequest struct to clean up source disks after a disks migration
type MigrateV2CleanupRequest struct {
// Migration workflow job ID
// Required: true
WorkflowJobID string `url:"workflow_job_id" json:"workflow_job_id" validate:"required"`
}
// MigrateV2Cleanup cleans up source disks after a disks migration and returns cleanup job ID
func (d Disks) MigrateV2Cleanup(ctx context.Context, req MigrateV2CleanupRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/disks/migrate_v2_cleanup"
res, err := d.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
}