v12.0.0
This commit is contained in:
55
pkg/cloudbroker/compute/migrate_storage_list.go
Normal file
55
pkg/cloudbroker/compute/migrate_storage_list.go
Normal file
@@ -0,0 +1,55 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user