This commit is contained in:
2024-05-31 13:35:39 +03:00
parent e7c968797b
commit 3393934456
65 changed files with 905 additions and 393 deletions

View File

@@ -23,7 +23,7 @@ type CreateTemplateRequest struct {
type wrapperCreateTemplateRequest struct {
CreateTemplateRequest
Async bool `url:"async"`
AsyncMode bool `url:"asyncMode"`
}
// CreateTemplate create template from compute instance
@@ -35,7 +35,7 @@ func (c Compute) CreateTemplate(ctx context.Context, req CreateTemplateRequest)
reqWrapped := wrapperCreateTemplateRequest{
CreateTemplateRequest: req,
Async: false,
AsyncMode: false,
}
url := "/cloudapi/compute/createTemplate"
@@ -62,7 +62,7 @@ func (c Compute) CreateTemplateAsync(ctx context.Context, req CreateTemplateRequ
reqWrapped := wrapperCreateTemplateRequest{
CreateTemplateRequest: req,
Async: true,
AsyncMode: true,
}
url := "/cloudapi/compute/createTemplate"

View File

@@ -431,6 +431,9 @@ type RecordCompute struct {
// Resource name
ResName string `json:"resName"`
// Reserved Node Cpus
ReservedNodeCpus []uint64 `json:"reservedNodeCpus"`
// Resource group ID
RGID uint64 `json:"rgId"`
@@ -673,7 +676,7 @@ type ItemComputeDisk struct {
RealityDeviceNumber uint64 `json:"realityDeviceNumber"`
// Replication
Replication interface{} `json:"replication"`
Replication ItemReplication `json:"replication"`
// Resource ID
ResID string `json:"resId"`
@@ -709,6 +712,26 @@ type ItemComputeDisk struct {
VMID uint64 `json:"vmid"`
}
type ItemReplication struct {
// DiskID
DiskID uint64 `json:"diskId"`
// PoolID
PoolID string `json:"poolId"`
// Role
Role string `json:"role"`
// SelfVolumeID
SelfVolumeID string `json:"selfVolumeId"`
// StorageID
StorageID string `json:"storageId"`
// VolumeID
VolumeID string `json:"volumeId"`
}
// Main information about snapshot extend
type SnapshotExtend struct {
// GUID
@@ -915,6 +938,9 @@ type ItemCompute struct {
// Resource name
ResName string `json:"resName"`
// Reserved Node Cpus
ReservedNodeCpus []uint64 `json:"reservedNodeCpus"`
// Resource group ID
RGID uint64 `json:"rgId"`
@@ -1085,6 +1111,7 @@ type ItemPCIDevice struct {
type ListPCIDevices struct {
// Data
Data []ItemPCIDevice `json:"data"`
// Entry count
EntryCount uint64 `json:"entryCount"`
}

View File

@@ -16,9 +16,10 @@ type NetAttachRequest struct {
// Network type
// 'EXTNET' for connect to external network directly
// and 'VINS' for connect to ViNS
// 'VINS' for connect to ViNS
// 'VFNIC' for connect to vfpool
// Required: true
NetType string `url:"netType" json:"netType" validate:"computeNetType"`
NetType string `url:"netType" json:"netType" validate:"computex86NetType"`
// Network ID for connect to
// For EXTNET - external network ID

View File

@@ -21,6 +21,24 @@ type UpdateRequest struct {
// New description
// Required: false
Description string `url:"desc,omitempty" json:"desc,omitempty"`
// Rule for VM placement with NUMA affinity.
// Possible values - none (placement without NUMA affinity),
// strict (strictly with NUMA affinity, if not possible - do not start VM),
// loose (use NUMA affinity if possible)
// Required: false
// Default: none
NumaAffinity string `url:"numaAffinity,omitempty" json:"numaAffinity,omitempty" validate:"omitempty,numaAffinity"`
// Run VM on dedicated CPUs. To use this feature, the system must be pre-configured by allocating CPUs on the physical node
// Required: false
// Default: false
CPUPin bool `url:"cpupin" json:"cpupin"`
// Use Huge Pages to allocate RAM of the virtual machine. The system must be pre-configured by allocating Huge Pages on the physical node
// Required: false
// Default: false
HPBacked bool `url:"hpBacked" json:"hpBacked"`
}
// Update updates some properties of the compute

View File

@@ -57,7 +57,7 @@ type FromPlatformDiskRequest struct {
// List of types of compute suitable for image
// Example: [ "KVM_X86" ]
// Required: false
Drivers []string `url:"drivers" json:"drivers" validate:"min=1,max=2,imageDrivers"`
Drivers []string `url:"drivers,omitempty" json:"drivers,omitempty"`
// Does this machine supports hot resize
// Required: false

View File

@@ -32,7 +32,7 @@ type ListRequest struct {
// Find by shared, true or false
// Required: false
Shared bool `url:"shared,omitempty" json:"shared,omitempty"`
Shared interface{} `url:"shared,omitempty" json:"shared,omitempty" validate:"omitempty,isBool"`
// ID of the account the disks belong to
// Required: false

View File

@@ -28,7 +28,7 @@ type ListDeletedRequest struct {
// Find by shared, true or false
// Required: false
Shared bool `url:"shared,omitempty" json:"shared,omitempty"`
Shared interface{} `url:"shared,omitempty" json:"shared,omitempty" validate:"omitempty,isBool"`
// ID of the account the disks belong to
// Required: false

View File

@@ -75,7 +75,7 @@ type ItemDisk struct {
PurgeTime uint64 `json:"purgeTime"`
// Replication
Replication interface{} `json:"replication"`
Replication ItemReplication `json:"replication"`
// Resource ID
ResID string `json:"resId"`
@@ -265,8 +265,10 @@ type ListDisks struct {
// List of unattached disks
type ListDisksUnattached struct {
// Data
Data []ItemDiskUnattached `json:"data"`
// Entry count
EntryCount uint64 `json:"entryCount"`
}
@@ -407,7 +409,7 @@ type RecordDisk struct {
PurgeTime uint64 `json:"purgeTime"`
// Replication
Replication interface{} `json:"replication"`
Replication ItemReplication `json:"replication"`
// Resource ID
ResID string `json:"resId"`
@@ -449,6 +451,26 @@ type RecordDisk struct {
VMID uint64 `json:"vmid"`
}
type ItemReplication struct {
// DiskID
DiskID uint64 `json:"diskId"`
// PoolID
PoolID string `json:"poolId"`
// Role
Role string `json:"role"`
// SelfVolumeID
SelfVolumeID string `json:"selfVolumeId"`
// StorageID
StorageID string `json:"storageId"`
// VolumeID
VolumeID string `json:"volumeId"`
}
type ListTypes struct {
// Data
Data []interface{} `json:"data"`

View File

@@ -15,23 +15,18 @@ type ReplicationStatusRequest struct {
}
// ReplicationStatus get replication status
func (d Disks) ReplicationStatus(ctx context.Context, req ReplicationStatusRequest) (interface{}, error) {
func (d Disks) ReplicationStatus(ctx context.Context, req ReplicationStatusRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/disks/replicationStatus"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
return "", err
}
// result, err := strconv.ParseBool(string(res))
// if err != nil {
// return nil, err
// }
return res, nil
return string(res), nil
}

View File

@@ -42,6 +42,10 @@ type ListRequest struct {
// Required: false
ByID uint64 `url:"by_id,omitempty" json:"by_id,omitempty"`
// Find by list of clientIds
// Required: false
ClientIDs []uint64 `url:"clientIds,omitempty" json:"clientIds,omitempty"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`

View File

@@ -48,15 +48,15 @@ type ListRequest struct {
// Find by public True or False
// Required: false
Public bool `url:"public,omitempty" json:"public,omitempty"`
Public interface{} `url:"public,omitempty" json:"public,omitempty" validate:"omitempty,sortBy"`
// Find by hot resize True or False
// Required: false
HotResize bool `url:"hotResize,omitempty" json:"hotResize,omitempty"`
HotResize interface{} `url:"hotResize,omitempty" json:"hotResize,omitempty" validate:"omitempty,sortBy"`
// Find by bootable True or False
// Required: false
Bootable bool `url:"bootable,omitempty" json:"bootable,omitempty"`
Bootable interface{} `url:"bootable,omitempty" json:"bootable,omitempty" validate:"omitempty,sortBy"`
// Sort by one of supported fields, format +|-(field)
// Required: false

View File

@@ -14,7 +14,8 @@ type Interface struct {
// Should be one of:
// - VINS
// - EXTNET
NetType string `url:"netType" json:"netType" validate:"required,kvmNetType"`
// - VFNIC
NetType string `url:"netType" json:"netType" validate:"required,kvmx86NetType"`
// Network ID for connect to,
// for EXTNET - external network ID,
@@ -74,10 +75,14 @@ type CreateRequest struct {
// Required: true
RAM uint64 `url:"ram" json:"ram" validate:"required"`
// If True, the imageId, bootDisk, sepId, pool parameters are ignored and the compute is created without a boot disk in the stopped state
// Required: false
WithoutBootDisk bool `url:"withoutBootDisk" json:"withoutBootDisk"`
// ID of the OS image to base this VM on;
// Could be boot disk image or CD-ROM image
// Required: true
ImageID uint64 `url:"imageId" json:"imageId" validate:"required"`
// Required: false
ImageID uint64 `url:"imageId,omitempty" json:"imageId,omitempty"`
// Size of the boot disk in GB
// Required: false
@@ -131,6 +136,24 @@ type CreateRequest struct {
// Type of compute Stateful (KVM_X86) or Stateless (SVA_KVM_X86)
// Required: false
Driver string `url:"driver,omitempty" json:"driver,omitempty" validate:"omitempty,computeDriver"`
// Rule for VM placement with NUMA affinity.
// Possible values - none (placement without NUMA affinity),
// strict (strictly with NUMA affinity, if not possible - do not start VM),
// loose (use NUMA affinity if possible)
// Required: false
// Default: none
NumaAffinity string `url:"numaAffinity,omitempty" json:"numaAffinity,omitempty" validate:"omitempty,numaAffinity"`
// Run VM on dedicated CPUs. To use this feature, the system must be pre-configured by allocating CPUs on the physical node
// Required: false
// Default: false
CPUPin bool `url:"cpupin" json:"cpupin"`
// Use Huge Pages to allocate RAM of the virtual machine. The system must be pre-configured by allocating Huge Pages on the physical node
// Required: false
// Default: false
HPBacked bool `url:"hpBacked" json:"hpBacked"`
}
// GetRAM returns RAM field values

View File

@@ -28,18 +28,22 @@ type CreateBlankRequest struct {
// Required: true
RAM uint64 `url:"ram" json:"ram" validate:"required"`
// If True, the imageId, bootDisk, sepId, pool parameters are ignored and the compute is created without a boot disk in the stopped state
// Required: false
WithoutBootDisk bool `url:"withoutBootDisk" json:"withoutBootDisk"`
// Size of the boot disk in GB
// Required: true
BootDisk uint64 `url:"bootDisk" json:"bootDisk" validate:"required"`
// Required: false
BootDisk uint64 `url:"bootDisk,omitempty" json:"bootDisk,omitempty"`
// ID of SEP to create boot disk on.
// Uses images SEP ID if not set
// Required: true
SEPID uint64 `url:"sepId" json:"sepId" validate:"required"`
// Required: false
SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`
// Pool to use if sepId is set, can be also empty if needed to be chosen by system
// Required: true
Pool string `url:"pool" json:"pool" validate:"required"`
// Required: false
Pool string `url:"pool,omitempty" json:"pool,omitempty"`
// Slice of structs with data disk description. Each disk has parameters: required - diskName, size; optional - sepId, pool, desc and imageId.
// If not specified, compute will be created without disks.

View File

@@ -22,10 +22,6 @@ type ListLBRequest struct {
// Required: false
Name string `url:"name,omitempty" json:"name,omitempty"`
// Find by account ID
// Required: false
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
// Find by tech status
// Required: false
TechStatus string `url:"techStatus,omitempty" json:"techStatus,omitempty"`

View File

@@ -14,14 +14,17 @@ type ListRequest struct {
// Required: false
TaskID string `url:"taskId,omitempty" json:"taskId,omitempty"`
// Find by auditId
// Required: false
AuditID string `url:"auditId,omitempty" json:"auditId,omitempty"`
// Find by status
// Required: false
Status string `url:"status,omitempty" json:"status,omitempty"`
// Find by completed True or False
// Default: false
// Required: false
Completed bool `url:"completed" json:"completed"`
Completed interface{} `url:"completed,omitempty" json:"completed,omitempty" validate:"omitempty,isBool"`
// Sort by one of supported fields, format +|-(field)
// Required: false
@@ -29,19 +32,21 @@ type ListRequest struct {
// Find all tasks after point in time (unixtime)
// Required: false
UpdateTimeAt uint64 `url:"page,updateTimeAt" json:"updateTimeAt,omitempty"`
UpdateTimeAt uint64 `url:"updateTimeAt,omitempty" json:"updateTimeAt,omitempty"`
// Find all tasks before point in time (unixtime)
// Required: false
UpdateTimeTo uint64 `url:"page,updateTimeTo" json:"updateTimeTo,omitempty"`
UpdateTimeTo uint64 `url:"updateTimeTo,omitempty" json:"updateTimeTo,omitempty"`
// Page number
// Default: 0
// Default: 0
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
// Page size
// Default: 0
// Default: 0
// Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
@@ -71,6 +76,10 @@ func (t Tasks) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
if err := validators.ValidateRequest(req); err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/tasks/list"
res, err := t.client.DecortApiCall(ctx, http.MethodPost, url, req)

View File

@@ -30,6 +30,10 @@ type ListDeletedRequest struct {
// Required: false
ExtIP string `url:"extIp,omitempty" json:"extIp,omitempty"`
// Find by VNF Device id
// Required: false
VNFDevID uint64 `url:"vnfdevId,omitempty" json:"vnfdevId,omitempty"`
// Sort by one of supported fields, format +|-(field)
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
@@ -50,6 +54,10 @@ func (v VINS) ListDeleted(ctx context.Context, req ListDeletedRequest) (*ListVIN
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
if err := validators.ValidateRequest(req); err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/vins/listDeleted"
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)