v1.16.4
This commit is contained in:
dayterr
2026-09-18 16:49:20 +03:00
parent b39021820a
commit bf932e5ef9
161 changed files with 2375 additions and 227 deletions

View File

@@ -20,7 +20,7 @@ type AbortSharedSnapshotMergeRequest struct {
type wrapperAbortSharedSnapshotMergeRequest struct {
AbortSharedSnapshotMergeRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// AbortSharedSnapshotMerge shared snapshots merge abort

View File

@@ -2,6 +2,7 @@ package compute
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -42,6 +43,17 @@ type AffinityRuleAddRequest struct {
// Value that must match the key to be taken into account when analyzing this rule
// Required: true
Value string `url:"value" json:"value" validate:"required"`
// Migrate compute according to the rule
// Default: false
// Required: false
Migrate bool `url:"migrate" json:"migrate"`
}
type wrapperAffinityRuleAddRequest struct {
AffinityRuleAddRequest
AsyncMode bool `url:"async_mode"`
}
// AffinityRuleAdd adds affinity rule
@@ -53,7 +65,12 @@ func (c Compute) AffinityRuleAdd(ctx context.Context, req AffinityRuleAddRequest
url := "/cloudbroker/compute/affinityRuleAdd"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
aReq := wrapperAffinityRuleAddRequest{
AffinityRuleAddRequest: req,
AsyncMode: false,
}
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
if err != nil {
return false, err
}
@@ -65,3 +82,32 @@ func (c Compute) AffinityRuleAdd(ctx context.Context, req AffinityRuleAddRequest
return result, nil
}
// AsyncAffinityRuleAdd add affinity rule in async mode
func (c Compute) AsyncAffinityRuleAdd(ctx context.Context, req AffinityRuleAddRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/affinityRuleAdd"
aReq := wrapperAffinityRuleAddRequest{
AffinityRuleAddRequest: req,
AsyncMode: true,
}
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
if err != nil {
return "", err
}
var resp string
err = json.Unmarshal(res, &resp)
if err != nil {
return "", err
}
return resp, nil
}

View File

@@ -2,6 +2,7 @@ package compute
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -40,6 +41,17 @@ type AntiAffinityRuleAddRequest struct {
// Value that must match the key to be taken into account when analyzing this rule
// Required: true
Value string `url:"value" json:"value" validate:"required"`
// Migrate compute according to the rule
// Default: false
// Required: false
Migrate bool `url:"migrate" json:"migrate"`
}
type wrapperAntiAffinityRuleAddRequest struct {
AntiAffinityRuleAddRequest
AsyncMode bool `url:"async_mode"`
}
// AntiAffinityRuleAdd adds anti affinity rule
@@ -51,7 +63,12 @@ func (c Compute) AntiAffinityRuleAdd(ctx context.Context, req AntiAffinityRuleAd
url := "/cloudbroker/compute/antiAffinityRuleAdd"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
aReq := wrapperAntiAffinityRuleAddRequest{
AntiAffinityRuleAddRequest: req,
AsyncMode: false,
}
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
if err != nil {
return false, err
}
@@ -63,3 +80,32 @@ func (c Compute) AntiAffinityRuleAdd(ctx context.Context, req AntiAffinityRuleAd
return result, nil
}
// AsyncAntiAffinityRuleAdd add anti affinity rule in async mode
func (c Compute) AsyncAntiAffinityRuleAdd(ctx context.Context, req AntiAffinityRuleAddRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/antiAffinityRuleAdd"
aReq := wrapperAntiAffinityRuleAddRequest{
AntiAffinityRuleAddRequest: req,
AsyncMode: true,
}
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
if err != nil {
return "", err
}
var resp string
err = json.Unmarshal(res, &resp)
if err != nil {
return "", err
}
return resp, nil
}

View File

@@ -18,7 +18,7 @@ type CDEjectRequest struct {
type wrapperCDEjectRequest struct {
CDEjectRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// CDEject ejects CD image to compute's CD-ROM

View File

@@ -21,7 +21,7 @@ type CDInsertRequest struct {
type wrapperCDInsertRequest struct {
CDInsertRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// CDInsert inserts new CD image to compute's CD-ROM

View File

@@ -34,7 +34,7 @@ type ChangeIPRequest struct {
type wrapperChangeIPRequest struct {
ChangeIPRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// ChangeIP change reserved IP for compute instance

View File

@@ -27,7 +27,7 @@ type ChangeLinkStateRequest struct {
type wrapperChangeLinkStateRequest struct {
ChangeLinkStateRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// ChangeLinkState changes the status link virtual of compute

View File

@@ -26,7 +26,7 @@ type ChangeMTURequest struct {
type wrapperChangeMTURequest struct {
ChangeMTURequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// ChangeMTU change MTU for compute instance

View File

@@ -26,7 +26,7 @@ type ChangeQoSPoliciesRequest struct {
type wrapperChangeQoSPoliciesRequest struct {
ChangeQoSPoliciesRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// ChangeQoSPolicies change qos policies for compute

View File

@@ -30,7 +30,7 @@ type ChangeSecGroupsRequest struct {
type wrapperChangeSecGroupsRequest struct {
ChangeSecGroupsRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// ChangeSecGroups changes security groups for compute

View File

@@ -47,7 +47,7 @@ type CloneRequest struct {
type wrapperCloneRequest struct {
CloneRequest
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// Clone clones compute instance

View File

@@ -22,7 +22,7 @@ type CreateTemplateRequest struct {
type wrapperCreateTemplateRequest struct {
CreateTemplateRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// CreateTemplate create template from compute instance

View File

@@ -55,7 +55,7 @@ type CreateTemplateFromBlankRequest struct {
type wrapperCreateTemplateFromBlankRequest struct {
CreateTemplateFromBlankRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// CreateTemplateFromBlank creates template from boot disk of current compute in sync mode.

View File

@@ -26,7 +26,7 @@ type DeleteRequest struct {
type wrapperDeleteRequest struct {
DeleteRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// Delete deletes compute

View File

@@ -18,7 +18,7 @@ type DisableRequest struct {
type wrapperDisableRequest struct {
DisableRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// Disable disables compute

View File

@@ -68,7 +68,7 @@ type DiskAddRequest struct {
type wrapperDiskAddRequest struct {
DiskAddRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// DiskAdd creates new disk and attach to compute

View File

@@ -34,7 +34,7 @@ type DiskAttachRequest struct {
type wrapperDiskAttachRequest struct {
DiskAttachRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// DiskAttach attach disk to compute

View File

@@ -26,7 +26,7 @@ type DiskDelRequest struct {
type wrapperDiskDelRequest struct {
DiskDelRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// DiskDel deletes disk and detaches it from compute

View File

@@ -22,7 +22,7 @@ type DiskDetachRequest struct {
type wrapperDiskDetachRequest struct {
DiskDetachRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// DiskDetach detaches disk from compute

View File

@@ -26,7 +26,7 @@ type DiskQOSRequest struct {
type wrapperDiskQOSRequest struct {
DiskQOSRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// DiskQOS changes QOS of the disk

View File

@@ -26,7 +26,7 @@ type DiskResizeRequest struct {
type wrapperDiskResizeRequest struct {
DiskResizeRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// DiskResize changes disk size

View File

@@ -26,7 +26,7 @@ type DiskSwitchToReplicationRequest struct {
type wrapperDiskSwitchToReplicationRequest struct {
DiskSwitchToReplicationRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// DiskSwitchToReplication switches disk to it's replication

View File

@@ -18,7 +18,7 @@ type GuestAgentDisableRequest struct {
type wrapperGuestAgentDisableRequest struct {
GuestAgentDisableRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// Disable guest agent at a specific compute

View File

@@ -18,7 +18,7 @@ type GuestAgentEnableRequest struct {
type wrapperGuestAgentEnableRequest struct {
GuestAgentEnableRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// Enable guest agent at a specific compute

View File

@@ -26,7 +26,7 @@ type GuestAgentExecuteRequest struct {
type wrapperGuestAgentExecuteRequest struct {
GuestAgentExecuteRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// Execute guest agent command

View File

@@ -18,7 +18,7 @@ type GuestAgentFeatureUpdateRequest struct {
type wrapperGuestAgentFeatureUpdateRequest struct {
GuestAgentFeatureUpdateRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// Feature update guest agent

View File

@@ -75,6 +75,14 @@ type ListRequest struct {
// Required: false
ZoneID uint64 `url:"zone_id,omitempty" json:"zone_id,omitempty"`
// Find by VM folder ID
// Required: false
FolderID uint64 `url:"folder_id,omitempty" json:"folder_id,omitempty"`
// Include computes from descendant folders.
// Required: false
IncludeDescendants interface{} `url:"include_descendants,omitempty" json:"include_descendants,omitempty" validate:"omitempty,isBool"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`

View File

@@ -22,7 +22,7 @@ type MassDeleteRequest struct {
type wrapperMassDeleteRequest struct {
MassDeleteRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// MassDelete starts jobs to delete several computes

View File

@@ -18,7 +18,7 @@ type MassRebootRequest struct {
type wrapperMassRebootRequest struct {
MassRebootRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// MassReboot starts jobs to reboot several computes

View File

@@ -18,7 +18,7 @@ type MassStartRequest struct {
type wrapperMassStartRequest struct {
MassStartRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// MassStart starts jobs to start several computes

View File

@@ -22,7 +22,7 @@ type MassStopRequest struct {
type wrapperMassStopRequest struct {
MassStopRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// MassStop starts jobs to stop several computes

View File

@@ -22,7 +22,7 @@ type MigrateRequest struct {
type AsyncWrapperMigrateRequest struct {
MigrateRequest
SyncMode bool `url:"sync"`
AsyncMode bool `url:"async_mode"`
}
// Migrate migrates compute to another node
@@ -34,7 +34,7 @@ func (c Compute) Migrate(ctx context.Context, req MigrateRequest) (bool, error)
url := "/cloudbroker/compute/migrate"
syncReq := AsyncWrapperMigrateRequest{MigrateRequest: req, SyncMode: true}
syncReq := AsyncWrapperMigrateRequest{MigrateRequest: req, AsyncMode: false}
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, syncReq)
if err != nil {
@@ -58,7 +58,7 @@ func (c Compute) AsyncMigrate(ctx context.Context, req MigrateRequest) (string,
url := "/cloudbroker/compute/migrate"
asyncReq := AsyncWrapperMigrateRequest{MigrateRequest: req, SyncMode: false}
asyncReq := AsyncWrapperMigrateRequest{MigrateRequest: req, AsyncMode: true}
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, asyncReq)
if err != nil {

View File

@@ -18,7 +18,7 @@ type MigrateAbortRequest struct {
type wrapperMigrateAbortRequest struct {
MigrateAbortRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// MigrateAbort aborts compute migration

View File

@@ -28,7 +28,7 @@ type MigrateStorageRequest struct {
// Async API call
// Required: true
Sync bool `url:"sync" json:"sync" validate:"required"`
Async interface{} `url:"async_mode" json:"async_mode" validate:"required,isBool"`
}
// MigrateStorage gets complex compute migration

View File

@@ -23,7 +23,7 @@ type MigrateStorageAbortRequest struct {
type wrapperMigrateStorageAbortRequest struct {
MigrateStorageAbortRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// MigrateStorageAbort aborts complex compute migration job

View File

@@ -18,7 +18,7 @@ type MigrateStorageCleanUpRequest struct {
type wrapperMigrateStorageCleanUpRequest struct {
MigrateStorageCleanUpRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// MigrateStorageCleanUp cleanup resources after finished (success of failed) complex compute migration.

View File

@@ -22,7 +22,7 @@ type MigrateToZoneRequest struct {
type wrapperMigrateToZoneRequest struct {
MigrateToZoneRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// MigrateToZone moves compute to new zone

View File

@@ -37,7 +37,7 @@ type MoveToRGRequest struct {
type wrapperMoveToRGRequest struct {
MoveToRGRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// MoveToRG moves compute instance to new resource group

View File

@@ -96,7 +96,7 @@ type NetAttachRequest struct {
type wrapperNetAttachRequest struct {
NetAttachRequest
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// NetAttach attaches network to compute and gets info about network

View File

@@ -26,7 +26,7 @@ type NetDetachRequest struct {
type wrapperNetDetachRequest struct {
NetDetachRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// NetDetach detaches network from compute

View File

@@ -41,7 +41,7 @@ type NetQOSRequest struct {
type wrapperNetQOSRequest struct {
NetQOSRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// NetQOS updates compute interfaces QOS

View File

@@ -18,7 +18,7 @@ type PauseRequest struct {
type wrapperPauseRequest struct {
PauseRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// Pause pause compute

View File

@@ -38,7 +38,7 @@ type PFWAddRequest struct {
type wrapperPFWAddRequest struct {
PFWAddRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// PFWAdd adds port forward rule

View File

@@ -41,7 +41,7 @@ type PFWDelRequest struct {
type wrapperPFWDelRequest struct {
PFWDelRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// PFWDel deletes port forward rule

View File

@@ -31,7 +31,7 @@ type PinToNodeRequest struct {
type wrapperPinToNodeRequest struct {
PinToNodeRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// PinToNode pins compute to current node

View File

@@ -18,7 +18,7 @@ type PowerCycleRequest struct {
type wrapperPowerCycleRequest struct {
PowerCycleRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// PowerCycle makes force stop and start compute

View File

@@ -7,7 +7,7 @@ import (
)
type wrapperRaiseDownRequest struct {
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// RaiseDown starting all computes in "DOWN" tech status

View File

@@ -18,7 +18,7 @@ type RebootRequest struct {
type wrapperRebootRequest struct {
RebootRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// Reboot reboots compute

View File

@@ -50,7 +50,7 @@ type RedeployRequest struct {
type wrapperRedeployRequest struct {
RedeployRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// Redeploy redeploys compute

View File

@@ -18,7 +18,7 @@ type ResetRequest struct {
type wrapperResetRequest struct {
ResetRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// Reset resets compute

View File

@@ -46,7 +46,7 @@ func (r ResizeRequest) GetRAM() map[string]uint64 {
type wrapperResizeRequest struct {
ResizeRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// Resize resizes compute instance

View File

@@ -18,7 +18,7 @@ type RestoreRequest struct {
type wrapperRestoreRequest struct {
RestoreRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// Restore restores compute from recycle bin

View File

@@ -18,7 +18,7 @@ type ResumeRequest struct {
type wrapperResumeRequest struct {
ResumeRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// Resume resumes Compute from paused state

View File

@@ -29,7 +29,7 @@ type SnapshotCreateRequest struct {
type wrapperSnapshotCreateRequest struct {
SnapshotCreateRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// SnapshotCreate creates compute snapshot

View File

@@ -21,7 +21,7 @@ type SnapshotDeleteRequest struct {
type wrapperSnapshotDeleteRequest struct {
SnapshotDeleteRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// SnapshotDelete deletes specified compute snapshot

View File

@@ -2,6 +2,7 @@ package compute
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -17,6 +18,15 @@ type SnapshotEvictDiskRequest struct {
// ID of the disk instance
// Required: true
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
// Is mode async
// Required: false
AsyncMode interface{} `url:"async_mode,omitempty" json:"async_mode,omitempty" validate:"omitempty,isBool"`
}
type asyncWrapperSnapshotEvictDiskRequest struct {
SnapshotEvictDiskRequest
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
}
// SnapshotEvictDisk evicts specified disk from all snapshots of a compute instance
@@ -26,9 +36,14 @@ func (c Compute) SnapshotEvictDisk(ctx context.Context, req SnapshotEvictDiskReq
return false, validators.ValidationErrors(validators.GetErrors(err))
}
aReq := asyncWrapperSnapshotEvictDiskRequest{
SnapshotEvictDiskRequest: req,
AsyncMode: false,
}
url := "/cloudbroker/compute/snapshotEvictDisk"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
if err != nil {
return false, err
}
@@ -40,3 +55,32 @@ func (c Compute) SnapshotEvictDisk(ctx context.Context, req SnapshotEvictDiskReq
return result, nil
}
// AsyncSnapshotEvictDisk evicts specified disk from all snapshots of a compute instance in async mode
func (c Compute) AsyncSnapshotEvictDisk(ctx context.Context, req SnapshotEvictDiskRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
aReq := asyncWrapperSnapshotEvictDiskRequest{
SnapshotEvictDiskRequest: req,
AsyncMode: true,
}
url := "/cloudbroker/compute/snapshotEvictDisk"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
if err != nil {
return "", err
}
var resp string
err = json.Unmarshal(res, &resp)
if err != nil {
return "", err
}
return resp, nil
}

View File

@@ -30,7 +30,7 @@ type SnapshotRollbackRequest struct {
type wrapperSnapshotRollbackRequest struct {
SnapshotRollbackRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// SnapshotRollback rollbacks specified compute snapshot

View File

@@ -26,7 +26,7 @@ type StartRequest struct {
type wrapperStartRequest struct {
StartRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// Start starts compute

View File

@@ -22,7 +22,7 @@ type StopRequest struct {
type wrapperStopRequest struct {
StopRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"async_mode"`
}
// Stop stops compute