v1.5.0-gamma2

This commit is contained in:
2023-07-07 12:40:03 +03:00
parent 20fd7ab50c
commit 7c787f6fce
111 changed files with 2905 additions and 1505 deletions

View File

@@ -8,6 +8,42 @@ import (
// Request struct for get deleted computes list
type ListDeletedRequest struct {
// Find by ID
// Required: false
ByID uint64 `url:"by_id,omitempty" json:"by_id,omitempty"`
// Find by name
// 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 resource group name
// Required: false
RGName string `url:"rgName,omitempty" json:"rgName,omitempty"`
// Find by resource group ID
// Required: false
RGID uint64 `url:"rgId,omitempty" json:"rgId,omitempty"`
// Find by tech status
// Required: false
TechStatus string `url:"techStatus,omitempty" json:"techStatus,omitempty"`
// Find by IP address
// Required: false
IPAddress string `url:"ipAddress,omitempty" json:"ipAddress,omitempty"`
// Find by external network name
// Required: false
ExtNetName string `url:"extNetName,omitempty" json:"extNetName,omitempty"`
// Find by external network ID
// Required: false
ExtNetID uint64 `url:"extNetId,omitempty" json:"extNetId,omitempty"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`

View File

@@ -13,10 +13,34 @@ type ListPCIDeviceRequest struct {
// Identifier compute
// Required: true
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
// Find by resource group ID
// Required: false
RGID uint64 `url:"rgId,omitempty" json:"rgId,omitempty"`
// Find by device id
// Required: false
DevID uint64 `url:"devId,omitempty" json:"devId,omitempty"`
// Find by type
// Required: false
Type string `url:"type,omitempty" json:"type,omitempty"`
// Find by status
// Required: false
Status string `url:"status,omitempty" json:"status,omitempty"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
// Page size
// Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// ListPCIDevice gets list PCI device
func (c Compute) ListPCIDevice(ctx context.Context, req ListPCIDeviceRequest) ([]interface{}, error) {
func (c Compute) ListPCIDevice(ctx context.Context, req ListPCIDeviceRequest) (*ListPCIDevices, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
@@ -31,12 +55,12 @@ func (c Compute) ListPCIDevice(ctx context.Context, req ListPCIDeviceRequest) ([
return nil, err
}
list := []interface{}{}
list := ListPCIDevices{}
err = json.Unmarshal(res, &list)
if err != nil {
return nil, err
}
return list, nil
return &list, nil
}

View File

@@ -13,10 +13,34 @@ type ListVGPURequest struct {
// Identifier compute
// Required: true
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
// Find by GPU id
// Required: false
GPUID uint64 `url:"gpuId,omitempty" json:"gpuId,omitempty"`
// Find by type
// Required: false
Type string `url:"type,omitempty" json:"type,omitempty"`
// Find by status
// Required: false
Status string `url:"status,omitempty" json:"status,omitempty"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
// Page size
// Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
// Include deleted computes. If using field 'status', then includedeleted will be ignored
// Required: false
IncludeDeleted bool `url:"includedeleted,omitempty" json:"includedeleted,omitempty"`
}
// ListVGPU gets list vGPU
func (c Compute) ListVGPU(ctx context.Context, req ListVGPURequest) ([]interface{}, error) {
func (c Compute) ListVGPU(ctx context.Context, req ListVGPURequest) (*ListVGPUs, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
@@ -24,19 +48,19 @@ func (c Compute) ListVGPU(ctx context.Context, req ListVGPURequest) ([]interface
}
}
url := "/cloudapi/compute/listVgpu"
url := "/cloudapi/compute/listVGpu"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
list := []interface{}{}
list := ListVGPUs{}
err = json.Unmarshal(res, &list)
if err != nil {
return nil, err
}
return list, nil
return &list, nil
}

View File

@@ -915,3 +915,21 @@ type ListComputes struct {
// Entry count
EntryCount uint64 `json:"entryCount"`
}
// List VGPUs
type ListVGPUs struct {
// Data
Data []interface{} `json:"data"`
// Entry count
EntryCount uint64 `json:"entryCount"`
}
// List PCI devices
type ListPCIDevices struct {
// Data
Data []interface{} `json:"data"`
// Entry count
EntryCount uint64 `json:"entryCount"`
}