Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6ff4b83368 | |||
| 118b48c3bc |
45
CHANGELOG.md
45
CHANGELOG.md
@@ -1,41 +1,46 @@
|
|||||||
## Version 1.15.2
|
## Version 1.15.4
|
||||||
|
|
||||||
Методы `Audits` в cloudapi/compute, cloudbroker/compute, cloudapi/account, cloudbroker/account, cloudapi/vins, cloudbroker/vins, cloudapi/rg и cloudbroker/rg стали deprecated и в следующих версиях будут удалены, вместо них необходимо использовать метод `List` в cloudapi/audit и cloudbroker/audit с соответствующими фильтрами
|
Методы `Audits` в cloudapi/compute, cloudbroker/compute, cloudapi/account, cloudbroker/account, cloudapi/vins, cloudbroker/vins, cloudapi/rg и cloudbroker/rg стали deprecated и будут удалены в версии 1.16, вместо них необходимо использовать метод `List` в cloudapi/audit и cloudbroker/audit с соответствующими фильтрами
|
||||||
Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke`, `AccessRevokeToPool` в cloudbroker/sep стали deprecated и в следующих версиях будут удалены
|
Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke`, `AccessRevokeToPool` в cloudbroker/sep стали deprecated и будут удалены в версии 1.16
|
||||||
Методы `ComputeCISet`, `ComputeCIUnset`, `GetAudits` в cloudbroker/compute и `GetAudits` в cloudapi/compute стали deprecated и будут удалены в следующих версиях
|
Методы `ComputeCISet`, `ComputeCIUnset`, `GetAudits` в cloudbroker/compute и `GetAudits` в cloudapi/compute стали deprecated и будут удалены в версии 1.16
|
||||||
Методы `ComputeCISet`, `ComputeCIUnset` в cloudbroker/image стали deprecated и будут удалены в следующих версиях
|
Методы `ComputeCISet`, `ComputeCIUnset` в cloudbroker/image стали deprecated и будут удалены в версии 1.16
|
||||||
|
Методы `Delete`, `Disable`, `Enable`, `GetConsumedCloudUnitsByType`, `GetReservedAccountUnits` в cloudapi/account стали deprecated и будут удалены в версии 1.16
|
||||||
|
Методы `Disable`, `Enable` в cloudbroker/account стали deprecated и будут удалены в версии 1.16
|
||||||
|
Метод `IsValidInviteUserToken` в cloudapi/user стал deprecated и будет удален в версии 1.16
|
||||||
|
Метод `GetLog` в cloudbroker/compute стал deprecated и будет удален в версии 1.16
|
||||||
|
Методы `ExecuteMaintenanceScript`, `ListEmails`, `ServicesRestart` в cloudbroker/grid стали deprecated и будут удалены в версии 1.16
|
||||||
|
Метод `Get` в cloudbroker/group стал deprecated и будет удален в версии 1.16
|
||||||
|
|
||||||
Все методы группы `.SDN()` находятся в альфа-версии.
|
Все методы группы `.SDN()` находятся в альфа-версии.
|
||||||
|
|
||||||
|
|
||||||
### Добавлено
|
### Добавлено
|
||||||
|
|
||||||
#### image
|
#### compute
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-916 | Вычисляемые поля `Compute` и `MemoryDumpImage` в структуру ответа `ItemSnapSet` в cloudapi/image |
|
| BGOS-941 | Вычисляемое поле `PoolName` в структуру ответа `SnapshotExtend` в cloudapi/compute |
|
||||||
|
| BGOS-941 | Вычисляемое поле `PoolName` в структуру ответа `ItemSnapshotDetailed` в cloudbroker/compute |
|
||||||
|
| BGOS-942 | Вычилсяемое поле `MachineID` в структуру ответа `ItemNode` в cloudbroker/node |
|
||||||
|
|
||||||
#### node
|
#### disks
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-919 | Вычисляемое поле `MaxSupportedGeneration` в структуру ответа `CpuInfo` в cloudbroker/node |
|
| BGOS-940 | Вычисляемое поле `PoolName` в структуру ответа `ItemSnapshot` в cloudapi/disks и cloudbroker/disks |
|
||||||
|
|
||||||
#### zone
|
#### grid
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-914 | Вычисляемые поля `ID`, `Name` и `ConsumedBy` в структуру ответа `RecordConsumption` в cloudbroker/sep |
|
| BGOS-925 | Вычисляемые поля `ReservedCPU` и `ReservedRAM` в структуры ответа `RecordGrid` и `ItemGridList` в cloudbroker/grid |
|
||||||
| BGOS-914 | Структура ответа `ListConsumption` в cloudbroker/sep |
|
|
||||||
|
|
||||||
|
#### rg
|
||||||
### Изменено
|
|
||||||
|
|
||||||
#### account
|
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-918 | Тип обязательного поля `Ratio` с `float64` на `uint64` в структуре запроса `SetCPUAllocationRatioRequest` в cloudbroker/account |
|
| BGOS-944 | Опциональное поле `EnableDefaultGateway` в структуру запроса `CreateRequest` в cloudapi/rg и cloudbroker/rg |
|
||||||
|
|
||||||
#### SEP
|
### Удалено
|
||||||
|
|
||||||
|
#### grid
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-914 | Тип поля `SEPID` с обязательного на опциональный в структуре запроса `ConsumptionRequest` в cloudbroker/sep |
|
| BGOS-925 | Поля `CPUAllocationRatio`, `CPUAllocationRatioVM`, `CustomBackupPath` и `Networks` из структуры ответа `RecordSettingsGrid` в cloudbroker/grid |
|
||||||
| BGOS-914 | Тип ответа метода `Consumption` с `RecordConsumption` на `ListConsumption` в cloudbroker/sep |
|
|
||||||
|
|||||||
@@ -182,6 +182,9 @@ type RecordNetAttach struct {
|
|||||||
// Enabled
|
// Enabled
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
|
|
||||||
|
// Enable default gateway
|
||||||
|
EnableDefaultGateway bool `json:"enable_default_gateway"`
|
||||||
|
|
||||||
// Enable security groups
|
// Enable security groups
|
||||||
EnableSecGroups bool `json:"enable_secgroups"`
|
EnableSecGroups bool `json:"enable_secgroups"`
|
||||||
|
|
||||||
@@ -479,6 +482,9 @@ type RecordCompute struct {
|
|||||||
// Natable VINS network name
|
// Natable VINS network name
|
||||||
NatableVINSNetworkName string `json:"natableVinsNetworkName"`
|
NatableVINSNetworkName string `json:"natableVinsNetworkName"`
|
||||||
|
|
||||||
|
// Node ID
|
||||||
|
NodeID uint64 `json:"node_id"`
|
||||||
|
|
||||||
// Name of OS
|
// Name of OS
|
||||||
OSVersion string `json:"os_version"`
|
OSVersion string `json:"os_version"`
|
||||||
|
|
||||||
@@ -565,6 +571,261 @@ type RecordCompute struct {
|
|||||||
ZoneID uint64 `json:"zoneId"`
|
ZoneID uint64 `json:"zoneId"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SnapRecordCompute struct {
|
||||||
|
// Access Control List
|
||||||
|
ACL ListACL `json:"acl"`
|
||||||
|
|
||||||
|
// Account ID
|
||||||
|
AccountID uint64 `json:"accountId"`
|
||||||
|
|
||||||
|
// Account name
|
||||||
|
AccountName string `json:"accountName"`
|
||||||
|
|
||||||
|
// Affinity label
|
||||||
|
AffinityLabel string `json:"affinityLabel"`
|
||||||
|
|
||||||
|
// List affinity rules
|
||||||
|
AffinityRules ListRules `json:"affinityRules"`
|
||||||
|
|
||||||
|
// Affinity weight
|
||||||
|
AffinityWeight uint64 `json:"affinityWeight"`
|
||||||
|
|
||||||
|
// List anti affinity rules
|
||||||
|
AntiAffinityRules ListRules `json:"antiAffinityRules"`
|
||||||
|
|
||||||
|
// Auto start when node restarted
|
||||||
|
AutoStart bool `json:"autoStart"`
|
||||||
|
|
||||||
|
// Architecture
|
||||||
|
Architecture string `json:"arch"`
|
||||||
|
|
||||||
|
// Boot image ID
|
||||||
|
BootImageID uint64 `json:"boot_image_id"`
|
||||||
|
|
||||||
|
// Boot order
|
||||||
|
BootOrder []string `json:"bootOrder"`
|
||||||
|
|
||||||
|
// Boot type
|
||||||
|
BootType string `json:"bootType"`
|
||||||
|
|
||||||
|
// Boot disk size
|
||||||
|
BootDiskSize uint64 `json:"bootdiskSize"`
|
||||||
|
|
||||||
|
// CD Image Id
|
||||||
|
CdImageId uint64 `json:"cdImageId"`
|
||||||
|
|
||||||
|
// Chipset
|
||||||
|
Chipset string `json:"chipset"`
|
||||||
|
|
||||||
|
// Clone reference
|
||||||
|
CloneReference uint64 `json:"cloneReference"`
|
||||||
|
|
||||||
|
// List clone IDs
|
||||||
|
Clones []uint64 `json:"clones"`
|
||||||
|
|
||||||
|
// Clock
|
||||||
|
Clock string `json:"clock"`
|
||||||
|
|
||||||
|
// Compute CI ID
|
||||||
|
ComputeCIID uint64 `json:"computeciId"`
|
||||||
|
|
||||||
|
// CPU Pin
|
||||||
|
CPUPin bool `json:"cpupin"`
|
||||||
|
|
||||||
|
// Number of cores
|
||||||
|
CPU uint64 `json:"cpus"`
|
||||||
|
|
||||||
|
// Created by
|
||||||
|
CreatedBy string `json:"createdBy"`
|
||||||
|
|
||||||
|
// Created time
|
||||||
|
CreatedTime uint64 `json:"createdTime"`
|
||||||
|
|
||||||
|
// Custom fields items
|
||||||
|
CustomFields map[string]interface{} `json:"customFields"`
|
||||||
|
|
||||||
|
// Deleted by
|
||||||
|
DeletedBy string `json:"deletedBy"`
|
||||||
|
|
||||||
|
// Deleted time
|
||||||
|
DeletedTime uint64 `json:"deletedTime"`
|
||||||
|
|
||||||
|
// Description
|
||||||
|
Description string `json:"desc"`
|
||||||
|
|
||||||
|
// Devices
|
||||||
|
Devices interface{} `json:"devices"`
|
||||||
|
|
||||||
|
// List disks in compute
|
||||||
|
Disks ListComputeDisks `json:"disks"`
|
||||||
|
|
||||||
|
// Driver
|
||||||
|
Driver string `json:"driver"`
|
||||||
|
|
||||||
|
// Grid ID
|
||||||
|
GID uint64 `json:"gid"`
|
||||||
|
|
||||||
|
// GUID
|
||||||
|
GUID uint64 `json:"guid"`
|
||||||
|
|
||||||
|
// HPBacked
|
||||||
|
HPBacked bool `json:"hpBacked"`
|
||||||
|
|
||||||
|
// Hot resize
|
||||||
|
HotResize bool `json:"hotResize"`
|
||||||
|
|
||||||
|
// ID
|
||||||
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
|
// Image ID
|
||||||
|
ImageID uint64 `json:"imageId"`
|
||||||
|
|
||||||
|
// Image name
|
||||||
|
ImageName string `json:"imageName"`
|
||||||
|
|
||||||
|
// List interfaces
|
||||||
|
Interfaces ListInterfaces `json:"interfaces"`
|
||||||
|
|
||||||
|
// Loader meta iso information
|
||||||
|
LoaderMetaIso LoaderMetaIso `json:"loaderMetaIso"`
|
||||||
|
|
||||||
|
// Live migration job ID
|
||||||
|
LiveMigrationJobID uint64 `json:"live_migration_job_id"`
|
||||||
|
|
||||||
|
// Loader type
|
||||||
|
LoaderType string `json:"loaderType"`
|
||||||
|
|
||||||
|
// Lock status
|
||||||
|
LockStatus string `json:"lockStatus"`
|
||||||
|
|
||||||
|
// Manager ID
|
||||||
|
ManagerID uint64 `json:"managerId"`
|
||||||
|
|
||||||
|
// Manager type
|
||||||
|
ManagerType string `json:"managerType"`
|
||||||
|
|
||||||
|
// Migration job
|
||||||
|
MigrationJob uint64 `json:"migrationjob"`
|
||||||
|
|
||||||
|
// Milestones
|
||||||
|
Milestones uint64 `json:"milestones"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// NeedReboot
|
||||||
|
NeedReboot bool `json:"needReboot"`
|
||||||
|
|
||||||
|
// Network interface naming
|
||||||
|
NetworkInterfaceNaming string `json:"networkInterfaceNaming"`
|
||||||
|
|
||||||
|
// Numa Affinity
|
||||||
|
NumaAffinity string `json:"numaAffinity"`
|
||||||
|
|
||||||
|
//NumaNodeId
|
||||||
|
NumaNodeId int64 `json:"numaNodeId"`
|
||||||
|
|
||||||
|
// Natable VINS ID
|
||||||
|
NatableVINSID uint64 `json:"natableVinsId"`
|
||||||
|
|
||||||
|
// Natable VINS IP
|
||||||
|
NatableVINSIP string `json:"natableVinsIp"`
|
||||||
|
|
||||||
|
// Natable VINS Name
|
||||||
|
NatableVINSName string `json:"natableVinsName"`
|
||||||
|
|
||||||
|
// Natable VINS network
|
||||||
|
NatableVINSNetwork string `json:"natableVinsNetwork"`
|
||||||
|
|
||||||
|
// Natable VINS network name
|
||||||
|
NatableVINSNetworkName string `json:"natableVinsNetworkName"`
|
||||||
|
|
||||||
|
// Name of OS
|
||||||
|
OSVersion string `json:"os_version"`
|
||||||
|
|
||||||
|
// List OS Users
|
||||||
|
OSUsers ListOSUser `json:"osUsers"`
|
||||||
|
|
||||||
|
// Pinned to node
|
||||||
|
PinnedToNode int64 `json:"pinnedToNode"`
|
||||||
|
|
||||||
|
// PreferredCPU
|
||||||
|
PreferredCPU []int64 `json:"preferredCpu"`
|
||||||
|
|
||||||
|
// CPU alignment profile
|
||||||
|
CPUAlignmentProfile CPUAlignmentProfile `json:"cpu_alignment_profile"`
|
||||||
|
|
||||||
|
// 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"`
|
||||||
|
|
||||||
|
// Reference ID
|
||||||
|
ReferenceID string `json:"referenceId"`
|
||||||
|
|
||||||
|
// Registered or not
|
||||||
|
Registered bool `json:"registered"`
|
||||||
|
|
||||||
|
// Resource name
|
||||||
|
ResName string `json:"resName"`
|
||||||
|
|
||||||
|
// Reserved Node Cpus
|
||||||
|
ReservedNodeCpus []uint64 `json:"reservedNodeCpus"`
|
||||||
|
|
||||||
|
// Resource group ID
|
||||||
|
RGID uint64 `json:"rgId"`
|
||||||
|
|
||||||
|
// Resource group name
|
||||||
|
RGName string `json:"rgName"`
|
||||||
|
|
||||||
|
// List snapsets
|
||||||
|
SnapSets ListSnapSets `json:"snapSets"`
|
||||||
|
|
||||||
|
// Stateless SepID
|
||||||
|
StatelessSepID int64 `json:"statelessSepId"`
|
||||||
|
|
||||||
|
// Stateless SepType
|
||||||
|
StatelessSepType string `json:"statelessSepType"`
|
||||||
|
|
||||||
|
// Status
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Tags
|
||||||
|
Tags map[string]string `json:"tags"`
|
||||||
|
|
||||||
|
// Tech status
|
||||||
|
TechStatus string `json:"techStatus"`
|
||||||
|
|
||||||
|
// Updated by
|
||||||
|
UpdatedBy string `json:"updatedBy"`
|
||||||
|
|
||||||
|
// Updated time
|
||||||
|
UpdatedTime uint64 `json:"updatedTime"`
|
||||||
|
|
||||||
|
// User Managed or not
|
||||||
|
UserManaged bool `json:"userManaged"`
|
||||||
|
|
||||||
|
// Userdata
|
||||||
|
Userdata interface{} `json:"userdata"`
|
||||||
|
|
||||||
|
// vGPUs list
|
||||||
|
VGPUs []VGPUItem `json:"vgpus"`
|
||||||
|
|
||||||
|
// VNC password
|
||||||
|
VNCPassword string `json:"vncPasswd"`
|
||||||
|
|
||||||
|
// Weight
|
||||||
|
Weight uint64 `json:"weight"`
|
||||||
|
|
||||||
|
// Zone ID
|
||||||
|
// Required: false
|
||||||
|
ZoneID uint64 `json:"zoneId"`
|
||||||
|
}
|
||||||
|
|
||||||
type LoaderMetaIso struct {
|
type LoaderMetaIso struct {
|
||||||
// Name
|
// Name
|
||||||
DeviceName string `json:"devicename"`
|
DeviceName string `json:"devicename"`
|
||||||
@@ -691,7 +952,7 @@ type ListOSUser []ItemOSUser
|
|||||||
// Main information about snapsets
|
// Main information about snapsets
|
||||||
type ItemSnapSet struct {
|
type ItemSnapSet struct {
|
||||||
// Compute info
|
// Compute info
|
||||||
Compute RecordCompute `json:"compute"`
|
Compute SnapRecordCompute `json:"compute"`
|
||||||
|
|
||||||
// List disk ID
|
// List disk ID
|
||||||
Disks []uint64 `json:"disks"`
|
Disks []uint64 `json:"disks"`
|
||||||
@@ -729,6 +990,9 @@ type ItemVNFInterface struct {
|
|||||||
// Enabled
|
// Enabled
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
|
|
||||||
|
// Enable default gateway
|
||||||
|
EnableDefaultGateway bool `json:"enable_default_gateway"`
|
||||||
|
|
||||||
// Enable security groups
|
// Enable security groups
|
||||||
EnableSecGroups bool `json:"enable_secgroups"`
|
EnableSecGroups bool `json:"enable_secgroups"`
|
||||||
|
|
||||||
@@ -996,6 +1260,9 @@ type SnapshotExtend struct {
|
|||||||
// Label
|
// Label
|
||||||
Label string `json:"label"`
|
Label string `json:"label"`
|
||||||
|
|
||||||
|
// Pool name
|
||||||
|
PoolName string `json:"poolName"`
|
||||||
|
|
||||||
// Reference ID
|
// Reference ID
|
||||||
ReferenceID string `json:"referenceId"`
|
ReferenceID string `json:"referenceId"`
|
||||||
|
|
||||||
@@ -1191,6 +1458,9 @@ type ItemCompute struct {
|
|||||||
// Name
|
// Name
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// Node ID
|
||||||
|
NodeID uint64 `json:"node_id"`
|
||||||
|
|
||||||
// NeedReboot
|
// NeedReboot
|
||||||
NeedReboot bool `json:"needReboot"`
|
NeedReboot bool `json:"needReboot"`
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,11 @@ type NetAttachRequest struct {
|
|||||||
// Flag indicating whether this interface is enabled (only for VINS, EXTNET, DPDK, SDN, TRUNK)
|
// Flag indicating whether this interface is enabled (only for VINS, EXTNET, DPDK, SDN, TRUNK)
|
||||||
// Required: false
|
// Required: false
|
||||||
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
|
// Flag indicating whether default gateway is enabled for this interface
|
||||||
|
// Required: false
|
||||||
|
// Default: true
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type wrapperNetAttachRequest struct {
|
type wrapperNetAttachRequest struct {
|
||||||
|
|||||||
@@ -331,6 +331,10 @@ type ItemSnapshot struct {
|
|||||||
// Label
|
// Label
|
||||||
Label string `json:"label"`
|
Label string `json:"label"`
|
||||||
|
|
||||||
|
// Pool name
|
||||||
|
PoolName string `json:"poolName"`
|
||||||
|
|
||||||
|
// Reference ID
|
||||||
ReferenceID string `json:"referenceId"`
|
ReferenceID string `json:"referenceId"`
|
||||||
|
|
||||||
// Resource ID
|
// Resource ID
|
||||||
|
|||||||
@@ -76,6 +76,11 @@ type Interface struct {
|
|||||||
// Flag indicating whether this interface is enabled (only for VINS, EXTNET, DPDK, SDN, TRUNK)
|
// Flag indicating whether this interface is enabled (only for VINS, EXTNET, DPDK, SDN, TRUNK)
|
||||||
// Required: false
|
// Required: false
|
||||||
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
|
// Flag indicating whether default gateway are enabled for this interface, not applicable to netType EXTNET, VFNIC, TRUNK, or SDN
|
||||||
|
// Default: true
|
||||||
|
// Required: false
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DataDisk detailed struct for DataDisks field in CreateRequest and CreateBlankRequest
|
// DataDisk detailed struct for DataDisks field in CreateRequest and CreateBlankRequest
|
||||||
|
|||||||
@@ -76,6 +76,10 @@ type CreateRequest struct {
|
|||||||
// SDN access group id
|
// SDN access group id
|
||||||
// Required: false
|
// Required: false
|
||||||
SDNAccessGroupID string `url:"sdn_access_group_id,omitempty" json:"sdn_access_group_id,omitempty"`
|
SDNAccessGroupID string `url:"sdn_access_group_id,omitempty" json:"sdn_access_group_id,omitempty"`
|
||||||
|
|
||||||
|
// Enabling default gateway
|
||||||
|
// Required: false
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type StoragePolicy struct {
|
type StoragePolicy struct {
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package vins
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -62,11 +62,11 @@ type CreateInAccountRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
// Default: false
|
// Default: false
|
||||||
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
|
||||||
|
|
||||||
type wrapperCreateRequestInAcc struct {
|
// Flag indicating whether default gateway is enabled for this VINS
|
||||||
CreateInAccountRequest
|
// Required: false
|
||||||
Routes []string `url:"routes,omitempty"`
|
// Default: true
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateInAccount creates VINS in account level
|
// CreateInAccount creates VINS in account level
|
||||||
@@ -76,31 +76,9 @@ func (v VINS) CreateInAccount(ctx context.Context, req CreateInAccountRequest) (
|
|||||||
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
var routes []string
|
|
||||||
|
|
||||||
if len(req.Routes) != 0 {
|
|
||||||
routes = make([]string, 0, len(req.Routes))
|
|
||||||
|
|
||||||
for r := range req.Routes {
|
|
||||||
b, err := json.Marshal(req.Routes[r])
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
|
|
||||||
routes = append(routes, string(b))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
routes = []string{}
|
|
||||||
}
|
|
||||||
|
|
||||||
reqWrapped := wrapperCreateRequestInAcc{
|
|
||||||
CreateInAccountRequest: req,
|
|
||||||
Routes: routes,
|
|
||||||
}
|
|
||||||
|
|
||||||
url := "/cloudapi/vins/createInAccount"
|
url := "/cloudapi/vins/createInAccount"
|
||||||
|
|
||||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package vins
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -56,11 +56,11 @@ type CreateInRGRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
// Default: false
|
// Default: false
|
||||||
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
|
||||||
|
|
||||||
type wrapperCreateRequestInRG struct {
|
// Flag indicating whether default gateway is enabled for this VINS
|
||||||
CreateInRGRequest
|
// Required: false
|
||||||
Routes []string `url:"routes,omitempty"`
|
// Default: true
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateInRG creates VINS in resource group level
|
// CreateInRG creates VINS in resource group level
|
||||||
@@ -70,31 +70,9 @@ func (v VINS) CreateInRG(ctx context.Context, req CreateInRGRequest) (uint64, er
|
|||||||
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
var routes []string
|
|
||||||
|
|
||||||
if len(req.Routes) != 0 {
|
|
||||||
routes = make([]string, 0, len(req.Routes))
|
|
||||||
|
|
||||||
for r := range req.Routes {
|
|
||||||
b, err := json.Marshal(req.Routes[r])
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
|
|
||||||
routes = append(routes, string(b))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
routes = []string{}
|
|
||||||
}
|
|
||||||
|
|
||||||
reqWrapped := wrapperCreateRequestInRG{
|
|
||||||
CreateInRGRequest: req,
|
|
||||||
Routes: routes,
|
|
||||||
}
|
|
||||||
|
|
||||||
url := "/cloudapi/vins/createInRG"
|
url := "/cloudapi/vins/createInRG"
|
||||||
|
|
||||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -694,6 +694,9 @@ type RecordVINS struct {
|
|||||||
// Description
|
// Description
|
||||||
Description string `json:"desc"`
|
Description string `json:"desc"`
|
||||||
|
|
||||||
|
// Enable Default Gateway
|
||||||
|
EnableDefaultGateway bool `json:"enable_default_gateway"`
|
||||||
|
|
||||||
// Enable Security Groups
|
// Enable Security Groups
|
||||||
EnableSecGroups bool `json:"enable_secgroups"`
|
EnableSecGroups bool `json:"enable_secgroups"`
|
||||||
|
|
||||||
|
|||||||
@@ -111,6 +111,12 @@ type RecordZone struct {
|
|||||||
|
|
||||||
// CPU alignment profiles
|
// CPU alignment profiles
|
||||||
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
|
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
|
||||||
|
|
||||||
|
// Reserved CPU
|
||||||
|
ReservedCPU uint64 `json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Reserved RAM
|
||||||
|
ReservedRAM uint64 `json:"reserved_ram"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// A zone item from a list
|
// A zone item from a list
|
||||||
@@ -183,4 +189,10 @@ type ItemZone struct {
|
|||||||
|
|
||||||
// CPU alignment profiles
|
// CPU alignment profiles
|
||||||
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
|
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
|
||||||
|
|
||||||
|
// Reserved CPU
|
||||||
|
ReservedCPU uint64 `json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Reserved RAM
|
||||||
|
ReservedRAM uint64 `json:"reserved_ram"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,6 +148,9 @@ type RecordNetAttach struct {
|
|||||||
// Enabled
|
// Enabled
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
|
|
||||||
|
// Enable default gateway
|
||||||
|
EnableDefaultGateway bool `json:"enable_default_gateway"`
|
||||||
|
|
||||||
// Enable security groups
|
// Enable security groups
|
||||||
EnableSecGroups bool `json:"enable_secgroups"`
|
EnableSecGroups bool `json:"enable_secgroups"`
|
||||||
|
|
||||||
@@ -367,6 +370,9 @@ type ItemSnapshotDetailed struct {
|
|||||||
// Label
|
// Label
|
||||||
Label string `json:"label"`
|
Label string `json:"label"`
|
||||||
|
|
||||||
|
// Pool name
|
||||||
|
PoolName string `json:"poolName"`
|
||||||
|
|
||||||
// Resource ID
|
// Resource ID
|
||||||
ResID string `json:"resId"`
|
ResID string `json:"resId"`
|
||||||
|
|
||||||
@@ -597,6 +603,9 @@ type ItemInterface struct {
|
|||||||
// Enabled
|
// Enabled
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
|
|
||||||
|
// Enable default gateway
|
||||||
|
EnableDefaultGateway bool `json:"enable_default_gateway"`
|
||||||
|
|
||||||
// Enable security groups
|
// Enable security groups
|
||||||
EnableSecGroups bool `json:"enable_secgroups"`
|
EnableSecGroups bool `json:"enable_secgroups"`
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,11 @@ type NetAttachRequest struct {
|
|||||||
// Flag indicating whether this interface is enabled (only for VINS, EXTNET, DPDK, SDN, TRUNK)
|
// Flag indicating whether this interface is enabled (only for VINS, EXTNET, DPDK, SDN, TRUNK)
|
||||||
// Required: false
|
// Required: false
|
||||||
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
|
// Flag indicating whether default gateway is enabled for this interface
|
||||||
|
// Required: false
|
||||||
|
// Default: true
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type wrapperNetAttachRequest struct {
|
type wrapperNetAttachRequest struct {
|
||||||
|
|||||||
@@ -309,6 +309,9 @@ type ItemSnapshot struct {
|
|||||||
// Label
|
// Label
|
||||||
Label string `json:"label"`
|
Label string `json:"label"`
|
||||||
|
|
||||||
|
// Pool name
|
||||||
|
PoolName string `json:"poolName"`
|
||||||
|
|
||||||
// Reference ID
|
// Reference ID
|
||||||
ReferenceID string `json:"referenceId"`
|
ReferenceID string `json:"referenceId"`
|
||||||
|
|
||||||
@@ -343,4 +346,7 @@ type MigrateStatus struct {
|
|||||||
|
|
||||||
// Progress percent
|
// Progress percent
|
||||||
ProgressPercent int `json:"progress_percent"`
|
ProgressPercent int `json:"progress_percent"`
|
||||||
|
|
||||||
|
// Operation status
|
||||||
|
Ready bool `json:"ready"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,12 @@ type RecordGrid struct {
|
|||||||
// Network modes
|
// Network modes
|
||||||
NetworkModes []string `json:"network_modes"`
|
NetworkModes []string `json:"network_modes"`
|
||||||
|
|
||||||
|
// Reserved CPU
|
||||||
|
ReservedCPU uint64 `json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Reserved RAM
|
||||||
|
ReservedRAM uint64 `json:"reserved_ram"`
|
||||||
|
|
||||||
// SDN support
|
// SDN support
|
||||||
SDNSupport bool `json:"sdn_support"`
|
SDNSupport bool `json:"sdn_support"`
|
||||||
|
|
||||||
@@ -139,6 +145,12 @@ type ItemGridList struct {
|
|||||||
// Network modes
|
// Network modes
|
||||||
NetworkModes []string `json:"network_modes"`
|
NetworkModes []string `json:"network_modes"`
|
||||||
|
|
||||||
|
// Reserved CPU
|
||||||
|
ReservedCPU uint64 `json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Reserved RAM
|
||||||
|
ReservedRAM uint64 `json:"reserved_ram"`
|
||||||
|
|
||||||
// SDN support
|
// SDN support
|
||||||
SDNSupport bool `json:"sdn_support"`
|
SDNSupport bool `json:"sdn_support"`
|
||||||
|
|
||||||
@@ -175,15 +187,6 @@ type RecordSettingsGrid struct {
|
|||||||
//Cleanup retention period
|
//Cleanup retention period
|
||||||
CleanupRetentionPeriod uint64 `json:"cleanupRetentionPeriod"`
|
CleanupRetentionPeriod uint64 `json:"cleanupRetentionPeriod"`
|
||||||
|
|
||||||
// CPU allocation ratio
|
|
||||||
CPUAllocationRatio uint64 `json:"cpu_allocation_ratio"`
|
|
||||||
|
|
||||||
// CPU allocation ratio for VMs
|
|
||||||
CPUAllocationRatioVM uint64 `json:"cpu_allocation_ratio_vm"`
|
|
||||||
|
|
||||||
// Custom backup path
|
|
||||||
CustomBackupPath []string `json:"custom_backup_path"`
|
|
||||||
|
|
||||||
//Docker registry
|
//Docker registry
|
||||||
DockerRegistry DockerRegistry `json:"docker_registry"`
|
DockerRegistry DockerRegistry `json:"docker_registry"`
|
||||||
|
|
||||||
@@ -214,9 +217,6 @@ type RecordSettingsGrid struct {
|
|||||||
//Net QOS
|
//Net QOS
|
||||||
NetQOS NetQOS `json:"net_qos"`
|
NetQOS NetQOS `json:"net_qos"`
|
||||||
|
|
||||||
//Networks
|
|
||||||
Networks string `json:"networks"`
|
|
||||||
|
|
||||||
// Node self stop timer uptime monitor
|
// Node self stop timer uptime monitor
|
||||||
NodeSelfStopTimerUptimeMonitor uint64 `json:"nodeSelfStopTimerUptimeMonitor"`
|
NodeSelfStopTimerUptimeMonitor uint64 `json:"nodeSelfStopTimerUptimeMonitor"`
|
||||||
|
|
||||||
|
|||||||
44
pkg/cloudbroker/grid/set_resources_limit.go
Normal file
44
pkg/cloudbroker/grid/set_resources_limit.go
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
package grid
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// SetResourcesLimitRequest struct to set resources limit
|
||||||
|
type SetResourcesLimitRequest struct {
|
||||||
|
// ID of the grid
|
||||||
|
// Required: true
|
||||||
|
GID uint64 `url:"grid_id" json:"grid_id" validate:"required"`
|
||||||
|
|
||||||
|
// Number of CPU cores reserved
|
||||||
|
// Default: 0
|
||||||
|
// Required: true
|
||||||
|
ReservedCPU uint64 `url:"reserved_cpu" json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Amount of RAM in MB reserved
|
||||||
|
// Default: 0
|
||||||
|
// Required: true
|
||||||
|
ReservedRAM uint64 `url:"reserved_ram" json:"reserved_ram"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetResourcesLimit sets reserved CPU and RAM limits for the grid
|
||||||
|
func (g Grid) SetResourcesLimit(ctx context.Context, req SetResourcesLimitRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/grid/set_resources_limit"
|
||||||
|
|
||||||
|
res, err := g.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return strconv.ParseBool(string(res))
|
||||||
|
}
|
||||||
@@ -59,6 +59,11 @@ type Interface struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
|
// Flag indicating whether default gateway are enabled for this interface, not applicable to netType EXTNET, VFNIC, TRUNK, or SDN
|
||||||
|
// Default: true
|
||||||
|
// Required: false
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
// SDN Segment ID
|
// SDN Segment ID
|
||||||
// Required: false
|
// Required: false
|
||||||
SDNSegmentID string `url:"sdn_segment_id,omitempty" json:"sdn_segment_id,omitempty"`
|
SDNSegmentID string `url:"sdn_segment_id,omitempty" json:"sdn_segment_id,omitempty"`
|
||||||
|
|||||||
@@ -56,6 +56,11 @@ type InterfaceMassCreate struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
|
// Flag indicating whether default gateway are enabled for this interface, not applicable to netType EXTNET, VFNIC, TRUNK, or SDN
|
||||||
|
// Default: true
|
||||||
|
// Required: false
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
// SDN Segment ID
|
// SDN Segment ID
|
||||||
// Required: false
|
// Required: false
|
||||||
SDNSegmentID string `url:"sdn_segment_id,omitempty" json:"sdn_segment_id,omitempty"`
|
SDNSegmentID string `url:"sdn_segment_id,omitempty" json:"sdn_segment_id,omitempty"`
|
||||||
|
|||||||
@@ -50,6 +50,12 @@ type RecordNode struct {
|
|||||||
// ReservedCPUs
|
// ReservedCPUs
|
||||||
ReservedCPUs []interface{} `json:"reservedCpus"`
|
ReservedCPUs []interface{} `json:"reservedCpus"`
|
||||||
|
|
||||||
|
// Reserved CPU
|
||||||
|
ReservedCPU uint64 `json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Reserved RAM
|
||||||
|
ReservedRAM uint64 `json:"reserved_ram"`
|
||||||
|
|
||||||
// Roles
|
// Roles
|
||||||
Roles []string `json:"roles"`
|
Roles []string `json:"roles"`
|
||||||
|
|
||||||
@@ -203,6 +209,9 @@ type ItemNode struct {
|
|||||||
// Last check
|
// Last check
|
||||||
LastCheck uint64 `json:"lastcheck"`
|
LastCheck uint64 `json:"lastcheck"`
|
||||||
|
|
||||||
|
// Machine ID
|
||||||
|
MachineID string `json:"machine_id"`
|
||||||
|
|
||||||
// Machine GUID
|
// Machine GUID
|
||||||
MachineGUID string `json:"machineguid"`
|
MachineGUID string `json:"machineguid"`
|
||||||
|
|
||||||
@@ -260,6 +269,12 @@ type ItemNode struct {
|
|||||||
// ReservedCPUs
|
// ReservedCPUs
|
||||||
ReservedCPUs []interface{} `json:"reservedCpus"`
|
ReservedCPUs []interface{} `json:"reservedCpus"`
|
||||||
|
|
||||||
|
// Reserved CPU
|
||||||
|
ReservedCPU uint64 `json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Reserved RAM
|
||||||
|
ReservedRAM uint64 `json:"reserved_ram"`
|
||||||
|
|
||||||
// Roles
|
// Roles
|
||||||
Roles []string `json:"roles"`
|
Roles []string `json:"roles"`
|
||||||
|
|
||||||
|
|||||||
42
pkg/cloudbroker/node/set_resources_limit.go
Normal file
42
pkg/cloudbroker/node/set_resources_limit.go
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
package node
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// SetResourcesLimitRequest struct to set resources limit for node
|
||||||
|
type SetResourcesLimitRequest struct {
|
||||||
|
// Node ID
|
||||||
|
// Required: true
|
||||||
|
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
|
||||||
|
|
||||||
|
// Number of CPU cores reserved
|
||||||
|
// Required: true
|
||||||
|
ReservedCPU uint64 `url:"reserved_cpu" json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Amount of RAM in MB reserved
|
||||||
|
// Required: true
|
||||||
|
ReservedRAM uint64 `url:"reserved_ram" json:"reserved_ram"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetResourcesLimit sets reserved CPU and RAM limits for the node
|
||||||
|
func (n Node) SetResourcesLimit(ctx context.Context, req SetResourcesLimitRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/node/set_resources_limit"
|
||||||
|
|
||||||
|
res, err := n.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return strconv.ParseBool(string(res))
|
||||||
|
}
|
||||||
@@ -81,6 +81,10 @@ type CreateRequest struct {
|
|||||||
// SDN access group id
|
// SDN access group id
|
||||||
// Required: false
|
// Required: false
|
||||||
SDNAccessGroupID string `url:"sdn_access_group_id,omitempty" json:"sdn_access_group_id,omitempty"`
|
SDNAccessGroupID string `url:"sdn_access_group_id,omitempty" json:"sdn_access_group_id,omitempty"`
|
||||||
|
|
||||||
|
// Enabling default gateway
|
||||||
|
// Required: false
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type StoragePolicy struct {
|
type StoragePolicy struct {
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package vins
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -62,11 +62,11 @@ type CreateInAccountRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
// Default: false
|
// Default: false
|
||||||
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
|
||||||
|
|
||||||
type wrapperCreateRequestInAcc struct {
|
// Flag indicating whether default gateway is enabled for this VINS
|
||||||
CreateInAccountRequest
|
// Required: false
|
||||||
Routes []string `url:"routes,omitempty"`
|
// Default: true
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateInAccount creates VINS in account level
|
// CreateInAccount creates VINS in account level
|
||||||
@@ -76,31 +76,9 @@ func (v VINS) CreateInAccount(ctx context.Context, req CreateInAccountRequest) (
|
|||||||
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
var routes []string
|
|
||||||
|
|
||||||
if len(req.Routes) != 0 {
|
|
||||||
routes = make([]string, 0, len(req.Routes))
|
|
||||||
|
|
||||||
for r := range req.Routes {
|
|
||||||
b, err := json.Marshal(req.Routes[r])
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
|
|
||||||
routes = append(routes, string(b))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
routes = []string{"[]"}
|
|
||||||
}
|
|
||||||
|
|
||||||
reqWrapped := wrapperCreateRequestInAcc{
|
|
||||||
CreateInAccountRequest: req,
|
|
||||||
Routes: routes,
|
|
||||||
}
|
|
||||||
|
|
||||||
url := "/cloudbroker/vins/createInAccount"
|
url := "/cloudbroker/vins/createInAccount"
|
||||||
|
|
||||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package vins
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -56,11 +56,11 @@ type CreateInRGRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
// Default: false
|
// Default: false
|
||||||
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
|
||||||
|
|
||||||
type wrapperCreateRequestInRG struct {
|
// Flag indicating whether default gateway is enabled for this VINS
|
||||||
CreateInRGRequest
|
// Required: false
|
||||||
Routes []string `url:"routes,omitempty"`
|
// Default: true
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateInRG creates VINS in resource group level
|
// CreateInRG creates VINS in resource group level
|
||||||
@@ -69,31 +69,10 @@ func (v VINS) CreateInRG(ctx context.Context, req CreateInRGRequest) (uint64, er
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
var routes []string
|
|
||||||
|
|
||||||
if len(req.Routes) != 0 {
|
|
||||||
routes = make([]string, 0, len(req.Routes))
|
|
||||||
|
|
||||||
for r := range req.Routes {
|
|
||||||
b, err := json.Marshal(req.Routes[r])
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
|
|
||||||
routes = append(routes, string(b))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
routes = []string{"[]"}
|
|
||||||
}
|
|
||||||
|
|
||||||
reqWrapped := wrapperCreateRequestInRG{
|
|
||||||
CreateInRGRequest: req,
|
|
||||||
Routes: routes,
|
|
||||||
}
|
|
||||||
|
|
||||||
url := "/cloudbroker/vins/createInRG"
|
url := "/cloudbroker/vins/createInRG"
|
||||||
|
|
||||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -523,6 +523,9 @@ type RecordVINS struct {
|
|||||||
// Description
|
// Description
|
||||||
Description string `json:"desc"`
|
Description string `json:"desc"`
|
||||||
|
|
||||||
|
// Enable Default Gateway
|
||||||
|
EnableDefaultGateway bool `json:"enable_default_gateway"`
|
||||||
|
|
||||||
// Enable Security Groups
|
// Enable Security Groups
|
||||||
EnableSecGroups bool `json:"enable_secgroups"`
|
EnableSecGroups bool `json:"enable_secgroups"`
|
||||||
|
|
||||||
@@ -736,6 +739,9 @@ type ItemVINS struct {
|
|||||||
// Description
|
// Description
|
||||||
Description string `json:"desc"`
|
Description string `json:"desc"`
|
||||||
|
|
||||||
|
// Enable Default Gateway
|
||||||
|
EnableDefaultGateway bool `json:"enable_default_gateway"`
|
||||||
|
|
||||||
// Enable Security Groups
|
// Enable Security Groups
|
||||||
EnableSecGroups bool `json:"enable_secgroups"`
|
EnableSecGroups bool `json:"enable_secgroups"`
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ type UpdateRequest struct {
|
|||||||
// Flag indicating whether security groups are enabled for this network
|
// Flag indicating whether security groups are enabled for this network
|
||||||
// Required: false
|
// Required: false
|
||||||
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
|
// Flag indicating whether default gateway is enabled for this VINS
|
||||||
|
// Required: false
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update updates a vins parameters
|
// Update updates a vins parameters
|
||||||
|
|||||||
@@ -177,6 +177,12 @@ type RecordZone struct {
|
|||||||
|
|
||||||
// CPU alignment profiles
|
// CPU alignment profiles
|
||||||
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
|
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
|
||||||
|
|
||||||
|
// Reserved CPU
|
||||||
|
ReservedCPU uint64 `json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Reserved RAM
|
||||||
|
ReservedRAM uint64 `json:"reserved_ram"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// A zone item from a list
|
// A zone item from a list
|
||||||
@@ -249,4 +255,10 @@ type ItemZone struct {
|
|||||||
|
|
||||||
// CPU alignment profiles
|
// CPU alignment profiles
|
||||||
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
|
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
|
||||||
|
|
||||||
|
// Reserved CPU
|
||||||
|
ReservedCPU uint64 `json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Reserved RAM
|
||||||
|
ReservedRAM uint64 `json:"reserved_ram"`
|
||||||
}
|
}
|
||||||
|
|||||||
42
pkg/cloudbroker/zone/set_resources_limit.go
Normal file
42
pkg/cloudbroker/zone/set_resources_limit.go
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
package zone
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// SetResourcesLimitRequest struct to set resources limit
|
||||||
|
type SetResourcesLimitRequest struct {
|
||||||
|
// ID of the zone
|
||||||
|
// Required: true
|
||||||
|
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
|
||||||
|
|
||||||
|
// Number of CPU cores reserved
|
||||||
|
// Required: true
|
||||||
|
ReservedCPU uint64 `url:"reserved_cpu" json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Amount of RAM in MB reserved
|
||||||
|
// Required: true
|
||||||
|
ReservedRAM uint64 `url:"reserved_ram" json:"reserved_ram"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetResourcesLimit sets reserved CPU and RAM limits for the zone
|
||||||
|
func (e Zone) SetResourcesLimit(ctx context.Context, req SetResourcesLimitRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/zone/set_resources_limit"
|
||||||
|
|
||||||
|
res, err := e.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return strconv.ParseBool(string(res))
|
||||||
|
}
|
||||||
46
pkg/cloudbroker/zone/update_cpu_alignment_profile.go
Normal file
46
pkg/cloudbroker/zone/update_cpu_alignment_profile.go
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
package zone
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UpdateCPUAlignmentProfileRequest struct to update CPU alignment profile of zone
|
||||||
|
type UpdateCPUAlignmentProfileRequest struct {
|
||||||
|
// ID of zone
|
||||||
|
// Required: true
|
||||||
|
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
|
||||||
|
|
||||||
|
// Minimum percentage of hypervisors that must support the selected CPU model for the balanced profile
|
||||||
|
// Default: 70
|
||||||
|
// Required: false
|
||||||
|
HypervisorSimilarityInPercentage uint64 `url:"hypervisor_similarity_in_percentage,omitempty" json:"hypervisor_similarity_in_percentage,omitempty" validate:"omitempty,max=100"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateCPUAlignmentProfile updates CPU alignment profile of zone
|
||||||
|
func (e Zone) UpdateCPUAlignmentProfile(ctx context.Context, req UpdateCPUAlignmentProfileRequest) ([]CpuAlignmentProfile, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/zone/update_cpu_alignment_profile"
|
||||||
|
|
||||||
|
res, err := e.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var profiles []CpuAlignmentProfile
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &profiles)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return profiles, nil
|
||||||
|
}
|
||||||
@@ -30,7 +30,6 @@ func (m *migrator) Migrate(ctxOrigin context.Context, dxVMID, nodeID uint64) (bo
|
|||||||
req := compute.MigrateRequest{
|
req := compute.MigrateRequest{
|
||||||
ComputeID: dxVMID,
|
ComputeID: dxVMID,
|
||||||
TargetNodeID: nodeID,
|
TargetNodeID: nodeID,
|
||||||
Force: false,
|
|
||||||
}
|
}
|
||||||
ctx, cancel := context.WithTimeout(ctxOrigin, m.cfg.QueryTimeout)
|
ctx, cancel := context.WithTimeout(ctxOrigin, m.cfg.QueryTimeout)
|
||||||
ok, err := m.client.CloudBroker().Compute().Migrate(ctx, req)
|
ok, err := m.client.CloudBroker().Compute().Migrate(ctx, req)
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
|||||||
getResult("Compute list", bytes, compute.ListComputes{}, t)
|
getResult("Compute list", bytes, compute.ListComputes{}, t)
|
||||||
// Get
|
// Get
|
||||||
listComp, _ := client.CloudAPI().Compute().List(context.Background(), compute.ListRequest{})
|
listComp, _ := client.CloudAPI().Compute().List(context.Background(), compute.ListRequest{})
|
||||||
if len(listComp.Data) > 0 {
|
if listComp != nil && len(listComp.Data) > 0 {
|
||||||
id := listComp.Data[0].ID
|
id := listComp.Data[0].ID
|
||||||
bytes, err = client.CloudAPI().Compute().GetRaw(context.Background(), compute.GetRequest{ComputeID: id})
|
bytes, err = client.CloudAPI().Compute().GetRaw(context.Background(), compute.GetRequest{ComputeID: id})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -780,6 +780,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
|||||||
"/restmachine/cloudbroker/grid/setPasswordPolicy": grid_cb.SetPasswordPolicyRequest{},
|
"/restmachine/cloudbroker/grid/setPasswordPolicy": grid_cb.SetPasswordPolicyRequest{},
|
||||||
"/restmachine/cloudbroker/grid/status": EmptyStruct{},
|
"/restmachine/cloudbroker/grid/status": EmptyStruct{},
|
||||||
"/restmachine/cloudbroker/grid/getSettings": grid_cb.GetSettingsRequest{},
|
"/restmachine/cloudbroker/grid/getSettings": grid_cb.GetSettingsRequest{},
|
||||||
|
"/restmachine/cloudbroker/grid/set_resources_limit": grid_cb.SetResourcesLimitRequest{},
|
||||||
|
|
||||||
// group
|
// group
|
||||||
"/restmachine/cloudbroker/group/get": group_cb.GetRequest{},
|
"/restmachine/cloudbroker/group/get": group_cb.GetRequest{},
|
||||||
@@ -907,6 +908,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
|||||||
"/restmachine/cloudbroker/node/get_logical_cores_count": node_cb.GetLogicalCoresCountRequest{},
|
"/restmachine/cloudbroker/node/get_logical_cores_count": node_cb.GetLogicalCoresCountRequest{},
|
||||||
"/restmachine/cloudbroker/node/set_cpu_allocation_ratio": node_cb.SetCpuAllocationRatioRequest{},
|
"/restmachine/cloudbroker/node/set_cpu_allocation_ratio": node_cb.SetCpuAllocationRatioRequest{},
|
||||||
"/restmachine/cloudbroker/node/set_mem_allocation_ratio": node_cb.SetMemAllocationRatioRequest{},
|
"/restmachine/cloudbroker/node/set_mem_allocation_ratio": node_cb.SetMemAllocationRatioRequest{},
|
||||||
|
"/restmachine/cloudbroker/node/set_resources_limit": node_cb.SetResourcesLimitRequest{},
|
||||||
"/restmachine/cloudbroker/node/autostart": node_cb.AutoStartRequest{},
|
"/restmachine/cloudbroker/node/autostart": node_cb.AutoStartRequest{},
|
||||||
"/restmachine/cloudbroker/node/get_network_info": node_cb.GetNetworkInfoRequest{},
|
"/restmachine/cloudbroker/node/get_network_info": node_cb.GetNetworkInfoRequest{},
|
||||||
"/restmachine/cloudbroker/node/get_pci_devices": node_cb.GetPCIDevicesRequest{},
|
"/restmachine/cloudbroker/node/get_pci_devices": node_cb.GetPCIDevicesRequest{},
|
||||||
@@ -1124,6 +1126,8 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
|||||||
"/restmachine/cloudbroker/zone/get_cpu_alignment_profile": zone_cb.GetCPUAlignmentProfileRequest{},
|
"/restmachine/cloudbroker/zone/get_cpu_alignment_profile": zone_cb.GetCPUAlignmentProfileRequest{},
|
||||||
"/restmachine/cloudbroker/zone/list_cpu_alignment_profile": zone_cb.ListCPUAlignmentProfileRequest{},
|
"/restmachine/cloudbroker/zone/list_cpu_alignment_profile": zone_cb.ListCPUAlignmentProfileRequest{},
|
||||||
"/restmachine/cloudbroker/zone/test_cpu_alignment_profile": zone_cb.TestCPUAlignmentProfileRequest{},
|
"/restmachine/cloudbroker/zone/test_cpu_alignment_profile": zone_cb.TestCPUAlignmentProfileRequest{},
|
||||||
|
"/restmachine/cloudbroker/zone/set_resources_limit": zone_cb.SetResourcesLimitRequest{},
|
||||||
|
"/restmachine/cloudbroker/zone/update_cpu_alignment_profile": zone_cb.UpdateCPUAlignmentProfileRequest{},
|
||||||
|
|
||||||
// security policy
|
// security policy
|
||||||
"/sdn/security_policy/create": secpolicies.CreateRequest{},
|
"/sdn/security_policy/create": secpolicies.CreateRequest{},
|
||||||
|
|||||||
Reference in New Issue
Block a user