This commit is contained in:
asteam
2025-12-08 16:16:35 +03:00
parent a267d35ddf
commit f0dee6360a
89 changed files with 455 additions and 1067 deletions

View File

@@ -62,7 +62,7 @@ var computes = ListComputes{
MigrationJob: 0,
Milestones: 363500,
Name: "test",
PinnedToStack: true,
PinnedToNode: true,
RAM: 4096,
ReferenceID: "c7cb19ac-af4a-4067-852f-c5572949207e",
Registered: true,
@@ -126,7 +126,7 @@ var computes = ListComputes{
RAM: 4096,
ReferenceID: "a542c449-5b1c-4f90-88c5-7bb5f8ae68ff",
Registered: true,
PinnedToStack: true,
PinnedToNode: true,
ResName: "compute-48556",
RGID: 79727,
RGName: "sdk_negative_fields_test",

View File

@@ -476,8 +476,8 @@ type RecordCompute struct {
// List OS Users
OSUsers ListOSUser `json:"osUsers"`
// Pinned to stack
PinnedToStack bool `json:"pinnedToStack"`
// Pinned to node
PinnedToNode bool `json:"pinnedToNode"`
// PreferredCPU
PreferredCPU []int64 `json:"preferredCpu"`
@@ -485,6 +485,9 @@ type RecordCompute struct {
// Qemu_quest
QemuQuest QemuQuest `json:"qemu_guest"`
// ReadOnly indicates read-only mode state
ReadOnly bool `json:"read_only"`
// Number of RAM
RAM uint64 `json:"ram"`
@@ -1151,8 +1154,8 @@ type ItemCompute struct {
//NumaNodeId
NumaNodeId int64 `json:"numaNodeId"`
// Pinned to stack
PinnedToStack bool `json:"pinnedToStack"`
// Pinned to node
PinnedToNode bool `json:"pinnedToNode"`
// PreferredCPU
PreferredCPU []int64 `json:"preferredCpu"`
@@ -1166,6 +1169,9 @@ type ItemCompute struct {
// Qemu_quest
QemuQuest QemuQuest `json:"qemu_guest"`
// ReadOnly indicates read-only mode state
ReadOnly bool `json:"read_only"`
// Reference ID
ReferenceID string `json:"referenceId"`
@@ -1331,8 +1337,8 @@ type ItemPCIDevice struct {
// Resource group ID
RGID uint64 `json:"rgId"`
// Stack ID
StackID uint64 `json:"stackId"`
// Node ID
NodeID uint64 `json:"nodeId"`
// Status
Status string `json:"status"`

View File

@@ -8,8 +8,8 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// PinToStackRequest struct to pin compute to stack
type PinToStackRequest struct {
// PinToNodeRequest struct to pin compute to node
type PinToNodeRequest struct {
// ID of the compute instance
// Required: true
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
@@ -20,14 +20,14 @@ type PinToStackRequest struct {
AutoStart bool `url:"autoStart" json:"autoStart"`
}
// PinToStack pin compute to current stack
func (c Compute) PinToStack(ctx context.Context, req PinToStackRequest) (bool, error) {
// PinToNode pin compute to current node
func (c Compute) PinToNode(ctx context.Context, req PinToNodeRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/compute/pinToStack"
url := "/cloudapi/compute/pin_to_node"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {

View File

@@ -16,12 +16,12 @@ type RedeployRequest struct {
// 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"`
StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"`
// ID of the new OS image, if image change is required
// 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"`

View File

@@ -8,21 +8,21 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// UnpinFromStackRequest struct for unpin from stack
type UnpinFromStackRequest struct {
// UnpinFromNodeRequest struct for unpin from node
type UnpinFromNodeRequest struct {
// ID of the compute instance
// Required: true
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
}
// UnpinFromStack unpins compute from current stack
func (c Compute) UnpinFromStack(ctx context.Context, req UnpinFromStackRequest) (bool, error) {
// UnpinFromNode unpins compute from current node
func (c Compute) UnpinFromNode(ctx context.Context, req UnpinFromNodeRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/compute/unpinFromStack"
url := "/cloudapi/compute/unpin_from_node"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {