47 lines
1.2 KiB
Go
47 lines
1.2 KiB
Go
package disks
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
|
)
|
|
|
|
// MigrateV2GetRequest struct to get information about a disks migration
|
|
type MigrateV2GetRequest struct {
|
|
// Migration workflow job ID
|
|
// Required: true
|
|
WorkflowJobID string `url:"workflow_job_id" json:"workflow_job_id" validate:"required"`
|
|
}
|
|
|
|
// MigrateV2Get gets information about a disks migration as a MigrateV2Record struct
|
|
func (d Disks) MigrateV2Get(ctx context.Context, req MigrateV2GetRequest) (*MigrateV2Record, error) {
|
|
res, err := d.MigrateV2GetRaw(ctx, req)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
info := MigrateV2Record{}
|
|
|
|
err = json.Unmarshal(res, &info)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &info, nil
|
|
}
|
|
|
|
// MigrateV2GetRaw gets information about a disks migration as an array of bytes
|
|
func (d Disks) MigrateV2GetRaw(ctx context.Context, req MigrateV2GetRequest) ([]byte, error) {
|
|
err := validators.ValidateRequest(req)
|
|
if err != nil {
|
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
|
}
|
|
|
|
url := "/cloudbroker/disks/migrate_v2_get"
|
|
|
|
res, err := d.client.DecortApiCall(ctx, http.MethodGet, url, req)
|
|
return res, err
|
|
}
|