This commit is contained in:
dayterr
2025-09-11 15:56:44 +03:00
parent 825b1a0a00
commit abd35f858c
87 changed files with 930 additions and 571 deletions

View File

@@ -58,7 +58,6 @@ var computes = ListComputes{
GID: 212,
GUID: 48500,
ID: 48500,
ImageID: 9884,
Interfaces: ListInterfaces{},
LockStatus: "UNLOCKED",
ManagerID: 0,
@@ -85,7 +84,6 @@ var computes = ListComputes{
UserManaged: true,
VGPUs: []uint64{},
VINSConnected: 0,
VirtualImageID: 0,
},
},
{
@@ -122,7 +120,6 @@ var computes = ListComputes{
GID: 212,
GUID: 48556,
ID: 48556,
ImageID: 9884,
Interfaces: ListInterfaces{},
LockStatus: "UNLOCKED",
ManagerID: 0,
@@ -149,7 +146,6 @@ var computes = ListComputes{
UserManaged: true,
VGPUs: []uint64{},
VINSConnected: 0,
VirtualImageID: 0,
},
},
},
@@ -301,7 +297,6 @@ var deleteComputes = ListDeletedComputes{
GID: 212,
GUID: 48500,
ID: 48500,
ImageID: 9884,
Interfaces: ListInterfaces{},
LockStatus: "UNLOCKED",
ManagerID: 0,
@@ -327,7 +322,6 @@ var deleteComputes = ListDeletedComputes{
UserManaged: true,
VGPUs: []uint64{},
VINSConnected: 0,
VirtualImageID: 0,
},
},
{
@@ -364,7 +358,6 @@ var deleteComputes = ListDeletedComputes{
GID: 212,
GUID: 48556,
ID: 48556,
ImageID: 9884,
Interfaces: ListInterfaces{},
LockStatus: "UNLOCKED",
ManagerID: 0,
@@ -390,7 +383,6 @@ var deleteComputes = ListDeletedComputes{
UserManaged: true,
VGPUs: []uint64{},
VINSConnected: 0,
VirtualImageID: 0,
},
},
},

View File

@@ -46,10 +46,6 @@ type ListRequest struct {
// Required: false
StackID uint64 `url:"stackId,omitempty" json:"stackId,omitempty"`
// Find by image ID
// Required: false
ImageID uint64 `url:"imageId,omitempty" json:"imageId,omitempty"`
// Find by CD image ID
// Required: false
CDImageID uint64 `url:"cdImageId,omitempty" json:"cdImageId,omitempty"`

View File

@@ -0,0 +1,55 @@
package compute
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/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:"sortBy,omitempty" json:"sortBy,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
}

View File

@@ -720,9 +720,6 @@ type InfoCompute struct {
// ID
ID uint64 `json:"id"`
// Image ID
ImageID uint64 `json:"imageId"`
// List interfaces
Interfaces ListInterfaces `json:"interfaces"`
@@ -765,6 +762,9 @@ type InfoCompute struct {
// List OS users
OSUsers ListOSUsers `json:"osUsers"`
// Name of OS
OSVersion string `json:"os_version"`
// Pinned to stack
PinnedToStack int64 `json:"pinnedToStack"`
@@ -840,9 +840,6 @@ type InfoCompute struct {
// VINS connected
VINSConnected uint64 `json:"vinsConnected"`
// Virtual image ID
VirtualImageID uint64 `json:"virtualImageId"`
// Zone ID
ZoneID uint64 `json:"zoneId"`
}
@@ -1046,6 +1043,9 @@ type RecordCompute struct {
// List OS users
OSUsers ListOSUsers `json:"osUsers"`
// Name of OS
OSVersion string `json:"os_version"`
// Pinned to stack
PinnedToStack int64 `json:"pinnedToStack"`
@@ -1118,12 +1118,6 @@ type RecordCompute struct {
// List VGPU
VGPUs []VGPUItem `json:"vgpus"`
// Virtual image ID
VirtualImageID uint64 `json:"virtualImageId"`
// VirtualImageName
VirtualImageName string `json:"virtualImageName"`
// VNC password
VNCPassword string `json:"vncPasswd"`
@@ -1375,3 +1369,31 @@ type ItemVGPU struct {
// VM ID
VMID uint64 `json:"vmid"`
}
type ListMigrateStorage struct {
EntryCount uint64 `json:"entryCount"`
Data []MigrateStorageItem `json:"data"`
}
type MigrateStorageItem struct {
// Migration completion status
Completed bool `json:"completed"`
// Domain name
DomainName string `json:"domainName"`
// Migration job ID
ID uint64 `json:"id"`
// Migration process log
Log []string `json:"log"`
// Source stack ID
SourceStackID uint64 `json:"sourceStackId"`
// Migration status
Status string `json:"status"`
// Target stack ID
TargetStackID uint64 `json:"targetStackId"`
}

View File

@@ -18,6 +18,10 @@ type RedeployRequest struct {
// Required: false
ImageID uint64 `url:"imageId,omitempty" json:"imageId,omitempty"`
// The OS version that will be installed on the virtual machine
// Required: false
OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"`
// Storage policy id of compute. The rules of the specified storage policy will be used.
// Required: true
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`

View File

@@ -0,0 +1,36 @@
package compute
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// StartMigrationINRequest struct to start compute for external migration in
type StartMigrationINRequest struct {
// ID of compute instance
// Required: true
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
// ID of the stack where the compute will be staged for migration-in
// Required: false
StackID uint64 `url:"stackId,omitempty" json:"stackId,omitempty"`
}
// StartMigrationIN starts compute for external migration in
func (c Compute) StartMigrationIN(ctx context.Context, req StartRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/start_migration_in"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return "", err
}
return string(res), nil
}

View File

@@ -0,0 +1,36 @@
package compute
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// StopMigrationINRequest struct to stop compute for external migration in
type StopMigrationINRequest struct {
// ID of compute instance
// Required: true
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
// If provided, indicates the UUID of the VM on the target host and that migration completed.
// Required: false
NewVMUUID string `url:"new_vm_uuid,omitempty" json:"new_vm_uuid,omitempty"`
}
// StopMigrationIN stops compute for external migration in
func (c Compute) StopMigrationIN(ctx context.Context, req StartRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/stop_migration_in"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return "", err
}
return string(res), nil
}

View File

@@ -65,6 +65,10 @@ type UpdateRequest struct {
// Does this machine supports hot resize, true or false
// Required: false
HotResize interface{} `url:"hotResize,omitempty" json:"hotResize,omitempty" validate:"omitempty,isBool"`
// The OS version that will be installed on the virtual machine
// Required: false
OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"`
}
// Update updates some properties of the compute