v1.12.5
This commit is contained in:
46
pkg/cloudbroker/disks/migrate.go
Normal file
46
pkg/cloudbroker/disks/migrate.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package disks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Migrate struct to move disk to another sep, pool and storage policy
|
||||
type MigrateRequest struct {
|
||||
// ID of the disk
|
||||
// Required: true
|
||||
DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"`
|
||||
|
||||
// ID of the new SEP
|
||||
// Required: true
|
||||
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
|
||||
|
||||
// New pool name
|
||||
// Required: true
|
||||
PoolName string `url:"pool_name" json:"pool_name" validate:"required"`
|
||||
|
||||
// ID if the storage policy
|
||||
// Required: false
|
||||
StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"`
|
||||
}
|
||||
|
||||
// Move moves disk to another sep, pool and storage policy
|
||||
func (c Disks) Migrate(ctx context.Context, req MigrateRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/disks/migrate"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
result := string(res)
|
||||
|
||||
return result, nil
|
||||
}
|
||||
Reference in New Issue
Block a user