2026-03-20 17:22:29 +03:00
|
|
|
package image
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"net/http"
|
|
|
|
|
"strconv"
|
|
|
|
|
|
|
|
|
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// MultiImageExportRequest struct to export multi image to a pool
|
|
|
|
|
type MultiImageExportRequest struct {
|
|
|
|
|
// ID of the multi image
|
|
|
|
|
// Required: true
|
|
|
|
|
MultiImageID uint64 `url:"multi_image_id" json:"multi_image_id" validate:"required"`
|
|
|
|
|
|
|
|
|
|
// Name of the target pool
|
|
|
|
|
// Required: true
|
|
|
|
|
PoolName string `url:"pool_name" json:"pool_name" validate:"required"`
|
2026-03-27 17:48:48 +03:00
|
|
|
|
|
|
|
|
// Target SEP ID
|
|
|
|
|
// Required: true
|
|
|
|
|
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
|
2026-03-20 17:22:29 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MultiImageExport copies a physical image from multi image to the specified pool
|
|
|
|
|
func (i Image) MultiImageExport(ctx context.Context, req MultiImageExportRequest) (bool, error) {
|
|
|
|
|
err := validators.ValidateRequest(req)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
url := "/cloudbroker/image/multi_image_export"
|
|
|
|
|
|
|
|
|
|
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return false, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result, err := strconv.ParseBool(string(res))
|
|
|
|
|
if err != nil {
|
|
|
|
|
return false, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result, nil
|
|
|
|
|
}
|