v14.4.0
v14.4.0
This commit is contained in:
42
pkg/cloudbroker/image/multi_image_export.go
Normal file
42
pkg/cloudbroker/image/multi_image_export.go
Normal file
@@ -0,0 +1,42 @@
|
||||
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"`
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
Reference in New Issue
Block a user