This commit is contained in:
2026-06-11 16:54:48 +04:00
parent f1112e5a11
commit f6acddaa8d
36 changed files with 226 additions and 499 deletions

View File

@@ -8,8 +8,8 @@ type Audit struct {
}
// Builder for audit endpoint
func New(client interfaces.Caller) *Audit{
func New(client interfaces.Caller) *Audit {
return &Audit{
client: client,
}
}
}

View File

@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)

View File

@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)

View File

@@ -2,10 +2,10 @@ package kvmx86
import (
"context"
"encoding/json"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
@@ -231,7 +231,6 @@ type CreateRequest struct {
// GetRAM returns RAM field values
func (r CreateRequest) GetRAM() map[string]uint64 {
res := make(map[string]uint64, 1)
res["RAM"] = r.RAM
@@ -239,12 +238,6 @@ func (r CreateRequest) GetRAM() map[string]uint64 {
return res
}
type wrapperCreateRequest struct {
CreateRequest
Interfaces []string `url:"interfaces,omitempty"`
DataDisks []string `url:"dataDisks,omitempty"`
}
// Create creates KVM x86 VM based on specified OS image
func (k KVMX86) Create(ctx context.Context, req CreateRequest) (uint64, error) {
err := validators.ValidateRequest(req)
@@ -252,55 +245,12 @@ func (k KVMX86) Create(ctx context.Context, req CreateRequest) (uint64, error) {
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
var interfaces []string
if len(req.Interfaces) != 0 {
interfaces = make([]string, 0, len(req.Interfaces))
for i := range req.Interfaces {
b, err := json.Marshal(req.Interfaces[i])
if err != nil {
return 0, err
}
interfaces = append(interfaces, string(b))
}
} else if req.Interfaces != nil && len(req.Interfaces) == 0 {
interfaces = []string{"[]"}
}
var dataDisks []string
if len(req.DataDisks) != 0 {
dataDisks = make([]string, 0, len(req.DataDisks))
for i := range req.DataDisks {
b, err := json.Marshal(req.DataDisks[i])
if err != nil {
return 0, err
}
dataDisks = append(dataDisks, string(b))
}
}
reqWrapped := wrapperCreateRequest{
CreateRequest: req,
Interfaces: interfaces,
DataDisks: dataDisks,
}
url := "/cloudapi/kvmx86/create"
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
res, err := k.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return 0, err
}
result, err := strconv.ParseUint(string(res), 10, 64)
if err != nil {
return 0, err
}
return result, nil
return strconv.ParseUint(string(res), 10, 64)
}

View File

@@ -2,10 +2,10 @@ package kvmx86
import (
"context"
"encoding/json"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
@@ -136,12 +136,6 @@ func (r CreateBlankRequest) GetRAM() map[string]uint64 {
return res
}
type wrapperCreateBlankRequest struct {
CreateBlankRequest
Interfaces []string `url:"interfaces,omitempty"`
DataDisks []string `url:"dataDisks,omitempty"`
}
// CreateBlank creates KVM x86 VM from scratch
func (k KVMX86) CreateBlank(ctx context.Context, req CreateBlankRequest) (uint64, error) {
err := validators.ValidateRequest(req)
@@ -149,55 +143,12 @@ func (k KVMX86) CreateBlank(ctx context.Context, req CreateBlankRequest) (uint64
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
var interfaces []string
if len(req.Interfaces) != 0 {
interfaces = make([]string, 0, len(req.Interfaces))
for i := range req.Interfaces {
b, err := json.Marshal(req.Interfaces[i])
if err != nil {
return 0, err
}
interfaces = append(interfaces, string(b))
}
} else if req.Interfaces != nil && len(req.Interfaces) == 0 {
interfaces = []string{"[]"}
}
var dataDisks []string
if len(req.DataDisks) != 0 {
dataDisks = make([]string, 0, len(req.DataDisks))
for i := range req.DataDisks {
b, err := json.Marshal(req.DataDisks[i])
if err != nil {
return 0, err
}
dataDisks = append(dataDisks, string(b))
}
}
reqWrapped := wrapperCreateBlankRequest{
CreateBlankRequest: req,
Interfaces: interfaces,
DataDisks: dataDisks,
}
url := "/cloudapi/kvmx86/createBlank"
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
res, err := k.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return 0, err
}
result, err := strconv.ParseUint(string(res), 10, 64)
if err != nil {
return 0, err
}
return result, nil
return strconv.ParseUint(string(res), 10, 64)
}

View File

@@ -2,6 +2,7 @@ package pcidevice
import (
"encoding/json"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/serialization"
)

View File

@@ -3,8 +3,9 @@ package account
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter

View File

@@ -8,8 +8,8 @@ type Audit struct {
}
// Builder for audit endpoint
func New(client interfaces.Caller) *Audit{
func New(client interfaces.Caller) *Audit {
return &Audit{
client: client,
}
}
}

View File

@@ -18,11 +18,6 @@ type MigrateRequest struct {
// Particular Node ID to migrate this compute to
// Required: false
TargetNodeID uint64 `url:"targetNodeId,omitempty" json:"targetNodeId,omitempty"`
// If live migration fails, destroy compute
// on source node and recreate on the target
// Required: false
Force bool `url:"force,omitempty" json:"force,omitempty"`
}
type AsyncWrapperMigrateRequest struct {

View File

@@ -12,15 +12,19 @@ import (
// Must be provided if NewVMUUID is provided.
type OSUser struct {
// Login of a user
Login string `url:"login,omitempty" json:"login,omitempty"`
// Required: true
Login string `url:"login" json:"login" validate:"required"`
// Password of a user
Password string `url:"password,omitempty" json:"password,omitempty"`
// Required: true
Password string `url:"password" json:"password" validate:"required"`
// GUID
// Required: false
GUID string `url:"guid,omitempty" json:"guid,omitempty"`
// Pubkey
// Required: false
Pubkey string `url:"pubkey,omitempty" json:"pubkey,omitempty"`
}
@@ -36,7 +40,7 @@ type StopMigrationINRequest struct {
// OS user data for Guest OS
// Required: false
OSUsers []OSUser `url:"os_users,omitempty" json:"os_users,omitempty"`
OSUsers []OSUser `url:"os_users,omitempty" json:"os_users,omitempty" validate:"omitempty,dive"`
}
// StopMigrationIN stops compute for external migration in

View File

@@ -3,8 +3,9 @@ package disks
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// DepresentRequest struct to depresent disk from node

View File

@@ -3,8 +3,9 @@ package disks
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// PresentRequest struct to present disk to node

View File

@@ -3,8 +3,9 @@ package grid
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// SetCPUAllocationParameterRequest for setting CPU allocation parameter

View File

@@ -3,8 +3,9 @@ package grid
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// SetCPUAllocationRatioForVMRequest for setting CPU allocation ratio for computes

View File

@@ -19,7 +19,7 @@ type AccessAddRequest struct {
}
// Add accountId to sharedWith access list for k8ci.
func (k K8CI) AccessAdd (ctx context.Context, req AccessAddRequest) (string, error) {
func (k K8CI) AccessAdd(ctx context.Context, req AccessAddRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))

View File

@@ -19,7 +19,7 @@ type AccessRemoveRequest struct {
}
// Remove accountId from sharedWith access list for k8ci.
func (k K8CI) AccessRemove (ctx context.Context, req AccessRemoveRequest) (string, error) {
func (k K8CI) AccessRemove(ctx context.Context, req AccessRemoveRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))

View File

@@ -2,10 +2,10 @@ package kvmx86
import (
"context"
"encoding/json"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
@@ -254,7 +254,6 @@ type CreateRequest struct {
// GetRAM returns RAM field values
func (r CreateRequest) GetRAM() map[string]uint64 {
res := make(map[string]uint64, 1)
res["RAM"] = r.RAM
@@ -262,12 +261,6 @@ func (r CreateRequest) GetRAM() map[string]uint64 {
return res
}
type wrapperCreateRequest struct {
CreateRequest
Interfaces []string `url:"interfaces,omitempty"`
DataDisks []string `url:"dataDisks,omitempty"`
}
// Create creates KVM PowerPC VM based on specified OS image
func (k KVMX86) Create(ctx context.Context, req CreateRequest) (uint64, error) {
err := validators.ValidateRequest(req)
@@ -275,55 +268,12 @@ func (k KVMX86) Create(ctx context.Context, req CreateRequest) (uint64, error) {
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
var interfaces []string
if len(req.Interfaces) != 0 {
interfaces = make([]string, 0, len(req.Interfaces))
for i := range req.Interfaces {
b, err := json.Marshal(req.Interfaces[i])
if err != nil {
return 0, err
}
interfaces = append(interfaces, string(b))
}
} else if req.Interfaces != nil && len(req.Interfaces) == 0 {
interfaces = []string{"[]"}
}
var dataDisks []string
if len(req.DataDisks) != 0 {
dataDisks = make([]string, 0, len(req.DataDisks))
for i := range req.DataDisks {
b, err := json.Marshal(req.DataDisks[i])
if err != nil {
return 0, err
}
dataDisks = append(dataDisks, string(b))
}
}
reqWrapped := wrapperCreateRequest{
CreateRequest: req,
Interfaces: interfaces,
DataDisks: dataDisks,
}
url := "/cloudbroker/kvmx86/create"
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
res, err := k.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return 0, err
}
result, err := strconv.ParseUint(string(res), 10, 64)
if err != nil {
return 0, err
}
return result, nil
return strconv.ParseUint(string(res), 10, 64)
}

View File

@@ -2,10 +2,10 @@ package kvmx86
import (
"context"
"encoding/json"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
@@ -149,12 +149,6 @@ func (r CreateBlankRequest) GetRAM() map[string]uint64 {
return res
}
type wrapperCreateBlankRequest struct {
CreateBlankRequest
Interfaces []string `url:"interfaces,omitempty"`
DataDisks []string `url:"dataDisks,omitempty"`
}
// CreateBlank creates KVM x86 VM from scratch
func (k KVMX86) CreateBlank(ctx context.Context, req CreateBlankRequest) (uint64, error) {
err := validators.ValidateRequest(req)
@@ -162,56 +156,12 @@ func (k KVMX86) CreateBlank(ctx context.Context, req CreateBlankRequest) (uint64
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
var interfaces []string
if len(req.Interfaces) != 0 {
interfaces = make([]string, 0, len(req.Interfaces))
for i := range req.Interfaces {
b, err := json.Marshal(req.Interfaces[i])
if err != nil {
return 0, err
}
interfaces = append(interfaces, string(b))
}
} else if req.Interfaces != nil && len(req.Interfaces) == 0 {
interfaces = []string{"[]"}
}
var dataDisks []string
if len(req.DataDisks) != 0 {
dataDisks = make([]string, 0, len(req.DataDisks))
for i := range req.DataDisks {
b, err := json.Marshal(req.DataDisks[i])
if err != nil {
return 0, err
}
dataDisks = append(dataDisks, string(b))
}
}
reqWrapped := wrapperCreateBlankRequest{
CreateBlankRequest: req,
Interfaces: interfaces,
DataDisks: dataDisks,
}
url := "/cloudbroker/kvmx86/createBlank"
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
res, err := k.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return 0, err
}
result, err := strconv.ParseUint(string(res), 10, 64)
if err != nil {
return 0, err
}
return result, nil
return strconv.ParseUint(string(res), 10, 64)
}

View File

@@ -3,8 +3,11 @@ package kvmx86
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
@@ -177,14 +180,8 @@ type MassCreateRequest struct {
Clock string `url:"clock,omitempty" json:"clock,omitempty"`
}
type asyncWrapperMassCreateRequest struct {
wrapperMassCreateRequest
AsyncMode bool `url:"asyncMode"`
}
// GetRAM returns RAM field values
func (r MassCreateRequest) GetRAM() map[string]uint64 {
res := make(map[string]uint64, 1)
res["RAM"] = r.RAM
@@ -194,8 +191,24 @@ func (r MassCreateRequest) GetRAM() map[string]uint64 {
type wrapperMassCreateRequest struct {
MassCreateRequest
Interfaces []string `url:"interfaces,omitempty"`
DataDisks []string `url:"dataDisks,omitempty"`
AsyncMode bool `json:"asyncMode"`
}
type massCreateResponse struct {
Created []uint64 `json:"created"`
Errors map[string]string `json:"errors"`
}
type MassCreateError struct {
Errors map[string]string
}
func (e *MassCreateError) Error() string {
errs := make([]error, 0, len(e.Errors))
for k, v := range e.Errors {
errs = append(errs, fmt.Errorf("%s: %s", k, v))
}
return errors.Join(errs...).Error()
}
// MassCreate creates KVM x86 computes based on specified OS image
@@ -205,113 +218,42 @@ func (k KVMX86) MassCreate(ctx context.Context, req MassCreateRequest) ([]uint64
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
var interfaces []string
if len(req.Interfaces) != 0 {
interfaces = make([]string, 0, len(req.Interfaces))
for i := range req.Interfaces {
b, err := json.Marshal(req.Interfaces[i])
if err != nil {
return nil, err
}
interfaces = append(interfaces, string(b))
}
} else if req.Interfaces != nil && len(req.Interfaces) == 0 {
interfaces = []string{"[]"}
}
var dataDisks []string
if len(req.DataDisks) != 0 {
dataDisks = make([]string, 0, len(req.DataDisks))
for i := range req.DataDisks {
b, err := json.Marshal(req.DataDisks[i])
if err != nil {
return nil, err
}
dataDisks = append(dataDisks, string(b))
}
}
reqWrapped := wrapperMassCreateRequest{
MassCreateRequest: req,
Interfaces: interfaces,
DataDisks: dataDisks,
}
finalReq := asyncWrapperMassCreateRequest{wrapperMassCreateRequest: reqWrapped, AsyncMode: false}
url := "/cloudbroker/kvmx86/massCreate"
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, finalReq)
res, err := k.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, wrapperMassCreateRequest{
MassCreateRequest: req,
AsyncMode: false,
})
if err != nil {
return nil, err
}
computes := make([]uint64, 0)
var result massCreateResponse
err = json.Unmarshal(res, &computes)
if err != nil {
if err = json.Unmarshal(res, &result); err != nil {
return nil, err
}
return computes, nil
if len(result.Errors) > 0 {
return result.Created, &MassCreateError{Errors: result.Errors}
}
return result.Created, nil
}
// MassCreate creates KVM x86 computes based on specified OS image in async mode
// MassCreateAsync creates KVM x86 computes based on specified OS image in async mode
func (k KVMX86) MassCreateAsync(ctx context.Context, req MassCreateRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
var interfaces []string
if len(req.Interfaces) != 0 {
interfaces = make([]string, 0, len(req.Interfaces))
for i := range req.Interfaces {
b, err := json.Marshal(req.Interfaces[i])
if err != nil {
return "", err
}
interfaces = append(interfaces, string(b))
}
} else if req.Interfaces != nil && len(req.Interfaces) == 0 {
interfaces = []string{"[]"}
}
var dataDisks []string
if len(req.DataDisks) != 0 {
dataDisks = make([]string, 0, len(req.DataDisks))
for i := range req.DataDisks {
b, err := json.Marshal(req.DataDisks[i])
if err != nil {
return "", err
}
dataDisks = append(dataDisks, string(b))
}
}
reqWrapped := wrapperMassCreateRequest{
MassCreateRequest: req,
Interfaces: interfaces,
DataDisks: dataDisks,
}
finalReq := asyncWrapperMassCreateRequest{wrapperMassCreateRequest: reqWrapped, AsyncMode: true}
url := "/cloudbroker/kvmx86/massCreate"
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, finalReq)
res, err := k.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, wrapperMassCreateRequest{
MassCreateRequest: req,
AsyncMode: true,
})
if err != nil {
return "", err
}

View File

@@ -0,0 +1,76 @@
package node
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// InstallRequest struct to install a node
type InstallRequest struct {
// Node name
// Required: true
Name string `url:"name" json:"name" validate:"required"`
// Node roles
// Required: true
Roles []string `url:"roles" json:"roles" validate:"required"`
// OS version
// Required: true
OSVersion string `url:"os_version" json:"os_version" validate:"required"`
// OS user
// Required: false
OSUser string `url:"os_user,omitempty" json:"os_user,omitempty"`
// OS user password
// Required: true
OSUserPassword string `url:"os_user_password" json:"os_user_password" validate:"required"`
// Backplane IP address
// Required: true
BackplaneIP string `url:"backplane_ip" json:"backplane_ip" validate:"required"`
// Management IP address
// Required: true
ManagementIP string `url:"management_ip" json:"management_ip" validate:"required"`
// VX backend IP address
// Required: true
VXBackendIP string `url:"vxbackend_ip" json:"vxbackend_ip" validate:"required"`
// Gateway management IP address
// Required: true
GWMgmtIP string `url:"gw_mgmt_ip" json:"gw_mgmt_ip" validate:"required"`
// IPMI address
// Required: true
IPMIAddress string `url:"ipmi_address" json:"ipmi_address" validate:"required"`
// IPMI user
// Required: true
IPMIUser string `url:"ipmi_user" json:"ipmi_user" validate:"required"`
// IPMI password
// Required: true
IPMIPassword string `url:"ipmi_password" json:"ipmi_password" validate:"required"`
}
// Install installs a node
func (n Node) Install(ctx context.Context, req InstallRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/node/install"
res, err := n.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return "", err
}
return string(res), nil
}

View File

@@ -3,8 +3,9 @@ package pcidevice
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// DeleteRequest struct to deleting PCI device

View File

@@ -3,8 +3,9 @@ package pcidevice
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// DisableRequest struct for disabling PCI device

View File

@@ -3,8 +3,9 @@ package pcidevice
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// EnableRequest struct for enabling PCI device

View File

@@ -2,6 +2,7 @@ package pcidevice
import (
"encoding/json"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/serialization"
)

View File

@@ -3,8 +3,9 @@ package rg
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter

View File

@@ -3,8 +3,9 @@ package rg
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// SetCPUAllocationRatioRequest struct for setting CPU allocation ratio

View File

@@ -3,8 +3,9 @@ package vgpu
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// AllocateRequest struct for allocating VGPU

View File

@@ -3,8 +3,9 @@ package vgpu
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// CreateRequest struct for creating VGPU

View File

@@ -3,8 +3,9 @@ package vgpu
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// DeallocateRequest struct for deallocating VGPU

View File

@@ -3,8 +3,9 @@ package vgpu
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// DestroyRequest struct for destroying VGPU

View File

@@ -12,6 +12,21 @@ type CpuAlignmentProfile struct {
Model string `json:"model"`
}
// Supported CPU model
type SupportedCpuModel struct {
// Vendor
Vendor string `json:"vendor"`
// Model
Model string `json:"model"`
// Count
Count uint64 `json:"count"`
// Percentage
Percentage float64 `json:"percentage"`
}
// CPU alignment profile candidate
type CpuAlignmentProfileCandidate struct {
// Profile name
@@ -27,7 +42,7 @@ type CpuAlignmentProfileCandidate struct {
Count uint64 `json:"count"`
// Percentage
Percentage uint64 `json:"percentage"`
Percentage float64 `json:"percentage"`
// Required count
RequiredCount uint64 `json:"required_count"`
@@ -40,6 +55,9 @@ type TestCPUAlignmentProfileResult struct {
// Candidates
Candidates []CpuAlignmentProfileCandidate `json:"candidates"`
// Supported CPU models
SupportedCpuModels []SupportedCpuModel `json:"supported_cpu_models"`
}
// Item for list_cpu_alignment_profile response

View File

@@ -116,8 +116,8 @@ type AddAddress struct {
IsPrimary interface{} `url:"is_primary" json:"is_primary" validate:"required,isBool"`
// MAC address
// Required: false
MAC string `url:"mac,omitempty" json:"mac,omitempty"`
// Required: true
MAC string `url:"mac" json:"mac" validate:"required"`
}
// Update updates a logical port