v1.16.9
This commit is contained in:
dayterr
2026-10-23 16:06:09 +03:00
parent 84164a72a4
commit 54a86e5361
21 changed files with 351 additions and 71 deletions

View File

@@ -122,6 +122,9 @@ type ItemAudit struct {
// Persistent disk IDs associated with the operation
DiskIDs []uint64 `json:"disk_ids"`
// VM folder ID
VMFolderID uint64 `json:"vmfolder_id"`
// API task ID for asynchronous calls
APITask string `json:"apitask"`
}

View File

@@ -59,6 +59,14 @@ type ListRequest struct {
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
// Sort by account ID
// Required: false
AccountID uint64 `url:"account_id,omitempty" json:"account_id,omitempty"`
// Sort by sep type
// Required: false
SEPType string `url:"sep_type,omitempty" json:"sep_type,omitempty" validate:"omitempty,sepTypes"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`

View File

@@ -32,6 +32,9 @@ type ItemImage struct {
// Link to
LinkTo uint64 `json:"linkTo"`
// Links to
LinksTo []uint64 `json:"linksTo"`
// Name
Name string `json:"name"`
@@ -214,4 +217,7 @@ type RecordImage struct {
// Version
Version string `json:"version"`
// Real size of the image
RealSize uint64 `json:"real_size"`
}

View File

@@ -46,6 +46,12 @@ type ItemLocation struct {
// Are VM Folders enabled
VMFoldersEnabled bool `json:"vm_folders_enabled"`
// SDN Web config
SDNWeb SDNWeb `json:"sdn_web"`
// BVP Web config
BVPWeb BVPWeb `json:"bvp_web"`
}
// List of locations
@@ -56,3 +62,27 @@ type ListLocations struct {
// Entry count
EntryCount uint64 `json:"entryCount"`
}
// SDN Web config
type SDNWeb struct {
// Whether the config is enabled
Enabled bool `json:"enabled"`
// URL
URL string `json:"url"`
// Number of the port
Port uint64 `json:"port"`
}
// BVP Web config
type BVPWeb struct {
// Whether the config is enabled
Enabled bool `json:"enabled"`
// URL
URL string `json:"url"`
// Number of ther port
Port uint64 `json:"port"`
}

View File

@@ -22,6 +22,9 @@ type Resource struct {
// SEPs
SEPs map[string]map[string]DiskUsage `json:"seps"`
// Policies
Policies map[string]PolicyUsage `json:"policies"`
}
// Disk usage
@@ -33,6 +36,21 @@ type DiskUsage struct {
DiskSizeMax float64 `json:"disksizemax"`
}
// Policy usage
type PolicyUsage struct {
// Disk size
DiskSize float64 `json:"disksize"`
// Max disk size
DiskSizeMax float64 `json:"disksizemax"`
// Limit
Limit float64 `json:"limit"`
// SEPs
SEPs map[string]map[string]DiskUsage `json:"seps"`
}
// Information about resources
type Resources struct {
// Current information about resources
@@ -51,10 +69,31 @@ type ItemResourceConsumption struct {
Reserved Resource `json:"reserved"`
// Resource limits
ResourceLimits ResourceLimits `json:"resourceLimits"`
ResourceLimits ResourceConsumptionLimits `json:"resourceLimits"`
// Resource group ID
RGID uint64 `json:"rgid"`
RGID uint64 `json:"id"`
}
// Resource limits of resource consumption
type ResourceConsumptionLimits struct {
// CUC
CUC float64 `json:"CU_C"`
// CUD
CUD float64 `json:"CU_D"`
// CUDM
CUDM float64 `json:"CU_DM"`
// CUI
CUI float64 `json:"CU_I"`
// CUM
CUM float64 `json:"CU_M"`
// GPU units
GPUUnits float64 `json:"gpu_units"`
}
type ListResourceConsumption struct {
@@ -892,4 +931,7 @@ type RecordResourceUsage struct {
// SEPs
SEPs map[string]map[string]DiskUsage `json:"seps"`
// Policies
Policies map[string]PolicyUsage `json:"policies"`
}

View File

@@ -844,6 +844,9 @@ type ItemReservation struct {
// Account ID
AccountID uint64 `json:"account_id"`
// Whether reservation is auto assignable
AutoAssignable bool `json:"auto_assignable"`
// IP
IP string `json:"ip"`

View File

@@ -77,6 +77,9 @@ type ItemAudit struct {
// Persistent disk IDs associated with the operation
DiskIDs []uint64 `json:"disk_ids"`
// VM folder ID
VMFolderID uint64 `json:"vmfolder_id"`
// API task ID for asynchronous calls
APITask string `json:"apitask"`
}
@@ -146,6 +149,9 @@ type RecordAudit struct {
// Compute ID
ComputeID uint64 `json:"compute_id"`
// VM folder ID
VMFolderID uint64 `json:"vmfolder_id"`
}
// List of Linked Jobs

View File

@@ -18,12 +18,12 @@ type StartRequest struct {
// Memory pressure threshold (%)
// Required: false
// Default: 20
PressureThreshold uint64 `url:"pressure_threshold,omitempty" json:"pressure_threshold,omitempty" validate:"omitempty,pressureThreshold"`
PressureThreshold float64 `url:"pressure_threshold,omitempty" json:"pressure_threshold,omitempty" validate:"omitempty,pressureThreshold"`
// Deflate threshold (%)
// Required: false
// Default: 30
DeflateThreshold uint64 `url:"deflate_threshold,omitempty" json:"deflate_threshold,omitempty" validate:"omitempty,deflateThreshold"`
DeflateThreshold float64 `url:"deflate_threshold,omitempty" json:"deflate_threshold,omitempty" validate:"omitempty,deflateThreshold"`
// Host reserved memory
// Required: false
@@ -33,12 +33,12 @@ type StartRequest struct {
// Buffer percentage (%)
// Required: false
// Default: 20
BufferPCT uint64 `url:"buffer_pct,omitempty" json:"buffer_pct,omitempty" validate:"omitempty,bufferPCT"`
BufferPCT float64 `url:"buffer_pct,omitempty" json:"buffer_pct,omitempty" validate:"omitempty,bufferPCT"`
// Guaranteed memory percentage (%)
// Required: false
// Default: 25
GuaranteedPCT uint64 `url:"guaranteed_pct,omitempty" json:"guaranteed_pct,omitempty" validate:"omitempty,guaranteedPCT"`
GuaranteedPCT float64 `url:"guaranteed_pct,omitempty" json:"guaranteed_pct,omitempty" validate:"omitempty,guaranteedPCT"`
// Absolute minimum guaranteed memory (MB)
// Required: false
@@ -48,17 +48,17 @@ type StartRequest struct {
// Shrink threshold percentage (%)
// Required: false
// Default: 50
ShrinkThresholdPCT uint64 `url:"shrink_threshold_pct,omitempty" json:"shrink_threshold_pct,omitempty" validate:"omitempty,shrinkThresholdPCT"`
ShrinkThresholdPCT float64 `url:"shrink_threshold_pct,omitempty" json:"shrink_threshold_pct,omitempty" validate:"omitempty,shrinkThresholdPCT"`
// Max shrink percentage per cycle (%)
// Required: false
// Default: 10
BalloonMaxShrinkPCT uint64 `url:"balloon_max_shrink_pct,omitempty" json:"balloon_max_shrink_pct,omitempty" validate:"omitempty,balloonMaxShrinkPCT"`
BalloonMaxShrinkPCT float64 `url:"balloon_max_shrink_pct,omitempty" json:"balloon_max_shrink_pct,omitempty" validate:"omitempty,balloonMaxShrinkPCT"`
// Max grow percentage per cycle (%)
// Required: false
// Default: 10
BalloonMaxGrowPCT uint64 `url:"balloon_max_grow_pct,omitempty" json:"balloon_max_grow_pct,omitempty" validate:"omitempty,balloonMaxGrowPCT"`
BalloonMaxGrowPCT float64 `url:"balloon_max_grow_pct,omitempty" json:"balloon_max_grow_pct,omitempty" validate:"omitempty,balloonMaxGrowPCT"`
// VM change cooldown (seconds)
// Required: false

View File

@@ -18,12 +18,12 @@ type UpdateRequest struct {
// Memory pressure threshold (%)
// Required: false
// Default: 20
PressureThreshold uint64 `url:"pressure_threshold,omitempty" json:"pressure_threshold,omitempty" validate:"omitempty,pressureThreshold"`
PressureThreshold float64 `url:"pressure_threshold,omitempty" json:"pressure_threshold,omitempty" validate:"omitempty,pressureThreshold"`
// Deflate threshold (%)
// Required: false
// Default: 30
DeflateThreshold uint64 `url:"deflate_threshold,omitempty" json:"deflate_threshold,omitempty" validate:"omitempty,deflateThreshold"`
DeflateThreshold float64 `url:"deflate_threshold,omitempty" json:"deflate_threshold,omitempty" validate:"omitempty,deflateThreshold"`
// Host reserved memory
// Required: false
@@ -33,12 +33,12 @@ type UpdateRequest struct {
// Buffer percentage (%)
// Required: false
// Default: 20
BufferPCT uint64 `url:"buffer_pct,omitempty" json:"buffer_pct,omitempty" validate:"omitempty,bufferPCT"`
BufferPCT float64 `url:"buffer_pct,omitempty" json:"buffer_pct,omitempty" validate:"omitempty,bufferPCT"`
// Guaranteed memory percentage (%)
// Required: false
// Default: 25
GuaranteedPCT uint64 `url:"guaranteed_pct,omitempty" json:"guaranteed_pct,omitempty" validate:"omitempty,guaranteedPCT"`
GuaranteedPCT float64 `url:"guaranteed_pct,omitempty" json:"guaranteed_pct,omitempty" validate:"omitempty,guaranteedPCT"`
// Absolute minimum guaranteed memory (MB)
// Required: false
@@ -48,17 +48,17 @@ type UpdateRequest struct {
// Shrink threshold percentage (%)
// Required: false
// Default: 50
ShrinkThresholdPCT uint64 `url:"shrink_threshold_pct,omitempty" json:"shrink_threshold_pct,omitempty" validate:"omitempty,shrinkThresholdPCT"`
ShrinkThresholdPCT float64 `url:"shrink_threshold_pct,omitempty" json:"shrink_threshold_pct,omitempty" validate:"omitempty,shrinkThresholdPCT"`
// Max shrink percentage per cycle (%)
// Required: false
// Default: 10
BalloonMaxShrinkPCT uint64 `url:"balloon_max_shrink_pct,omitempty" json:"balloon_max_shrink_pct,omitempty" validate:"omitempty,balloonMaxShrinkPCT"`
BalloonMaxShrinkPCT float64 `url:"balloon_max_shrink_pct,omitempty" json:"balloon_max_shrink_pct,omitempty" validate:"omitempty,balloonMaxShrinkPCT"`
// Max grow percentage per cycle (%)
// Required: false
// Default: 10
BalloonMaxGrowPCT uint64 `url:"balloon_max_grow_pct,omitempty" json:"balloon_max_grow_pct,omitempty" validate:"omitempty,balloonMaxGrowPCT"`
BalloonMaxGrowPCT float64 `url:"balloon_max_grow_pct,omitempty" json:"balloon_max_grow_pct,omitempty" validate:"omitempty,balloonMaxGrowPCT"`
// VM change cooldown (seconds)
// Required: false

View File

@@ -0,0 +1,64 @@
package compute
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
type Pin struct {
// ID of the compute instance
// Required: true
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
// Target node ID. Required for stopped computes.
// For started computes it is optional;
// if it differs from the current node, allow_migration must be true,
// otherwise the compute is reported with migration_not_allowed error.
// Required: false
NodeID uint64 `url:"node_id,omitempty" json:"node_id,omitempty"`
}
// MassPinToNodeRequest to pin multiple computes to nodes in a single call
type MassPinToNodeRequest struct {
// Computes to pin, at most 200 items per request
// Required: true
Pins []Pin `url:"pins" json:"pins" validate:"required,min=1,max=200,dive"`
// Allow live migration of started computes to the requested node_id
// Default: false
// Required: false
AllowMigration interface{} `url:"allow_migration,omitempty" json:"allow_migration,omitempty" validate:"omitempty,isBool"`
// Start compute after node exits from MAINTENANCE state
// Default: false
// Required: false
AutoStart interface{} `url:"auto_start,omitempty" json:"auto_start,omitempty" validate:"omitempty,isBool"`
}
// MassPinToNode pins multiple computes to nodes in a single call
func (c Compute) MassPinToNode(ctx context.Context, req MassPinToNodeRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/mass_pin_to_node"
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return "", err
}
var resp string
err = json.Unmarshal(res, &resp)
if err != nil {
return "", err
}
return resp, nil
}

View File

@@ -120,6 +120,12 @@ type RecordGrid struct {
// Whether VM folders are enabled
VMFoldersEnabled bool `json:"vm_folders_enabled"`
// SDN Web config
SDNWeb SDNWeb `json:"sdn_web"`
// BVP Web config
BVPWeb BVPWeb `json:"bvp_web"`
}
// Information about grid
@@ -171,6 +177,36 @@ type ItemGridList struct {
// Whether VM folders are enabled
VMFoldersEnabled bool `json:"vm_folders_enabled"`
// SDN Web config
SDNWeb SDNWeb `json:"sdn_web"`
// BVP Web config
BVPWeb BVPWeb `json:"bvp_web"`
}
// SDN Web config
type SDNWeb struct {
// Whether the config is enabled
Enabled bool `json:"enabled"`
// URL
URL string `json:"url"`
// Number of the port
Port uint64 `json:"port"`
}
// BVP Web config
type BVPWeb struct {
// Whether the config is enabled
Enabled bool `json:"enabled"`
// URL
URL string `json:"url"`
// Number of the port
Port uint64 `json:"port"`
}
// List Grids

View File

@@ -59,6 +59,14 @@ type ListRequest struct {
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
// Sort by account ID
// Required: false
AccountID uint64 `url:"account_id,omitempty" json:"account_id,omitempty"`
// Sort by sep type
// Required: false
SEPType string `url:"sep_type,omitempty" json:"sep_type,omitempty" validate:"omitempty,sepTypes"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`

View File

@@ -89,6 +89,9 @@ type RecordImage struct {
// Purge attempts
PurgeAttempts uint64 `json:"purgeAttempts"`
// Real size if the image
RealSize uint64 `json:"real_size"`
// Reference ID
ReferenceID string `json:"referenceId"`
@@ -277,6 +280,15 @@ type ItemImage struct {
// Virtual
Virtual bool `json:"virtual"`
// Real size of the image
RealSize uint64 `json:"real_size"`
// CKey
CKey string `json:"_ckey"`
// Meta info
Meta interface{} `json:"_meta"`
}
// List images

View File

@@ -43,6 +43,9 @@ type Reservation struct {
// SEPs
SEPs map[string]map[string]DiskUsage `json:"seps"`
// Policies
Policies map[string]PolicyUsage `json:"policies"`
}
// Disk usage
@@ -54,6 +57,21 @@ type DiskUsage struct {
DiskSizeMax float64 `json:"disksizemax"`
}
// Policy usage
type PolicyUsage struct {
// Disk size
DiskSize float64 `json:"disksize"`
// Max disk size
DiskSizeMax float64 `json:"disksizemax"`
// Limit
Limit float64 `json:"limit"`
// SEPs
SEPs map[string]map[string]DiskUsage `json:"seps"`
}
// Resources usage information
type ItemResourceConsumption struct {
// Current information
@@ -63,12 +81,33 @@ type ItemResourceConsumption struct {
Reserved Reservation `json:"Reserved"`
// Resource limits
ResourceLimits ResourceLimits `json:"resourceLimits"`
ResourceLimits ResourceConsumptionLimits `json:"resourceLimits"`
// Resource group ID
RGID uint64 `json:"id"`
}
// Resource limits of resource consumption
type ResourceConsumptionLimits struct {
// CUC
CUC float64 `json:"CU_C"`
// CUD
CuD float64 `json:"CU_D"`
// CUDM
CUDM float64 `json:"CU_DM"`
// CUI
CUI float64 `json:"CU_I"`
// CUM
CUM float64 `json:"CU_M"`
// GPU units
GPUUnits float64 `json:"gpu_units"`
}
type ListResourceConsumption struct {
// Data
Data []ItemResourceConsumption `json:"data"`

View File

@@ -16,7 +16,7 @@ type AddPoolRequest struct {
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
// Pool structure which contains fields such as "name", "usage_limit", "types", "system", "accessAccountIds", "accessResGroupIds". Added fields for other pool types: Des, Ovs - "uris" list of "ip, port".
// Dorado, Tatlin - "vdisk_discard". Hitachi - "id", "snapshotable", "snapshot_pool_id", "minLdevId", "maxLdevId", "clone_technology", "vdisk_discard". Shared - "description", "wwns", "allocate_type", "stripes", "metadata_size", "metadatatalun", "vdisk_discard" Local - "description", "node_consumer", "block_disk".
// Dorado, Tatlin - "vdisk_discard". Hitachi - "id", "snapshotable", "snapshot_pool_id", "minLdevId", "maxLdevId", "clone_technology", "vdisk_discard". Shared - "description", "wwns", "allocate_type", "stripes", "metadata_size", "metadatatalun", "vdisk_discard" Local - "description", "node_consumer", "block_disk", Aerodisk – "provision", "clone_technology", "disk_block_size", "read_only"..
// Required: true
Pool string `url:"pool" json:"pool" validate:"required"`
}