You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.4 KiB
56 lines
1.4 KiB
package compute
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
|
|
)
|
|
|
|
// MigrateStorageListRequest struct to get list of jobs
|
|
type MigrateStorageListRequest struct {
|
|
// Find by job ID
|
|
// Required: false
|
|
MigrationJobID uint64 `url:"migration_job_id,omitempty" json:"migration_job_id,omitempty"`
|
|
|
|
// If True then return completed jobs
|
|
// Required: false
|
|
Completed interface{} `url:"completed,omitempty" json:"completed,omitempty" validate:"omitempty,isBool"`
|
|
|
|
// Sort by one of supported fields, format +|-(field)
|
|
// Required: false
|
|
SortBy string `url:"sort_by,omitempty" json:"sort_by,omitempty" validate:"omitempty,sortBy"`
|
|
|
|
// Page number
|
|
// Required: false
|
|
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
|
|
|
// Page size
|
|
// Required: false
|
|
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
|
}
|
|
|
|
// MigrateStorageList gets list of the jobs.
|
|
func (c Compute) MigrateStorageList(ctx context.Context, req MigrateStorageListRequest) (*ListMigrateStorage, error) {
|
|
if err := validators.ValidateRequest(req); err != nil {
|
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
|
}
|
|
|
|
url := "/cloudbroker/compute/migrate_storage_list"
|
|
|
|
res, err := c.client.DecortApiCall(ctx, http.MethodGet, url, req)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
list := ListMigrateStorage{}
|
|
|
|
err = json.Unmarshal(res, &list)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &list, nil
|
|
}
|