Files
2026-10-30 16:04:15 +03:00

96 lines
3.1 KiB
Go

package compute
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// MigrateV2ListRequest to list migrations
type MigrateV2ListRequest struct {
// Exact APIServer migration workflow job ID
// Required: false
WorkflowJobID string `url:"workflow_job_id,omitempty" json:"workflow_job_id,omitempty"`
// Compute ID
// Required: false
ComputeID uint64 `url:"compute_id,omitempty" json:"compute_id,omitempty"`
// Exact business migration status
// Required: false
Status string `url:"status,omitempty" json:"status,omitempty"`
// Source node ID
// Required: false
SourceNodeID uint64 `url:"source_node_id,omitempty" json:"source_node_id,omitempty"`
// Target node ID
// Required: false
TargetNodeID uint64 `url:"target_node_id,omitempty" json:"target_node_id,omitempty"`
// Whether retained source disks still require cleanup
// Required: false
CleanupRequired interface{} `url:"cleanup_required,omitempty" json:"cleanup_required,omitempty" validate:"omitempty,isBool"`
// Account ID at migration start
// Required: false
AccountID uint64 `url:"account_id,omitempty" json:"account_id,omitempty"`
// Resource group ID at migration start
// Required: false
RGID uint64 `url:"rg_id,omitempty" json:"rg_id,omitempty"`
// Initiating username; case-sensitive
// Required: false
User string `url:"user,omitempty" json:"user,omitempty"`
// Match the username exactly or by literal prefix
// Required: false
UserMatch string `url:"user_match,omitempty" json:"user_match,omitempty" validate:"omitempty,userMatch"`
// True selects migrations without a user; false selects those with a user. Cannot be combined with user
// Required: false
UserIsNull interface{} `url:"user_is_null,omitempty" json:"user_is_null,omitempty" validate:"omitempty,isBool"`
// True selects migrations without a source node; false selects those with one. Cannot be combined with source_node_id
// Required: false
SourceNodeIDIsNull interface{} `url:"source_node_id_is_null,omitempty" json:"source_node_id_is_null,omitempty" validate:"omitempty,isBool"`
// True selects migrations without a target node; false selects those with one. Cannot be combined with target_node_id
// Required: false
TargetNodeIDIsNull interface{} `url:"target_node_id_is_null,omitempty" json:"target_node_id_is_null,omitempty" validate:"omitempty,isBool"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
// Page size
// Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// MigrateV2List gets list of the jobs
func (c Compute) MigrateV2List(ctx context.Context, req MigrateV2ListRequest) (*ListMigrateV2, error) {
if err := validators.ValidateRequest(req); err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/migrate_v2_list"
res, err := c.client.DecortApiCall(ctx, http.MethodGet, url, req)
if err != nil {
return nil, err
}
list := ListMigrateV2{}
err = json.Unmarshal(res, &list)
if err != nil {
return nil, err
}
return &list, nil
}