This commit is contained in:
2026-08-21 18:12:55 +04:00
parent f34fa6055c
commit c296c62a0c
1285 changed files with 3959 additions and 3249 deletions

View File

@@ -1,38 +0,0 @@
package vgpu
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// AllocateRequest struct for allocating VGPU
type AllocateRequest struct {
// Virtual GPU ID
// Required: true
VGPUID uint64 `url:"vgpuId" json:"vgpuId" validate:"required"`
}
// Allocate allocates GPU
func (v VGPU) Allocate(ctx context.Context, req AllocateRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/vgpu/allocate"
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}

View File

@@ -5,26 +5,30 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// CreateRequest struct for creating VGPU
type CreateRequest struct {
// ID of pGPU
// Required: true
PGPUID uint64 `url:"pgpuId" json:"pgpuId" validate:"required"`
// ID of the target resource group.
// Required: true
RGID uint64 `url:"rgId" json:"rgId" validate:"required"`
PGPUID uint64 `url:"pgpu_id" json:"pgpu_id" validate:"required"`
// Virtual profile id
// Required: false
ProfileID uint64 `url:"profileId,omitempty" json:"profileId,omitempty"`
ProfileID string `url:"profile_id,omitempty" json:"profile_id,omitempty"`
// Allocate vgpu after creation
// MDEV Type
// Required: false
Allocate bool `url:"allocate,omitempty" json:"allocate,omitempty"`
MDEVType string `url:"mdev_type,omitempty" json:"mdev_type,omitempty"`
// PCI Address
// Required: false
PCIAddress string `url:"pci_address,omitempty" json:"pci_address,omitempty"`
// Account IDs
// Required: false
AccountIDs []uint64 `url:"account_ids,omitempty" json:"account_ids,omitempty"`
}
// Create creates VGPU

View File

@@ -1,42 +0,0 @@
package vgpu
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// DeallocateRequest struct for deallocating VGPU
type DeallocateRequest struct {
// Virtual GPU ID
// Required: true
VGPUID uint64 `url:"vgpuId" json:"vgpuId" validate:"required"`
// Force delete (detach from compute)
// Required: false
Force bool `url:"force,omitempty" json:"force,omitempty"`
}
// Deallocate releases GPU resources
func (v VGPU) Deallocate(ctx context.Context, req DeallocateRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/vgpu/deallocate"
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}

View File

@@ -5,18 +5,14 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// DestroyRequest struct for destroying VGPU
type DestroyRequest struct {
// Virtual GPU ID
// Required: true
VGPUID uint64 `url:"vgpuId" json:"vgpuId" validate:"required"`
// Force delete (deallocate and detach from compute)
// Required: false
Force bool `url:"force,omitempty" json:"force,omitempty"`
VGPUID uint64 `url:"vgpu_id" json:"vgpu_id" validate:"required"`
}
// Destroy destroys VGPU

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// ListRequest struct to get list of VGPU
@@ -18,37 +18,29 @@ type ListRequest struct {
// Required: false
Status string `url:"status,omitempty" json:"status,omitempty"`
// Find by vgpu type
// Find by mode
// Required: false
Type string `url:"type,omitempty" json:"type,omitempty"`
// Find by vgpu mode
// Required: false
Mode string `url:"mode,omitempty" json:"mode,omitempty"`
// Find by id resgroup
// Required: false
RGID uint64 `url:"rgId,omitempty" json:"rgId,omitempty"`
SplitMode string `url:"split_mode,omitempty" json:"split_mode,omitempty"`
// Find by id node
// Required: false
NID uint64 `url:"nid,omitempty" json:"nid,omitempty"`
NodeID uint64 `url:"node_id,omitempty" json:"node_id,omitempty"`
// Find by account id
// Required: false
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
AccountID uint64 `url:"account_id,omitempty" json:"account_id,omitempty"`
// Find by compute id
// Required: false
ComputeID uint64 `url:"computeId,omitempty" json:"computeId,omitempty"`
ComputeID uint64 `url:"compute_id,omitempty" json:"compute_id,omitempty"`
// Find by pgpu id
// Required: false
PGPUID uint64 `url:"pgpuId,omitempty" json:"pgpuId,omitempty"`
PGPUID uint64 `url:"pgpu_id,omitempty" json:"pgpu_id,omitempty"`
// Sort by one of supported fields, format +|-(field)
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
SortBy string `url:"sort_by,omitempty" json:"sort_by,omitempty" validate:"omitempty,sortBy"`
// Page number
// Required: false
@@ -87,6 +79,6 @@ func (v VGPU) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
url := "/cloudbroker/vgpu/list"
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
res, err := v.client.DecortApiCall(ctx, http.MethodGet, url, req)
return res, err
}

View File

@@ -7,14 +7,23 @@ type ItemVGPU struct {
// Meta
Meta []interface{} `json:"_meta"`
// Account ID
AccountID uint64 `json:"accountId"`
// Account IDs
AccountIDs []uint64 `json:"account_ids"`
// Bus number
BusNumber int `json:"bus_number"`
// ComputeID
ComputeID uint64 `json:"compute_id"`
// Created time
CreatedTime uint64 `json:"createdTime"`
CreatedTime uint64 `json:"created_time"`
// Deleted time
DeletedTime uint64 `json:"deletedTime"`
DeletedTime uint64 `json:"deleted_time"`
// Device Reference
DeviceReference string `json:"device_reference"`
//Grid ID
GID uint64 `json:"gid"`
@@ -25,41 +34,29 @@ type ItemVGPU struct {
// VGPU ID
ID uint64 `json:"id"`
// Last claimed by
LastClaimedBy uint64 `json:"lastClaimedBy"`
// Last Update time
LastUpdateTime uint64 `json:"last_update_time"`
// Last update time
LastUpdateTime uint64 `json:"lastUpdateTime"`
// Mdev UUID
MdevUUID string `json:"mdev_uuid"`
// Mode
Mode string `json:"mode"`
// Parent PCI Address
ParentPCIAddress string `json:"parent_pci_address"`
// PCI Slot
PCISlot interface{} `json:"pciSlot"`
PCISlot uint64 `json:"pci_slot"`
// PGPUID
PGPUID uint64 `json:"pgpuid"`
// PGPU ID
PGPUID uint64 `json:"pgpu_id"`
// Profile ID
ProfileID interface{} `json:"profileId"`
// Profile Reference
ProfileReference string `json:"profile_reference"`
// RAM
RAM uint64 `json:"ram"`
// Reference ID
ReferenceID interface{} `json:"referenceId"`
// RGID
RGID uint64 `json:"rgId"`
// Split Mode
SplitMode string `json:"split_mode"`
// Status
Status string `json:"status"`
// Type
Type string `json:"type"`
// VMID
VMID uint64 `json:"vmid"`
}
// List of VGPU

View File

@@ -3,7 +3,7 @@ package vgpu
import (
"encoding/json"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/serialization"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/serialization"
)
// Serialize returns JSON-serialized []byte. Used as a wrapper over json.Marshal and json.MarshalIndent functions.

View File

@@ -1,6 +1,6 @@
package vgpu
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/interfaces"
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/interfaces"
// Structure for creating request to VGPU
type VGPU struct {