Compare commits

...

11 Commits

Author SHA1 Message Date
dayterr
c701001bb6 v1.14.2 2026-03-06 16:31:33 +03:00
dayterr
c2c810504d v1.14.1 2026-02-27 17:02:27 +03:00
dayterr
b834e5d074 v1.14.0 2026-02-20 17:08:59 +03:00
e1f0d354af v1.13.8 2026-02-11 12:22:01 +03:00
dayterr
d149ba19fd v1.13.7 2026-02-06 17:14:17 +03:00
c17b6f2336 v1.13.6 2026-01-30 16:47:43 +03:00
dayterr
b1fbd6872d v1.13.5 2026-01-26 11:21:34 +03:00
asteam
365a4991d2 v1.13.4 2026-01-16 16:52:26 +03:00
bb90a2d511 v1.13.3 2025-12-29 14:16:28 +03:00
dayterr
f111bf25fc v1.13.2 2025-12-23 17:39:58 +03:00
dayterr
055b256d6b v1.13.1 2025-12-16 14:22:57 +03:00
111 changed files with 1187 additions and 554 deletions

View File

@@ -1,68 +1,55 @@
## Version 1.13.0 ## Version 1.14.2
Методы `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 и в следующих версиях будут удалены, вместо них необходимо использовать метод `List` в cloudapi/audit и cloudbroker/audit с соответствующими фильтрами
Метод `ListNodes` в cloudbroker/image стал deprecated и в следующих версиях будет удалён
Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke`, `AccessRevokeToPool` в cloudbroker/sep стали deprecated и в следующих версиях будут удалены Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke`, `AccessRevokeToPool` в cloudbroker/sep стали deprecated и в следующих версиях будут удалены
Методы `ComputeCISet`, `ComputeCIUnset`, `GetAudits` в cloudbroker/computeGetAudits и `GetAudits` в cloudbroker/compute стали deprecated и будут удалены в следующих версиях | Методы `ComputeCISet`, `ComputeCIUnset`, `GetAudits` в cloudbroker/compute и `GetAudits` в cloudapi/compute стали deprecated и будут удалены в следующих версиях
Методы `ComputeCISet`, `ComputeCIUnset` в cloudbroker/image стали deprecated и будут удалены в следующих версиях
Все методы группы `.SDN()` находятся в альфа-версии. Все методы группы `.SDN()` находятся в альфа-версии.
### Добавлено ### Добавлено
#### kvmx86 #### account
| Идентификатор<br>задачи | Описание | | Идентификатор<br>задачи | Описание |
| --- | ---| | --- | --- |
| BGOS-665 | Опциональные поля `HPBacked`, `CPUPin`, `NumaAffinity` в структуру запроса `CreateBlankRequest` в cloudapi/kvmx86 и cloudbroker/kvmx86 | | BGOS-796 | Опциональное поле `CpuAllocationParameter` в структуру запроса `UpdateRequest` в cloudbroker/account |
| BGOS-790 | Вычисляемое поле `UpdatedBy` в структуру ответа `ItemAccount` в cloudapi/account |
#### node
| Идентификатор<br>задачи | Описание |
| --- | ---|
| BGOS-664 | Методы `GetLogicalCoresCount`, `SetCpuAllocationRatio`, `SetMemAllocationRatio` и структуры `GetLogicalCoresCountRequest`,`SetCpuAllocationRatioRequest`,`SetMemAllocationRatioRequest` в cloudbroker/node|
| BGOS-666 | Поля `OpenvSwitchBridges`, `Description`, `SDNHypervisorName` в структуру ответа `RecordNode` и поля `OpenvSwitchBridges`, `APIUrl`, `Drivers`, `OldCompatLVMID` в структуру ответа `ItemNode` в cloudbroker/node |
| BGOS-676 | Поля `Flags`, `ModelName`, в структуру ответа `CpuInfo` и поля `CPUAllocationRatio`, `MemAllocationRatio`, `Packages` в структуру ответа `ItemNode` в cloudbroker/node |
#### compute #### compute
| Идентификатор<br>задачи | Описание | | Идентификатор<br>задачи | Описание |
| --- | ---| | --- | --- |
| BGOS-675 | Метод `ChangeReadOnly` в cloudbroker/compute | | BGOS-793 | Вычисляемые поля `Aborted` и `BlockcopyAbortJobID` в структуру ответа `RecordCloneAbort` в cloudbroker/compute |
| BGOS-675 | Поле `ReadOnly` в структуру `InfoCompute`, `RecordCompute`, `ItemCompute` в cloudbroker/compute и cloudapi/compute | | BGOS-792 | Структуры ответа `RecordCloneAbort` и `ListCloneAbort` в cloudapi/compute |
| BGOS-791 | Вычисляемое поле `Independent` в структуру ответа `ItemComputeDisk` в cloudapi/compute и в структуру ответа `ItemDisk` в cloudbroker/compute |
#### disks
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-791 | Вычисляемое поле `Independent` в структуры ответа `ItemDisk` и `RecordDisk` в cloudapi/disks и в структуру ответа `RecordDisk` в cloudbroker/disks |
| BGOS-797 | Вычисляемые поля `ToClean` и `StoragePolicyID` в структуру ответа `ItemDiskUnattached` в cloudapi/disks |
#### image
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-791 | Вычисляемое поле `Independent` в структуру ответа `RecordImage` в cloudapi/image и в структуры ответа `RecordImage` и `ItemImage` в cloudbroker/image |
### Изменено ### Изменено
#### Общее #### compute
| Идентификатор<br>задачи | Описание | | Идентификатор<br>задачи | Описание |
| --- | --- | | --- | --- |
| BGOS-664 | StackID был заменен на NodeID | | BGOS-799 | Минимальное значение поля `MTU` в структуре запроса `NetAttachRequest` в cloudapi/compute и cloudbroker/compute с 1 на 1500 |
| BGOS-792 | Тип возвращаемого значения метода `CloneAbort` с `bool` на `ListCloneAbort` в cloudapi/compute |
#### node #### node
| Идентификатор<br>задачи | Описание | | Идентификатор<br>задачи | Описание |
| --- | ---| | --- | --- |
| BGOS-666 | Изменен json-тег поля `VCPU` на `vCPUs` в структуре `FreeResourcesInfo` в cloudbroker/node | | BGOS-789 | Дефолтное значение поля `Force` в структуре запроса `EnableRequest` в cloudbroker/node с `true` на `false` |
#### account
| Идентификатор<br>задачи | Описание |
| --- | ---|
| BGOS-667 | Валидатор `accountCUType` теперь допускает значения `CU_M`, `CU_C`, `CU_D`, `CU_DM`, `CU_I`, `gpu_units` |
#### compute
| Идентификатор<br>задачи | Описание |
| --- | ---|
| BGOS-683 | Изменен тип поля `StoragePolicyID` с required на optional в структурах запроса `RedeployRequest` в cloudapi/compute и cloudbroker/compute |
### Удалено ### Удалено
#### account #### compute
| Идентификатор<br>задачи | Описание |
| --- | ---|
| BGOS-667 | Поле `MaxNetworkPeerTransfer` из структур запросов `UpdateRequest` и `CreateRequest` в cloudapi/account и cloudbroker/account |
#### rg
| Идентификатор<br>задачи | Описание |
| --- | ---|
| BGOS-670 | Поля `MaxNetworkPeerTransfer` из структур запроса `CreateRequest` и `UpdateRequest`, поле `CUNP` из структуры`ResourceLimits` в cloudapi/rg и cloudbroker/rg |
#### stack
| Идентификатор<br>задачи | Описание | | Идентификатор<br>задачи | Описание |
| --- | --- | | --- | --- |
| BGOS-664 | Удалена группа stack | | BGOS-793 | Вычисляемое поле `Status` из структуры ответа `RecordCloneAbort` в cloudbroker/compute |

View File

@@ -18,6 +18,7 @@ Decort SDK - это библиотека, написанная на языке G
- Версия 1.11.х Decort-SDK соответствует 4.3.0 версии платформы - Версия 1.11.х Decort-SDK соответствует 4.3.0 версии платформы
- Версия 1.12.х Decort-SDK соответствует 4.4.0 версии платформы - Версия 1.12.х Decort-SDK соответствует 4.4.0 версии платформы
- Версия 1.13.х Decort-SDK соответствует 4.5.0 версии платформы - Версия 1.13.х Decort-SDK соответствует 4.5.0 версии платформы
- Версия 1.14.х Decort-SDK соответствует 4.6.0 версии платформы
## Оглавление ## Оглавление
@@ -466,16 +467,6 @@ type CreateRequest struct {
// Node ID // Node ID
// Required: false // Required: false
NodeID uint64 `url:"nodeId,omitempty" json:"nodeId,omitempty"` NodeID uint64 `url:"nodeId,omitempty" json:"nodeId,omitempty"`
// System name
// Required: false
IS string `url:"IS,omitempty" json:"IS,omitempty"`
// Compute purpose
// Required: false
IPAType string `url:"ipaType,omitempty" json:"ipaType,omitempty"`
} }
``` ```

View File

@@ -28,6 +28,7 @@ var FileName = map[string]string{
var K8sValues = []string{"labels", "taints", "annotations, additionalSANs"} var K8sValues = []string{"labels", "taints", "annotations, additionalSANs"}
var VersionMap = map[string]string{ var VersionMap = map[string]string{
"4.6.0": "-",
"4.5.0": "-", "4.5.0": "-",
"4.4.0": "-", "4.4.0": "-",
"4.3.0": "-", "4.3.0": "-",

View File

@@ -86,13 +86,6 @@ func computeModeValidator(fe validator.FieldLevel) bool {
return IsInSlice(fieldValue, computeModeValues) return IsInSlice(fieldValue, computeModeValues)
} }
// computeDiskTypeValidator is used to validate DiskType field.
func computeDiskTypeValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().String()
return IsInSlice(fieldValue, computeDiskTypeValues)
}
// computeNetTypeValidator is used to validate NetType field. // computeNetTypeValidator is used to validate NetType field.
func computeNetTypeValidator(fe validator.FieldLevel) bool { func computeNetTypeValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().String() fieldValue := fe.Field().String()
@@ -151,13 +144,6 @@ func computeDataDisksValidator(fe validator.FieldLevel) bool {
return IsInSlice(fieldValue, computeDataDisksValues) return IsInSlice(fieldValue, computeDataDisksValues)
} }
// diskTypeValidator is used to validate Type field.
func diskTypeValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().String()
return IsInSlice(fieldValue, diskTypeValues)
}
// flipgroupClientTypeValidator is used to validate ClientType field. // flipgroupClientTypeValidator is used to validate ClientType field.
func flipgroupClientTypeValidator(fe validator.FieldLevel) bool { func flipgroupClientTypeValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().String() fieldValue := fe.Field().String()
@@ -471,3 +457,10 @@ func addressPoolNetTypeValidator(fe validator.FieldLevel) bool {
return IsInSlice(fieldValue, addressPoolNetTypeValues) return IsInSlice(fieldValue, addressPoolNetTypeValues)
} }
// sepTechStatusValidator is used to validate SepTechStatus fields
func sepTechStatusValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().String()
return IsInSlice(fieldValue, sepTechStatusValues)
}

View File

@@ -86,12 +86,6 @@ func errorMessage(fe validator.FieldError) string {
fe.Field(), fe.Field(),
joinValues(computeModeValues)) joinValues(computeModeValues))
case "computeDiskType":
return fmt.Sprintf("%s %s must be one of the following: %s",
prefix,
fe.Field(),
joinValues(computeDiskTypeValues))
case "mtu": case "mtu":
return fmt.Sprint(prefix, fe.Field(), "must be ", mtuMin, "-", mtuMax) return fmt.Sprint(prefix, fe.Field(), "must be ", mtuMin, "-", mtuMax)
@@ -122,13 +116,6 @@ func errorMessage(fe validator.FieldError) string {
fe.Field(), fe.Field(),
joinValues(computeDataDisksValues)) joinValues(computeDataDisksValues))
// Disk Validators
case "diskType":
return fmt.Sprintf("%s %s must be one of the following: %s",
prefix,
fe.Field(),
joinValues(diskTypeValues))
// Flipgroup Validators // Flipgroup Validators
case "flipgroupClientType": case "flipgroupClientType":
return fmt.Sprintf("%s %s must be one of the following: %s", return fmt.Sprintf("%s %s must be one of the following: %s",
@@ -366,6 +353,12 @@ func errorMessage(fe validator.FieldError) string {
prefix, prefix,
fe.Field(), fe.Field(),
joinValues(ipTypeValues)) joinValues(ipTypeValues))
case "sepTechStatus":
return fmt.Sprintf("%s %s must be one of the following: %s",
prefix,
fe.Field(),
joinValues(sepTechStatusValues))
} }
return fe.Error() return fe.Error()

View File

@@ -86,11 +86,6 @@ func registerAllValidators(validate *validator.Validate) error {
return err return err
} }
err = validate.RegisterValidation("computeDiskType", computeDiskTypeValidator)
if err != nil {
return err
}
err = validate.RegisterValidation("computeNetType", computeNetTypeValidator) err = validate.RegisterValidation("computeNetType", computeNetTypeValidator)
if err != nil { if err != nil {
return err return err
@@ -111,11 +106,6 @@ func registerAllValidators(validate *validator.Validate) error {
return err return err
} }
err = validate.RegisterValidation("diskType", diskTypeValidator)
if err != nil {
return err
}
err = validate.RegisterValidation("flipgroupClientType", flipgroupClientTypeValidator) err = validate.RegisterValidation("flipgroupClientType", flipgroupClientTypeValidator)
if err != nil { if err != nil {
return err return err
@@ -311,5 +301,10 @@ func registerAllValidators(validate *validator.Validate) error {
return err return err
} }
err = validate.RegisterValidation("sepTechStatus", sepTechStatusValidator)
if err != nil {
return err
}
return nil return nil
} }

View File

@@ -14,14 +14,11 @@ var (
computeTopologyValues = []string{"compute", "node"} computeTopologyValues = []string{"compute", "node"}
computePolicyValues = []string{"RECOMMENDED", "REQUIRED"} computePolicyValues = []string{"RECOMMENDED", "REQUIRED"}
computeModeValues = []string{"EQ", "EN", "ANY"} computeModeValues = []string{"EQ", "EN", "ANY"}
computeDiskTypeValues = []string{"D", "B"}
computeNetTypeValues = []string{"EXTNET", "VINS"} computeNetTypeValues = []string{"EXTNET", "VINS"}
computex86NetTypeValues = []string{"EXTNET", "VINS", "VFNIC", "DPDK", "SDN", "EMPTY", "TRUNK"} computex86NetTypeValues = []string{"EXTNET", "VINS", "VFNIC", "DPDK", "SDN", "EMPTY", "TRUNK"}
computeOrderValues = []string{"cdrom", "network", "hd"} computeOrderValues = []string{"cdrom", "network", "hd"}
computeDataDisksValues = []string{"KEEP", "DETACH", "DESTROY"} computeDataDisksValues = []string{"KEEP", "DETACH", "DESTROY"}
diskTypeValues = []string{"B", "T", "D"}
flipgroupClientTypeValues = []string{"compute", "vins"} flipgroupClientTypeValues = []string{"compute", "vins"}
massCreateNetTypeValues = []string{"EXTNET", "VINS", "TRUNK"} massCreateNetTypeValues = []string{"EXTNET", "VINS", "TRUNK"}
@@ -66,7 +63,7 @@ var (
loaderTypeValues = []string{"linux", "windows", "unknown"} loaderTypeValues = []string{"linux", "windows", "unknown"}
sepTypeValues = []string{"hitachi", "dorado", "tatlin", "shared", "local", "des"} sepTypeValues = []string{"hitachi", "dorado", "tatlin", "shared", "local", "des", "ustor"}
languageValues = []string{"ru", "en"} languageValues = []string{"ru", "en"}
@@ -81,10 +78,12 @@ var (
addressPoolNetTypeValues = []string{"IPv4", "IPv6", "MAC"} addressPoolNetTypeValues = []string{"IPv4", "IPv6", "MAC"}
ipTypeValues = []string{"v4, v6"} ipTypeValues = []string{"v4, v6"}
sepTechStatusValues = []string{"ENABLED", "DISABLED"}
) )
const ( const (
mtuMin = 1 mtuMin = 1500
mtuMax = 9216 mtuMax = 9216
trunkTagsMin = 1 trunkTagsMin = 1

View File

@@ -68,9 +68,6 @@ type ResourceLimits struct {
// RAM size, MB // RAM size, MB
CUM float64 `json:"CU_M"` CUM float64 `json:"CU_M"`
// Traffic volume, GB
CUNP float64 `json:"CU_NP"`
// Number of graphics cores // Number of graphics cores
GPUUnits float64 `json:"gpu_units"` GPUUnits float64 `json:"gpu_units"`
@@ -98,6 +95,9 @@ type ItemAccount struct {
// Deleted time // Deleted time
DeletedTime uint64 `json:"deletedTime"` DeletedTime uint64 `json:"deletedTime"`
// Deleted by
DeletedBy string `json:"deletedBy"`
// Description // Description
Description string `json:"desc"` Description string `json:"desc"`
@@ -110,6 +110,9 @@ type ItemAccount struct {
// Status // Status
Status string `json:"status"` Status string `json:"status"`
// Updated by
UpdatedBy string `json:"updatedBy"`
// Updated time // Updated time
UpdatedTime uint64 `json:"updatedTime"` UpdatedTime uint64 `json:"updatedTime"`
@@ -150,9 +153,6 @@ type Resource struct {
// Number of External IPs // Number of External IPs
ExtIPs int64 `json:"extips"` ExtIPs int64 `json:"extips"`
// External traffic
ExtTraffic int64 `json:"exttraffic"`
// Number of grafic cores // Number of grafic cores
GPU int64 `json:"gpu"` GPU int64 `json:"gpu"`
@@ -305,6 +305,9 @@ type RecordAccount struct {
// UniqPools // UniqPools
UniqPools []interface{} `json:"uniqPools"` UniqPools []interface{} `json:"uniqPools"`
// Updated By
UpdatedBy string `json:"updatedBy"`
// Updated time // Updated time
UpdatedTime uint64 `json:"updatedTime"` UpdatedTime uint64 `json:"updatedTime"`
@@ -554,9 +557,6 @@ type LimitsRG struct {
// Number of External IPs // Number of External IPs
ExtIPs int64 `json:"extips"` ExtIPs int64 `json:"extips"`
// External traffic
ExtTraffic int64 `json:"exttraffic"`
// Number of grafic cores // Number of grafic cores
GPU int64 `json:"gpu"` GPU int64 `json:"gpu"`
@@ -565,6 +565,9 @@ type LimitsRG struct {
// SEPs // SEPs
SEPs uint64 `json:"seps"` SEPs uint64 `json:"seps"`
// Policies
Policies map[string]Policy `json:"policies"`
} }
// Main information about resource group // Main information about resource group

View File

@@ -38,10 +38,6 @@ type GroupAddRequest struct {
// Required: true // Required: true
ImageID uint64 `url:"imageId" json:"imageId" validate:"required"` ImageID uint64 `url:"imageId" json:"imageId" validate:"required"`
// Compute driver like a KVM_X86, etc.
// Required: true
Driver string `url:"driver" json:"driver" validate:"required"`
// Storage endpoint provider ID // Storage endpoint provider ID
// Required: false // Required: false
SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"` SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`

View File

@@ -25,15 +25,15 @@ type GroupResizeRequest struct {
// Chipset for new computes, either i440fx or Q35 (i440fx by default) // Chipset for new computes, either i440fx or Q35 (i440fx by default)
// Available values : i440fx, Q35 // Available values : i440fx, Q35
// Default value : Q35 // Default value : Q35
// Required: true // Required: false
Chipset string `url:"chipset" json:"chipset" validate:"required,chipset"` Chipset string `url:"chipset,omitempty" json:"chipset,omitempty" validate:"omitempty,chipset"`
// Either delta or absolute value of computes // Either delta or absolute value of computes
// Should be one of: // Should be one of:
// - ABSOLUTE // - ABSOLUTE
// - RELATIVE // - RELATIVE
// Required: true // Required: false
Mode string `url:"mode" json:"mode" validate:"bserviceMode"` Mode string `url:"mode,omitempty" json:"mode,omitempty" validate:"omitempty,bserviceMode"`
} }
// GroupResize resize the group by changing the number of computes // GroupResize resize the group by changing the number of computes

View File

@@ -38,9 +38,8 @@ type AffinityRuleAddRequest struct {
Key string `url:"key" json:"key" validate:"required"` Key string `url:"key" json:"key" validate:"required"`
// Value that must match the key to be taken into account when analyzing this rule // Value that must match the key to be taken into account when analyzing this rule
// Required: false // Required: true
// Not required on purpose: despite required tag on platform, empty string is allowed Value string `url:"value" json:"value" validate:"required"`
Value string `url:"value" json:"value"`
} }
// AffinityRuleAdd add affinity rule // AffinityRuleAdd add affinity rule

View File

@@ -38,9 +38,8 @@ type AffinityRuleRemoveRequest struct {
Key string `url:"key" json:"key" validate:"required"` Key string `url:"key" json:"key" validate:"required"`
// Value that must match the key to be taken into account when analyzing this rule // Value that must match the key to be taken into account when analyzing this rule
// Required: false // Required: true
// Not required on purpose: despite required tag on platform, empty string is allowed Value string `url:"value" json:"value" validate:"required"`
Value string `url:"value" json:"value"`
} }
// AffinityRuleRemove remove affinity rule // AffinityRuleRemove remove affinity rule

View File

@@ -38,9 +38,8 @@ type AntiAffinityRuleAddRequest struct {
Key string `url:"key" json:"key" validate:"required"` Key string `url:"key" json:"key" validate:"required"`
// Value that must match the key to be taken into account when analyzing this rule // Value that must match the key to be taken into account when analyzing this rule
// Required: false // Required: true
// Not required on purpose: despite required tag on platform, empty string is allowed Value string `url:"value" json:"value" validate:"required"`
Value string `url:"value" json:"value"`
} }
// AntiAffinityRuleAdd add anti affinity rule // AntiAffinityRuleAdd add anti affinity rule

View File

@@ -38,9 +38,8 @@ type AntiAffinityRuleRemoveRequest struct {
Key string `url:"key" json:"key" validate:"required"` Key string `url:"key" json:"key" validate:"required"`
// Value that must match the key to be taken into account when analyzing this rule // Value that must match the key to be taken into account when analyzing this rule
// Required: false // Required: true
// Not required on purpose: despite required tag on platform, empty string is allowed Value string `url:"value" json:"value" validate:"required"`
Value string `url:"value" json:"value"`
} }
// AntiAffinityRuleRemove remove anti affinity rule // AntiAffinityRuleRemove remove anti affinity rule

View File

@@ -2,8 +2,8 @@ package compute
import ( import (
"context" "context"
"encoding/json"
"net/http" "net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants" "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"
@@ -17,22 +17,24 @@ type CloneAbortRequest struct {
} }
// CloneAbort aborts a compute clone // CloneAbort aborts a compute clone
func (c Compute) CloneAbort(ctx context.Context, req CloneAbortRequest) (bool, error) { func (c Compute) CloneAbort(ctx context.Context, req CloneAbortRequest) (ListCloneAbort, error) {
err := validators.ValidateRequest(req) err := validators.ValidateRequest(req)
if err != nil { if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err)) return nil, validators.ValidationErrors(validators.GetErrors(err))
} }
url := "/cloudapi/compute/clone_abort" url := "/cloudapi/compute/clone_abort"
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req) res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil { if err != nil {
return false, err return nil, err
} }
result, err := strconv.ParseBool(string(res)) var result ListCloneAbort
err = json.Unmarshal(res, &result)
if err != nil { if err != nil {
return false, err return nil, err
} }
return result, nil return result, nil

View File

@@ -26,13 +26,6 @@ type DiskAddRequest struct {
// Required: true // Required: true
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"` StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
// Type of the disk
// Should be one of:
// - D
// - B
// Required: false
DiskType string `url:"diskType,omitempty" json:"diskType,omitempty" validate:"omitempty,computeDiskType"`
// Storage endpoint provider ID // Storage endpoint provider ID
// By default the same with boot disk // By default the same with boot disk
// Required: false // Required: false

View File

@@ -18,10 +18,6 @@ type DiskAttachRequest struct {
// Required: true // Required: true
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"` DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
// Type of the disk B;D
// Required: false
DiskType string `url:"diskType,omitempty" json:"diskType,omitempty" validate:"omitempty,computeDiskType"`
// Desired PCI slot (hex string, e.g. "0x1A") // Desired PCI slot (hex string, e.g. "0x1A")
// Required: false // Required: false
PCISlot string `url:"pci_slot,omitempty" json:"pci_slot,omitempty"` PCISlot string `url:"pci_slot,omitempty" json:"pci_slot,omitempty"`

View File

@@ -545,6 +545,9 @@ type RecordCompute struct {
// VNC password // VNC password
VNCPassword string `json:"vncPasswd"` VNCPassword string `json:"vncPasswd"`
// Weight
Weight uint64 `json:"weight"`
// Zone ID // Zone ID
// Required: false // Required: false
ZoneID uint64 `json:"zoneId"` ZoneID uint64 `json:"zoneId"`
@@ -789,12 +792,21 @@ type ItemComputeDisk struct {
// Account ID // Account ID
AccountID uint64 `json:"accountId"` AccountID uint64 `json:"accountId"`
// BLK Discard
BLKDiscard bool `json:"blkdiscard"`
// Block Size
BlockSize string `json:"block_size"`
// Boot partition // Boot partition
BootPartition uint64 `json:"bootPartition"` BootPartition uint64 `json:"bootPartition"`
// Bus number // Bus number
BusNumber uint64 `json:"bus_number"` BusNumber uint64 `json:"bus_number"`
// Chache
Cache string `json:"cache"`
// Created by // Created by
CreatedBy string `json:"createdBy"` CreatedBy string `json:"createdBy"`
@@ -831,6 +843,9 @@ type ItemComputeDisk struct {
// Image ID // Image ID
ImageID uint64 `json:"imageId"` ImageID uint64 `json:"imageId"`
// Independent
Independent bool `json:"independent"`
// List image IDs // List image IDs
Images []uint64 `json:"images"` Images []uint64 `json:"images"`
@@ -1226,6 +1241,9 @@ type ItemCompute struct {
// VINS connected // VINS connected
VINSConnected uint64 `json:"vinsConnected"` VINSConnected uint64 `json:"vinsConnected"`
// Weight
Weight uint64 `json:"weight"`
// Zone ID // Zone ID
ZoneID uint64 `json:"zoneId"` ZoneID uint64 `json:"zoneId"`
} }
@@ -1237,6 +1255,9 @@ type ListInfoDisks []InfoDisk
type InfoDisk struct { type InfoDisk struct {
// ID // ID
ID uint64 `json:"id"` ID uint64 `json:"id"`
// SEP ID
SepID int64 `json:"sepId"`
} }
// List information about computes // List information about computes
@@ -1364,6 +1385,21 @@ type RecordCloneStatus struct {
Status CloneStatus `json:"status"` Status CloneStatus `json:"status"`
} }
// Information about aborted clone disk
type RecordCloneAbort struct {
// Disk ID
DiskID uint64 `json:"disk_id"`
// Aborted
Aborted bool `json:"aborted"`
// Blockcopy abort job ID
BlockcopyAbortJobID string `json:"blockcopy_abort_job_id"`
}
// List of aborted clone disks
type ListCloneAbort []RecordCloneAbort
type CloneStatus struct { type CloneStatus struct {
// Type // Type
Type int `json:"type"` Type int `json:"type"`

View File

@@ -20,7 +20,7 @@ type NetAttachRequest struct {
// 'VFNIC' for connect to vfpool // 'VFNIC' for connect to vfpool
// 'DPDK' for connect to DPDK // 'DPDK' for connect to DPDK
// `EMPTY` for connect empty network // `EMPTY` for connect empty network
// `SDT` for connect to SDN // `SDN` for connect to SDN
// `TRUNK` for connect to TRUNK // `TRUNK` for connect to TRUNK
// Required: true // Required: true
NetType string `url:"netType" json:"netType" validate:"computex86NetType"` NetType string `url:"netType" json:"netType" validate:"computex86NetType"`
@@ -39,12 +39,32 @@ type NetAttachRequest struct {
// Required: false // Required: false
MACAddr string `url:"mac_addr,omitempty" json:"mac_addr,omitempty"` MACAddr string `url:"mac_addr,omitempty" json:"mac_addr,omitempty"`
// Used only for EXTNET and DPDK // Used for EXTNET, TRUNK and DPDK
// For DPDK must be 1-9216 // Must be 1500-9216
// For EXTNET must be 1500-9216
// Required: false // Required: false
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"` MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`
// Net mask
// Used only to DPDK or VFNIC net type
// Required: false
NetMask uint64 `url:"netMask,omitempty" json:"netMask,omitempty"`
// SDN Segment ID
// Required: false
SDNSegmentID string `url:"sdn_segment_id,omitempty" json:"sdn_segment_id,omitempty"`
// SDN Object Group ID
// Required: false
SDNObjectGroupID string `url:"sdn_object_group_id,omitempty" json:"sdn_object_group_id,omitempty"`
// SDN Logical Port Display Name
// Required: false
SDNLogicalPortDisplayName string `url:"sdn_logical_port_display_name,omitempty" json:"sdn_logical_port_display_name,omitempty"`
// SDN Logical Port Description
// Required: false
SDNLogicalPortDescription string `url:"sdn_logical_port_description,omitempty" json:"sdn_logical_port_description,omitempty"`
// Unique identifier of logical port on SDN side // Unique identifier of logical port on SDN side
// Required: false // Required: false
SDNInterfaceID string `url:"sdn_interface_id,omitempty" json:"sdn_interface_id,omitempty" validate:"omitempty"` SDNInterfaceID string `url:"sdn_interface_id,omitempty" json:"sdn_interface_id,omitempty" validate:"omitempty"`

View File

@@ -48,7 +48,6 @@ var disks = ListDisks{
Snapshots: []ItemSnapshot{}, Snapshots: []ItemSnapshot{},
Status: "ASSIGNED", Status: "ASSIGNED",
TechStatus: techStatusAllocated, TechStatus: techStatusAllocated,
Type: "B",
VMID: 48500, VMID: 48500,
}, },
{ {
@@ -92,7 +91,6 @@ var disks = ListDisks{
Snapshots: []ItemSnapshot{}, Snapshots: []ItemSnapshot{},
Status: "ASSIGNED", Status: "ASSIGNED",
TechStatus: techStatusAllocated, TechStatus: techStatusAllocated,
Type: "B",
VMID: 48502, VMID: 48502,
}, },
}, },
@@ -224,7 +222,6 @@ var searchDisks = ListSearchDisks{
Snapshots: []ItemSnapshot{}, Snapshots: []ItemSnapshot{},
Status: "ASSIGNED", Status: "ASSIGNED",
TechStatus: techStatusAllocated, TechStatus: techStatusAllocated,
Type: "B",
VMID: 48500, VMID: 48500,
}, },
ItemDisk{ ItemDisk{
@@ -268,7 +265,6 @@ var searchDisks = ListSearchDisks{
Snapshots: []ItemSnapshot{}, Snapshots: []ItemSnapshot{},
Status: "ASSIGNED", Status: "ASSIGNED",
TechStatus: techStatusAllocated, TechStatus: techStatusAllocated,
Type: "B",
VMID: 48502, VMID: 48502,
}, },
} }
@@ -360,7 +356,6 @@ func TestListSearchDisks_SortByCreatedTime(t *testing.T) {
var unattachedDisks = ListDisksUnattached{ var unattachedDisks = ListDisksUnattached{
Data: []ItemDiskUnattached{ Data: []ItemDiskUnattached{
{ {
CKey: "",
Meta: []interface{}{ Meta: []interface{}{
"cloudbroker", "cloudbroker",
"disk", "disk",
@@ -408,11 +403,9 @@ var unattachedDisks = ListDisksUnattached{
Snapshots: nil, Snapshots: nil,
Status: "CREATED", Status: "CREATED",
TechStatus: techStatusAllocated, TechStatus: techStatusAllocated,
Type: "D",
VMID: 0, VMID: 0,
}, },
{ {
CKey: "",
Meta: []interface{}{ Meta: []interface{}{
"cloudbroker", "cloudbroker",
"disk", "disk",
@@ -463,7 +456,6 @@ var unattachedDisks = ListDisksUnattached{
Snapshots: nil, Snapshots: nil,
Status: "CREATED", Status: "CREATED",
TechStatus: techStatusAllocated, TechStatus: techStatusAllocated,
Type: "B",
VMID: 0, VMID: 0,
}, },
}, },

View File

@@ -38,10 +38,6 @@ type ListRequest struct {
// Required: false // Required: false
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"` AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
// Type of the disks
// Required: false
Type string `url:"type,omitempty" json:"type,omitempty"`
// Find by sep ID // Find by sep ID
// Required: false // Required: false
SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"` SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`
@@ -65,6 +61,14 @@ type ListRequest struct {
// Page size // Page size
// Required: false // Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty"` Size uint64 `url:"size,omitempty" json:"size,omitempty"`
// ID of the resource group
// Required: false
RGID uint64 `url:"rg_id,omitempty" json:"rg_id,omitempty"`
// ID of the compute
// Required: false
ComputeID uint64 `url:"compute_id,omitempty" json:"compute_id,omitempty"`
} }
// List gets list of the created disks belonging to an account as a ListDisks struct // List gets list of the created disks belonging to an account as a ListDisks struct

View File

@@ -34,10 +34,6 @@ type ListDeletedRequest struct {
// Required: false // Required: false
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"` AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
// Type of the disks
// Required: false
Type string `url:"type,omitempty" json:"type,omitempty"`
// Sort by one of supported fields, format +|-(field) // Sort by one of supported fields, format +|-(field)
// Required: false // Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"` SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`

View File

@@ -1,52 +0,0 @@
package disks
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// ListTypesRequest struct to get list types of disks
type ListTypesRequest struct {
// Show detailed disk types by seps
// Required: true
Detailed bool `url:"detailed" json:"detailed"`
// Sort by one of supported fields, format +|-(field)
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
// Page size
// Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// ListTypes gets list defined disk types
func (d Disks) ListTypes(ctx context.Context, req ListTypesRequest) (*ListTypes, error) {
if err := validators.ValidateRequest(req); err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/disks/listTypes"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
list := ListTypes{}
err = json.Unmarshal(res, &list)
if err != nil {
return nil, err
}
return &list, nil
}

View File

@@ -26,10 +26,6 @@ type ListUnattachedRequest struct {
// Required: false // Required: false
Status string `url:"status,omitempty" json:"status,omitempty"` Status string `url:"status,omitempty" json:"status,omitempty"`
// Type of the disks
// Required: false
Type string `url:"type,omitempty" json:"type,omitempty"`
// ID of the account // ID of the account
// Required: false // Required: false
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"` AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`

View File

@@ -11,6 +11,12 @@ type ItemDisk struct {
// Account name // Account name
AccountName string `json:"accountName"` AccountName string `json:"accountName"`
// BLK Discard
BLKDiscard bool `json:"blkdiscard"`
// Block size of disk
BlockSize string `json:"block_size"`
// Computes // Computes
Computes map[string]string `json:"computes"` Computes map[string]string `json:"computes"`
@@ -44,6 +50,9 @@ type ItemDisk struct {
// Image ID // Image ID
ImageID uint64 `json:"imageId"` ImageID uint64 `json:"imageId"`
// Independent
Independent bool `json:"independent"`
// List of image IDs // List of image IDs
Images []uint64 `json:"images"` Images []uint64 `json:"images"`
@@ -128,9 +137,6 @@ type ItemDisk struct {
// Need to clean before destroy // Need to clean before destroy
ToClean bool `json:"to_clean"` ToClean bool `json:"to_clean"`
// Type
Type string `json:"type"`
// Virtual machine ID // Virtual machine ID
VMID uint64 `json:"vmid"` VMID uint64 `json:"vmid"`
@@ -139,12 +145,12 @@ type ItemDisk struct {
// Updated by // Updated by
UpdatedBy string `json:"updatedBy"` UpdatedBy string `json:"updatedBy"`
// Cache mode of disk
Cache string `json:"cache"`
} }
type ItemDiskUnattached struct { type ItemDiskUnattached struct {
// CKey
CKey string `json:"_ckey"`
// Meta // Meta
Meta []interface{} `json:"_meta"` Meta []interface{} `json:"_meta"`
@@ -157,9 +163,18 @@ type ItemDiskUnattached struct {
// Access Control List // Access Control List
ACL map[string]interface{} `json:"acl"` ACL map[string]interface{} `json:"acl"`
// BLK Discard
BLKDiscard bool `json:"blkdiscard"`
// Block size of disk
BlockSize string `json:"block_size"`
// Boot Partition // Boot Partition
BootPartition uint64 `json:"bootPartition"` BootPartition uint64 `json:"bootPartition"`
// Cache
Cache string `json:"cache"`
// Created time // Created time
CreatedTime uint64 `json:"createdTime"` CreatedTime uint64 `json:"createdTime"`
@@ -268,8 +283,11 @@ type ItemDiskUnattached struct {
// Tech status // Tech status
TechStatus string `json:"techStatus"` TechStatus string `json:"techStatus"`
// Type // Need to clean before destroy
Type string `json:"type"` ToClean bool `json:"to_clean"`
// ID of the Storage Policy
StoragePolicyID uint64 `json:"storage_policy_id"`
// Virtual machine ID // Virtual machine ID
VMID uint64 `json:"vmid"` VMID uint64 `json:"vmid"`
@@ -375,6 +393,12 @@ type RecordDisk struct {
// Account name // Account name
AccountName string `json:"accountName"` AccountName string `json:"accountName"`
// BLK Discard
BLKDiscard bool `json:"blkdiscard"`
// Block size of disk
BlockSize string `json:"block_size"`
// Computes // Computes
Computes map[string]string `json:"computes"` Computes map[string]string `json:"computes"`
@@ -408,6 +432,9 @@ type RecordDisk struct {
// Image ID // Image ID
ImageID uint64 `json:"imageId"` ImageID uint64 `json:"imageId"`
// Independent
Independent bool `json:"independent"`
// List of image IDs // List of image IDs
Images []uint64 `json:"images"` Images []uint64 `json:"images"`
@@ -492,9 +519,6 @@ type RecordDisk struct {
// Need to clean before destroy // Need to clean before destroy
ToClean bool `json:"to_clean"` ToClean bool `json:"to_clean"`
// Type
Type string `json:"type"`
// Virtual machine ID // Virtual machine ID
VMID uint64 `json:"vmid"` VMID uint64 `json:"vmid"`
@@ -503,6 +527,9 @@ type RecordDisk struct {
// Updated by // Updated by
UpdatedBy string `json:"updatedBy"` UpdatedBy string `json:"updatedBy"`
// Cache mode of disk
Cache string `json:"cache"`
} }
type ItemReplication struct { type ItemReplication struct {
@@ -524,11 +551,3 @@ type ItemReplication struct {
// VolumeID // VolumeID
VolumeID string `json:"volumeId"` VolumeID string `json:"volumeId"`
} }
type ListTypes struct {
// Data
Data []interface{} `json:"data"`
// Entry count
EntryCount uint64 `json:"entryCount"`
}

View File

@@ -34,10 +34,6 @@ type ListRequest struct {
// Required: false // Required: false
AccountId uint64 `url:"accountId,omitempty" json:"accountId,omitempty"` AccountId uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
// Find by resource group ID
// Required: false
RGID uint64 `url:"rgId,omitempty" json:"rgId,omitempty"`
// Find by id // Find by id
// Required: false // Required: false
ByID uint64 `url:"by_id,omitempty" json:"by_id,omitempty"` ByID uint64 `url:"by_id,omitempty" json:"by_id,omitempty"`

View File

@@ -85,12 +85,6 @@ type RecordFLIPGroup struct {
// Network // Network
Network string `json:"network"` Network string `json:"network"`
// Resource group ID
RGID uint64 `json:"rgId"`
// Resource group name
RGName string `json:"rgName"`
// Status // Status
Status string `json:"status"` Status string `json:"status"`

View File

@@ -92,9 +92,6 @@ type RecordImage struct {
// UNCPathj // UNCPathj
UNCPath string `json:"UNCPath"` UNCPath string `json:"UNCPath"`
// CKey
CKey string `json:"_ckey"`
// Account ID // Account ID
AccountID uint64 `json:"accountId"` AccountID uint64 `json:"accountId"`
@@ -143,6 +140,9 @@ type RecordImage struct {
// ID // ID
ID uint64 `json:"id"` ID uint64 `json:"id"`
// Independent
Independent bool `json:"independent"`
// Last modified // Last modified
LastModified uint64 `json:"lastModified"` LastModified uint64 `json:"lastModified"`

View File

@@ -35,10 +35,31 @@ type Interface struct {
// Required: false // Required: false
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"` MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`
// Net mask
// Used only to DPDK or VFNIC net type
// Required: false
NetMask uint64 `url:"netMask,omitempty" json:"netMask,omitempty"`
// MAC address to assign to this VM when connecting to the specified network // MAC address to assign to this VM when connecting to the specified network
// Required: false // Required: false
MAC string `url:"mac,omitempty" json:"mac,omitempty" validate:"omitempty"` MAC string `url:"mac,omitempty" json:"mac,omitempty" validate:"omitempty"`
// SDN Segment ID
// Required: false
SDNSegmentID string `url:"sdn_segment_id,omitempty" json:"sdn_segment_id,omitempty"`
// SDN Object Group ID
// Required: false
SDNObjectGroupID string `url:"sdn_object_group_id,omitempty" json:"sdn_object_group_id,omitempty"`
// SDN Logical Port Display Name
// Required: false
SDNLogicalPortDisplayName string `url:"sdn_logical_port_display_name,omitempty" json:"sdn_logical_port_display_name,omitempty"`
// SDN Logical Port Description
// Required: false
SDNLogicalPortDescription string `url:"sdn_logical_port_description,omitempty" json:"sdn_logical_port_description,omitempty"`
// SDN interface id // SDN interface id
// Required: false // Required: false
SDNInterfaceID string `url:"sdn_interface_id,omitempty" json:"sdn_interface_id,omitempty"` SDNInterfaceID string `url:"sdn_interface_id,omitempty" json:"sdn_interface_id,omitempty"`
@@ -162,14 +183,6 @@ type CreateRequest struct {
// Required: false // Required: false
Start bool `url:"start" json:"start"` Start bool `url:"start" json:"start"`
// System name
// Required: false
IS string `url:"IS,omitempty" json:"IS,omitempty"`
// Compute purpose
// Required: false
IPAType string `url:"ipaType,omitempty" json:"ipaType,omitempty"`
// Custom fields for compute. Must be a dict // Custom fields for compute. Must be a dict
// Required: false // Required: false
CustomFields string `url:"customFields,omitempty" json:"customFields,omitempty"` CustomFields string `url:"customFields,omitempty" json:"customFields,omitempty"`

View File

@@ -38,8 +38,8 @@ type CreateRequest struct {
HighlyAvailable bool `url:"highlyAvailable,omitempty" json:"highlyAvailable,omitempty"` HighlyAvailable bool `url:"highlyAvailable,omitempty" json:"highlyAvailable,omitempty"`
// Start now Load balancer // Start now Load balancer
// Required: true // Required: false
Start bool `url:"start" json:"start" validate:"required"` Start interface{} `url:"start,omitempty" json:"start,omitempty" validate:"omitempty,isBool"`
// Text description of this load balancer // Text description of this load balancer
// Required: false // Required: false

View File

@@ -14,9 +14,6 @@ type Resource struct {
// Number of External IPs // Number of External IPs
ExtIPs int64 `json:"extips"` ExtIPs int64 `json:"extips"`
// External traffic
ExtTraffic int64 `json:"exttraffic"`
// Number of grafic cores // Number of grafic cores
GPU int64 `json:"gpu"` GPU int64 `json:"gpu"`
@@ -270,6 +267,9 @@ type ListResourceGroups struct {
// Main information about Access Control List // Main information about Access Control List
type ItemACL struct { type ItemACL struct {
// Email
Email string `json:"email"`
// Explicit // Explicit
Explicit bool `json:"explicit"` Explicit bool `json:"explicit"`
@@ -846,9 +846,6 @@ type RecordResourceUsage struct {
// Number of external IPs // Number of external IPs
ExtIPs uint64 `json:"extips"` ExtIPs uint64 `json:"extips"`
// ExtraTraffic
ExtraTraffic uint64 `json:"exttraffic"`
// Number of GPU // Number of GPU
GPU uint64 `json:"gpu"` GPU uint64 `json:"gpu"`

View File

@@ -56,6 +56,10 @@ type ListRequest struct {
// Search by pool name // Search by pool name
// Required: false // Required: false
PoolName string `url:"pool_name,omitempty" json:"pool_name,omitempty"` PoolName string `url:"pool_name,omitempty" json:"pool_name,omitempty"`
// Filter SEP's by tech status (ENABLED, DISABLED)
// Required: false
SepTechStatus string `url:"sep_tech_status,omitempty" json:"sep_tech_status,omitempty" validate:"omitempty,sepTechStatus"`
} }
// List gets list of storage policies as a ListStoragePolicies struct // List gets list of storage policies as a ListStoragePolicies struct

View File

@@ -77,6 +77,9 @@ type AccessSEPPool struct {
// Pool names // Pool names
PoolNames []string `json:"pool_names"` PoolNames []string `json:"pool_names"`
// Technical status of the SEP
SepTechStatus string `json:"sep_tech_status"`
} }
type Usage struct { type Usage struct {

View File

@@ -29,6 +29,9 @@ type ItemTrunk struct {
// MAC // MAC
MAC string `json:"mac"` MAC string `json:"mac"`
// MTU
MTU uint64 `json:"mtu"`
// Name of a trunk // Name of a trunk
Name string `json:"name"` Name string `json:"name"`

View File

@@ -156,9 +156,6 @@ type Resources struct {
// ExtIPs // ExtIPs
ExtIPs uint64 `json:"extips"` ExtIPs uint64 `json:"extips"`
// ExtTraffic
ExtTraffic uint64 `json:"exttraffic"`
// GPU // GPU
GPU uint64 `json:"gpu"` GPU uint64 `json:"gpu"`

View File

@@ -10,6 +10,9 @@ type ListZones struct {
// Detailed information about the zone record // Detailed information about the zone record
type RecordZone struct { type RecordZone struct {
// If true, all nodes belonging to the given zone will be marked for autostart
AutoStart bool `json:"autostart"`
// ID // ID
ID uint64 `json:"id"` ID uint64 `json:"id"`

View File

@@ -71,9 +71,6 @@ type Resource struct {
// Number of External IPs // Number of External IPs
ExtIPs int64 `json:"extips"` ExtIPs int64 `json:"extips"`
// External traffic
ExtTraffic int64 `json:"exttraffic"`
// Number of grafic cores // Number of grafic cores
GPU int64 `json:"gpu"` GPU int64 `json:"gpu"`
@@ -143,9 +140,6 @@ type ResourceLimits struct {
// CuM // CuM
CuM float64 `json:"CU_M"` CuM float64 `json:"CU_M"`
// CuNP
CuNP float64 `json:"CU_NP"`
// GPUUnits // GPUUnits
GPUUnits float64 `json:"gpu_units"` GPUUnits float64 `json:"gpu_units"`
@@ -221,6 +215,9 @@ type InfoAccount struct {
// UniqPools // UniqPools
UniqPools []string `json:"uniqPools"` UniqPools []string `json:"uniqPools"`
// Updated By
UpdatedBy string `json:"updatedBy"`
// UpdatedTime // UpdatedTime
UpdatedTime uint64 `json:"updatedTime"` UpdatedTime uint64 `json:"updatedTime"`
@@ -480,9 +477,6 @@ type Limits struct {
// External IPs // External IPs
ExtIPs int64 `json:"extips"` ExtIPs int64 `json:"extips"`
// External traffic
ExtTraffic int64 `json:"exttraffic"`
// Number of GPU // Number of GPU
GPU int64 `json:"gpu"` GPU int64 `json:"gpu"`
@@ -491,6 +485,9 @@ type Limits struct {
// SEPs number // SEPs number
SEPs uint64 `json:"seps"` SEPs uint64 `json:"seps"`
// Policies
Policies map[string]Policy `json:"policies"`
} }
// Resources of resource group // Resources of resource group

View File

@@ -64,6 +64,10 @@ type UpdateRequest struct {
// Default zone ID // Default zone ID
// Required: false // Required: false
DefaultZoneID uint64 `url:"defaultZoneId,omitempty" json:"defaultZoneId,omitempty"` DefaultZoneID uint64 `url:"defaultZoneId,omitempty" json:"defaultZoneId,omitempty"`
// CPU allocation parameter
// Required: false
CpuAllocationParameter string `url:"cpu_allocation_parameter,omitempty" json:"cpu_allocation_parameter,omitempty"`
} }
// Update updates an account name and resource types and limits // Update updates an account name and resource types and limits

View File

@@ -95,6 +95,15 @@ type RecordAudit struct {
// TTL // TTL
TTL string `json:"_ttl"` TTL string `json:"_ttl"`
// Resgroup ID
ResgroupID uint64 `json:"resgroup_id"`
// Account ID
AccountID uint64 `json:"account_id"`
// Compute ID
ComputeID uint64 `json:"compute_id"`
} }
// List of Linked Jobs // List of Linked Jobs

View File

@@ -14,6 +14,9 @@ type RestoreDiskFromBackupRequest struct {
// Compute ID // Compute ID
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
// Node ID
NodeID uint64 `url:"nodeId,omitempty" json:"nodeId,omitempty"`
// Disk ID // Disk ID
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"` DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`

View File

@@ -25,6 +25,9 @@ type RestoreDisksFromBackupRequest struct {
// Compute ID // Compute ID
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
// Node ID
NodeID uint64 `url:"nodeId,omitempty" json:"nodeId,omitempty"`
//Backup files //Backup files
BackupFiles []BackupFile `url:"disks" json:"disks" validate:"required,dive"` BackupFiles []BackupFile `url:"disks" json:"disks" validate:"required,dive"`
} }

View File

@@ -38,10 +38,6 @@ type GroupAddRequest struct {
// Required: true // Required: true
ImageID uint64 `url:"imageId" json:"imageId" validate:"required"` ImageID uint64 `url:"imageId" json:"imageId" validate:"required"`
// Compute driver like a KVM_X86, etc.
// Required: true
Driver string `url:"driver" json:"driver" validate:"required"`
// Storage endpoint provider ID // Storage endpoint provider ID
// Required: false // Required: false
SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"` SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`

View File

@@ -22,18 +22,18 @@ type GroupResizeRequest struct {
// Required: true // Required: true
Count int64 `url:"count" json:"count" validate:"required"` Count int64 `url:"count" json:"count" validate:"required"`
//Chipset for new computes, either i440fx or Q35 (i440fx by default) // Chipset for new computes, either i440fx or Q35 (i440fx by default)
//Available values : i440fx, Q35 // Available values : i440fx, Q35
//Default value : Q35 // Default value : Q35
//Required: true // Required: false
Chipset string `url:"chipset" json:"chipset" validate:"required,chipset"` Chipset string `url:"chipset,omitempty" json:"chipset,omitempty" validate:"omitempty,chipset"`
// Either delta or absolute value of computes // Either delta or absolute value of computes
// Should be one of: // Should be one of:
// - ABSOLUTE // - ABSOLUTE
// - RELATIVE // - RELATIVE
// Required: true // Required: false
Mode string `url:"mode" json:"mode" validate:"bserviceMode"` Mode string `url:"mode,omitempty" json:"mode,omitempty" validate:"omitempty,bserviceMode"`
} }
// GroupResize resize the group by changing the number of computes // GroupResize resize the group by changing the number of computes

View File

@@ -40,9 +40,8 @@ type AffinityRuleAddRequest struct {
Key string `url:"key" json:"key" validate:"required"` Key string `url:"key" json:"key" validate:"required"`
// Value that must match the key to be taken into account when analyzing this rule // Value that must match the key to be taken into account when analyzing this rule
// Required: false // Required: true
// Not required on purpose: despite required tag on platform, empty string is allowed Value string `url:"value" json:"value" validate:"required"`
Value string `url:"value" json:"value"`
} }
// AffinityRuleAdd adds affinity rule // AffinityRuleAdd adds affinity rule

View File

@@ -38,9 +38,8 @@ type AffinityRuleRemoveRequest struct {
Key string `url:"key" json:"key" validate:"required"` Key string `url:"key" json:"key" validate:"required"`
// Value that must match the key to be taken into account when analyzing this rule // Value that must match the key to be taken into account when analyzing this rule
// Required: false // Required: true
// Not required on purpose: despite required tag on platform, empty string is allowed Value string `url:"value" json:"value" validate:"required"`
Value string `url:"value" json:"value"`
} }
// AffinityRuleRemove remove affinity rule // AffinityRuleRemove remove affinity rule

View File

@@ -38,9 +38,8 @@ type AntiAffinityRuleAddRequest struct {
Key string `url:"key" json:"key" validate:"required"` Key string `url:"key" json:"key" validate:"required"`
// Value that must match the key to be taken into account when analyzing this rule // Value that must match the key to be taken into account when analyzing this rule
// Required: false // Required: true
// Not required on purpose: despite required tag on platform, empty string is allowed Value string `url:"value" json:"value" validate:"required"`
Value string `url:"value" json:"value"`
} }
// AntiAffinityRuleAdd adds anti affinity rule // AntiAffinityRuleAdd adds anti affinity rule

View File

@@ -38,9 +38,8 @@ type AntiAffinityRuleRemoveRequest struct {
Key string `url:"key" json:"key" validate:"required"` Key string `url:"key" json:"key" validate:"required"`
// Value that must match the key to be taken into account when analyzing this rule // Value that must match the key to be taken into account when analyzing this rule
// Required: false // Required: true
// Not required on purpose: despite required tag on platform, empty string is allowed Value string `url:"value" json:"value" validate:"required"`
Value string `url:"value" json:"value"`
} }
// AntiAffinityRuleRemove removes anti affinity rule // AntiAffinityRuleRemove removes anti affinity rule

View File

@@ -0,0 +1,47 @@
package compute
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// CheckComputePlacementRequest struct for check compute placement
type CheckComputePlacementRequest struct {
// IDs of compute instances to check
// Required: true
ComputeIDs []uint64 `url:"compute_ids" json:"compute_ids" validate:"required"`
// Filter by CPU and RAM when checking placement
// Required: false
// Default: true
FilterByCPURAM interface{} `url:"filter_by_cpu_ram,omitempty" json:"filter_by_cpu_ram,omitempty" validate:"omitempty,isBool"`
}
// CheckComputePlacement checks compute placement and returns structured result
func (c Compute) CheckComputePlacement(ctx context.Context, req CheckComputePlacementRequest) (CheckComputePlacementResult, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/check_compute_placement"
if req.FilterByCPURAM == nil {
req.FilterByCPURAM = true
}
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
result := make(CheckComputePlacementResult)
if err := json.Unmarshal(res, &result); err != nil {
return nil, err
}
return result, nil
}

View File

@@ -2,8 +2,8 @@ package compute
import ( import (
"context" "context"
"encoding/json"
"net/http" "net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants" "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"
@@ -17,22 +17,24 @@ type CloneAbortRequest struct {
} }
// CloneAbort aborts a compute clone // CloneAbort aborts a compute clone
func (c Compute) CloneAbort(ctx context.Context, req CloneAbortRequest) (bool, error) { func (c Compute) CloneAbort(ctx context.Context, req CloneAbortRequest) ([]RecordCloneAbort, error) {
err := validators.ValidateRequest(req) err := validators.ValidateRequest(req)
if err != nil { if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err)) return nil, validators.ValidationErrors(validators.GetErrors(err))
} }
url := "/cloudbroker/compute/clone_abort" url := "/cloudbroker/compute/clone_abort"
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req) res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil { if err != nil {
return false, err return nil, err
} }
result, err := strconv.ParseBool(string(res)) result := make([]RecordCloneAbort, 0)
err = json.Unmarshal(res, &result)
if err != nil { if err != nil {
return false, err return nil, err
} }
return result, nil return result, nil

View File

@@ -12,7 +12,7 @@ import (
type GetCloneStatusRequest struct { type GetCloneStatusRequest struct {
// ID of compute instance // ID of compute instance
// Required: true // Required: true
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"` ComputeID string `url:"compute_id" json:"compute_id" validate:"required"`
} }
// GetCloneStatus gets information about compute clone status as a RecordCloneStatus struct // GetCloneStatus gets information about compute clone status as a RecordCloneStatus struct

View File

@@ -31,13 +31,6 @@ type DiskAddRequest struct {
// Required: true // Required: true
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"` StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
// Type of the disk
// Should be one of:
// - D
// - B
// Required: false
DiskType string `url:"diskType,omitempty" json:"diskType,omitempty" validate:"omitempty,computeDiskType"`
// Pool name // Pool name
// By default will be chosen automatically // By default will be chosen automatically
// Required: false // Required: false
@@ -58,6 +51,14 @@ type DiskAddRequest struct {
// Desired bus number (hex string, e.g. "0x03") // Desired bus number (hex string, e.g. "0x03")
// Required: false // Required: false
BusNumber string `url:"bus_number,omitempty" json:"bus_number,omitempty"` BusNumber string `url:"bus_number,omitempty" json:"bus_number,omitempty"`
// Disk cache mode
// Required: false
Cache string `url:"cache,omitempty" json:"cache,omitempty"`
// BLK Discard
// Required: false
BLKDiscard interface{} `url:"blkdiscard,omitempty" json:"blkdiscard,omitempty" validate:"omitempty,isBool"`
} }
// DiskAdd creates new disk and attach to compute // DiskAdd creates new disk and attach to compute

View File

@@ -18,10 +18,6 @@ type DiskAttachRequest struct {
// Required: true // Required: true
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"` DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
// Type of the disk B;D
// Required: false
DiskType string `url:"diskType,omitempty" json:"diskType,omitempty"`
// Desired PCI slot (hex string, e.g. "0x1A") // Desired PCI slot (hex string, e.g. "0x1A")
// Required: false // Required: false
PCISlot string `url:"pci_slot,omitempty" json:"pci_slot,omitempty"` PCISlot string `url:"pci_slot,omitempty" json:"pci_slot,omitempty"`

View File

@@ -391,12 +391,21 @@ type ItemDisk struct {
// Access Control List // Access Control List
ACL ItemACL `json:"acl"` ACL ItemACL `json:"acl"`
// BLK Discard
BLKDiscard bool `json:"blkdiscard"`
// Block Size
BlockSize string `json:"block_size"`
// Boot partition // Boot partition
BootPartition uint64 `json:"bootPartition"` BootPartition uint64 `json:"bootPartition"`
// Bus number // Bus number
BusNumber uint64 `json:"bus_number"` BusNumber uint64 `json:"bus_number"`
// Chache
Cache string `json:"cache"`
// Created by // Created by
CreatedBy string `json:"createdBy"` CreatedBy string `json:"createdBy"`
@@ -433,6 +442,9 @@ type ItemDisk struct {
// Image ID // Image ID
ImageID uint64 `json:"imageId"` ImageID uint64 `json:"imageId"`
// Independent
Independent bool `json:"independent"`
// List image IDs // List image IDs
Images []uint64 `json:"images"` Images []uint64 `json:"images"`
@@ -841,7 +853,7 @@ type InfoCompute struct {
SnapSets ListSnapshots `json:"snapSets"` SnapSets ListSnapshots `json:"snapSets"`
// Node ID // Node ID
NodeID uint64 `json:"nodeId"` NodeID uint64 `json:"node_id"`
// Node name // Node name
NodeName string `json:"nodeName"` NodeName string `json:"nodeName"`
@@ -882,6 +894,9 @@ type InfoCompute struct {
// VINS connected // VINS connected
VINSConnected uint64 `json:"vinsConnected"` VINSConnected uint64 `json:"vinsConnected"`
// Weight
Weight uint64 `json:"weight"`
// Zone ID // Zone ID
ZoneID uint64 `json:"zoneId"` ZoneID uint64 `json:"zoneId"`
} }
@@ -1169,8 +1184,14 @@ type RecordCompute struct {
// VNC password // VNC password
VNCPassword string `json:"vncPasswd"` VNCPassword string `json:"vncPasswd"`
// Weight
Weight uint64 `json:"weight"`
// Zone ID // Zone ID
ZoneID uint64 `json:"zoneId"` ZoneID uint64 `json:"zoneId"`
//todo
_ uint64 `json:"nodeId"`
} }
type LoaderMetaIso struct { type LoaderMetaIso struct {
@@ -1280,6 +1301,9 @@ type ItemDeletedCompute struct {
type InfoDisk struct { type InfoDisk struct {
// ID // ID
ID uint64 `json:"id"` ID uint64 `json:"id"`
// SEP ID
SepID int64 `json:"sepId"`
} }
// List computes // List computes
@@ -1454,6 +1478,17 @@ type MigrateStorageItem struct {
TargetNodeID uint64 `json:"targetNodeId"` TargetNodeID uint64 `json:"targetNodeId"`
} }
type RecordCloneAbort struct {
// Disk ID
DiskID uint64 `json:"disk_id"`
// Aborted
Aborted bool `json:"aborted"`
// Blockcopy abort job ID
BlockcopyAbortJobID string `json:"blockcopy_abort_job_id"`
}
type RecordCloneStatus struct { type RecordCloneStatus struct {
// Disk ID // Disk ID
DiskID int `json:"disk_id"` DiskID int `json:"disk_id"`
@@ -1481,3 +1516,20 @@ type CloneStatus struct {
// Progress percent // Progress percent
ProgressPercent int `json:"progress_percent"` ProgressPercent int `json:"progress_percent"`
} }
type CheckComputePlacementError struct {
// Code
Code int64 `json:"code"`
// Message
Message string `json:"message"`
}
type CheckComputePlacementItem struct {
// Nide IDs
NodeIDs []uint64 `json:"node_ids"`
// error
Error CheckComputePlacementError `json:"error,omitempty"`
}
type CheckComputePlacementResult map[string]CheckComputePlacementItem

View File

@@ -20,7 +20,7 @@ type NetAttachRequest struct {
// 'VFNIC' for connect to vfpool // 'VFNIC' for connect to vfpool
// 'DPDK' for connect to DPDK // 'DPDK' for connect to DPDK
// `EMPTY` for connect empty network // `EMPTY` for connect empty network
// `SDT` for connect to SDN // `SDN` for connect to SDN
// `TRUNK` for connect to TRUNK // `TRUNK` for connect to TRUNK
// Required: true // Required: true
NetType string `url:"netType" json:"netType" validate:"computex86NetType"` NetType string `url:"netType" json:"netType" validate:"computex86NetType"`
@@ -39,12 +39,32 @@ type NetAttachRequest struct {
// Required: false // Required: false
MACAddr string `url:"mac_addr,omitempty" json:"mac_addr,omitempty"` MACAddr string `url:"mac_addr,omitempty" json:"mac_addr,omitempty"`
// Used only for EXTNET and DPDK // Used for EXTNET, TRUNK and DPDK
// For DPDK must be 1-9216 // Must be 1500-9216
// For EXTNET must be 1500-9216
// Required: false // Required: false
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"` MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`
// Net mask
// Used only to DPDK or VFNIC net type
// Required: false
NetMask uint64 `url:"netMask,omitempty" json:"netMask,omitempty"`
// SDN Segment ID
// Required: false
SDNSegmentID string `url:"sdn_segment_id,omitempty" json:"sdn_segment_id,omitempty"`
// SDN Object Group ID
// Required: false
SDNObjectGroupID string `url:"sdn_object_group_id,omitempty" json:"sdn_object_group_id,omitempty"`
// SDN Logical Port Display Name
// Required: false
SDNLogicalPortDisplayName string `url:"sdn_logical_port_display_name,omitempty" json:"sdn_logical_port_display_name,omitempty"`
// SDN Logical Port Description
// Required: false
SDNLogicalPortDescription string `url:"sdn_logical_port_description,omitempty" json:"sdn_logical_port_description,omitempty"`
// Unique identifier of logical port on SDN side // Unique identifier of logical port on SDN side
// Required: false // Required: false
SDNInterfaceID string `url:"sdn_interface_id,omitempty" json:"sdn_interface_id,omitempty" validate:"omitempty"` SDNInterfaceID string `url:"sdn_interface_id,omitempty" json:"sdn_interface_id,omitempty" validate:"omitempty"`

View File

@@ -20,7 +20,7 @@ type StartRequest struct {
// ID of node to start compute // ID of node to start compute
// Required: false // Required: false
NodeID uint64 `url:"nodeId,omitempty" json:"nodeId,omitempty"` NodeID uint64 `url:"node_id,omitempty" json:"node_id,omitempty"`
} }
// Start starts compute // Start starts compute

View File

@@ -33,7 +33,11 @@ type StartMigrationOutRequest struct {
// Mapping of guest disk target names to absolute paths on the destination host. // Mapping of guest disk target names to absolute paths on the destination host.
// Required: false // Required: false
Diskmap map[string]string `url:"diskmap,omitempty" json:"diskmap,omitempty"` DiskMap map[string]string `url:"diskmap,omitempty" json:"diskmap,omitempty"`
// Mapping of network interfaces
// Required: false
NetMap map[string]string `url:"netmap,omitempty" json:"netmap,omitempty"`
// Mapping for CD/DVD devices or their source paths to new ISO/device paths on the destination // Mapping for CD/DVD devices or their source paths to new ISO/device paths on the destination
// Required: false // Required: false

View File

@@ -69,6 +69,10 @@ type UpdateRequest struct {
// The OS version that will be installed on the virtual machine // The OS version that will be installed on the virtual machine
// Required: false // Required: false
OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"` OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"`
// Priority weight of the compute: higher value means higher priority and later migration
// Required: false
Weight uint64 `url:"weight,omitempty" json:"weight,omitempty"`
} }
// Update updates some properties of the compute // Update updates some properties of the compute

View File

@@ -37,6 +37,14 @@ type CreateRequest struct {
// Pool name to create disk // Pool name to create disk
// Required: false // Required: false
Pool string `url:"pool,omitempty" json:"pool,omitempty"` Pool string `url:"pool,omitempty" json:"pool,omitempty"`
// Cache mode of disk
// Required: false
Cache string `url:"cache,omitempty" json:"cache,omitempty"`
// BLK Discard
// Required: false
BLKDiscard interface{} `url:"blkdiscard,omitempty" json:"blkdiscard,omitempty" validate:"omitempty,isBool"`
} }
// Create creates a disk // Create creates a disk

View File

@@ -59,7 +59,6 @@ var disks = ListDisks{
Snapshots: []ItemSnapshot{}, Snapshots: []ItemSnapshot{},
Status: "ASSIGNED", Status: "ASSIGNED",
TechStatus: "ALLOCATED", TechStatus: "ALLOCATED",
Type: "B",
VMID: 48500, VMID: 48500,
}, },
}, },
@@ -120,7 +119,6 @@ var disks = ListDisks{
Snapshots: []ItemSnapshot{}, Snapshots: []ItemSnapshot{},
Status: "ASSIGNED", Status: "ASSIGNED",
TechStatus: "ALLOCATED", TechStatus: "ALLOCATED",
Type: "B",
VMID: 48502, VMID: 48502,
}, },
}, },

View File

@@ -38,10 +38,6 @@ type ListRequest struct {
// Required: false // Required: false
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"` AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
// Type of the disks
// Required: false
Type string `url:"type,omitempty" json:"type,omitempty"`
// Find by sep ID // Find by sep ID
// Required: false // Required: false
SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"` SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`
@@ -65,6 +61,14 @@ type ListRequest struct {
// Page size // Page size
// Required: false // Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty"` Size uint64 `url:"size,omitempty" json:"size,omitempty"`
// ID of the resource group
// Required: false
RGID uint64 `url:"rg_id,omitempty" json:"rg_id,omitempty"`
// ID of the compute
// Required: false
ComputeID uint64 `url:"compute_id,omitempty" json:"compute_id,omitempty"`
} }
// List gets list of the created disks belonging to an account as a ListDisks struct // List gets list of the created disks belonging to an account as a ListDisks struct

View File

@@ -34,10 +34,6 @@ type ListDeletedRequest struct {
// Required: false // Required: false
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"` AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
// Type of the disks
// Required: false
Type string `url:"type,omitempty" json:"type,omitempty"`
// Sort by one of supported fields, format +|-(field) // Sort by one of supported fields, format +|-(field)
// Required: false // Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"` SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`

View File

@@ -1,53 +0,0 @@
package disks
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// ListTypesRequest struct to get list of types of disks
type ListTypesRequest struct {
// Show detailed disk types by seps
// Required: false
Detailed bool `url:"detailed" json:"detailed"`
// Sort by one of supported fields, format +|-(field)
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
// Page size
// Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// ListTypes gets list of defined disk types
func (d Disks) ListTypes(ctx context.Context, req ListTypesRequest) (*ListTypes, error) {
if err := validators.ValidateRequest(req); err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/disks/listTypes"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
list := ListTypes{}
err = json.Unmarshal(res, &list)
if err != nil {
return nil, err
}
return &list, nil
}

View File

@@ -26,10 +26,6 @@ type ListUnattachedRequest struct {
// Required: false // Required: false
Status string `url:"status,omitempty" json:"status,omitempty"` Status string `url:"status,omitempty" json:"status,omitempty"`
// Type of the disks
// Required: false
Type string `url:"type,omitempty" json:"type,omitempty"`
// ID of the account // ID of the account
// Required: false // Required: false
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"` AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`

View File

@@ -53,6 +53,12 @@ type InfoDisk struct {
// Access Control Control // Access Control Control
ACL map[string]interface{} `json:"acl"` ACL map[string]interface{} `json:"acl"`
// BLK Discard
BLKDiscard bool `json:"blkdiscard"`
// Block size of disk
BlockSize string `json:"block_size"`
// Boot partition // Boot partition
BootPartition uint64 `json:"bootPartition"` BootPartition uint64 `json:"bootPartition"`
@@ -179,14 +185,14 @@ type InfoDisk struct {
// Need to clean before destroy // Need to clean before destroy
ToClean bool `json:"to_clean"` ToClean bool `json:"to_clean"`
// Type
Type string `json:"type"`
// Virtual machine ID // Virtual machine ID
VMID uint64 `json:"vmid"` VMID uint64 `json:"vmid"`
// Updated by // Updated by
UpdatedBy string `json:"updatedBy"` UpdatedBy string `json:"updatedBy"`
// Cache mode of disk
Cache string `json:"cache"`
} }
type ItemReplication struct { type ItemReplication struct {
@@ -212,6 +218,9 @@ type ItemReplication struct {
// Detailed indormation about disk // Detailed indormation about disk
type RecordDisk struct { type RecordDisk struct {
// Block size of disk
BlockSize string `json:"block_size"`
//Created by //Created by
CreatedBy string `json:"createdBy"` CreatedBy string `json:"createdBy"`
@@ -233,6 +242,9 @@ type RecordDisk struct {
// Main information about disk // Main information about disk
InfoDisk InfoDisk
// Independent
Independent bool `json:"independent"`
//Updated by //Updated by
UpdatedBy string `json:"updatedBy"` UpdatedBy string `json:"updatedBy"`
@@ -261,9 +273,6 @@ type SearchListDisks []ItemDisk
// Main information about unattached disk // Main information about unattached disk
type ItemUnattachedDisk struct { type ItemUnattachedDisk struct {
// CKey
CKey string `json:"_ckey"`
// Meta // Meta
Meta []interface{} `json:"_meta"` Meta []interface{} `json:"_meta"`
@@ -313,14 +322,6 @@ type ItemSnapshot struct {
// List snapshots // List snapshots
type ListSnapshots []ItemSnapshot type ListSnapshots []ItemSnapshot
type ListTypes struct {
// Data
Data []interface{} `json:"data"`
// Entry count
EntryCount uint64 `json:"entryCount"`
}
type MigrateStatus struct { type MigrateStatus struct {
// Type // Type
Type int `json:"type"` Type int `json:"type"`

View File

@@ -0,0 +1,50 @@
package disks
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// UpdateRequest struct to update disk
type UpdateRequest struct {
// ID of the disk to update
// Required: true
DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"`
// Cache mode of disk
// Required: false
Cache string `url:"cache,omitempty" json:"cache,omitempty"`
// BLK Discard
// Required: false
BLKDiscard interface{} `url:"blkdiscard,omitempty" json:"blkdiscard,omitempty" validate:"omitempty,isBool"`
// Block size of disk
// Required: false
BlockSize string `url:"block_size,omitempty" json:"block_size,omitempty"`
}
// Update updates disk
func (d Disks) Update(ctx context.Context, req UpdateRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/disks/update"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}

View File

@@ -34,10 +34,6 @@ type ListRequest struct {
// Required: false // Required: false
AccountId uint64 `url:"accountId,omitempty" json:"accountId,omitempty"` AccountId uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
// Find by resource group ID
// Required: false
RGID uint64 `url:"rgId,omitempty" json:"rgId,omitempty"`
// Find by id // Find by id
// Required: false // Required: false
ByID uint64 `url:"by_id,omitempty" json:"by_id,omitempty"` ByID uint64 `url:"by_id,omitempty" json:"by_id,omitempty"`

View File

@@ -85,12 +85,6 @@ type RecordFLIPGroup struct {
// Network // Network
Network string `json:"network"` Network string `json:"network"`
// Resource group ID
RGID uint64 `json:"rgId"`
// Resource group name
RGName string `json:"rgName"`
// Status // Status
Status string `json:"status"` Status string `json:"status"`

View File

@@ -11,7 +11,6 @@ var grids = ListGrids{
DiskSize: 976, DiskSize: 976,
DiskSizeMax: 1200, DiskSizeMax: 1200,
ExtIPs: 132, ExtIPs: 132,
ExtTraffic: 0,
GPU: 79500, GPU: 79500,
RAM: 0, RAM: 0,
SEPs: map[string]map[string]DiskUsage{}, SEPs: map[string]map[string]DiskUsage{},
@@ -21,7 +20,6 @@ var grids = ListGrids{
DiskSize: 976, DiskSize: 976,
DiskSizeMax: 1200, DiskSizeMax: 1200,
ExtIPs: 132, ExtIPs: 132,
ExtTraffic: 0,
GPU: 0, GPU: 0,
RAM: 152600, RAM: 152600,
SEPs: map[string]map[string]DiskUsage{}, SEPs: map[string]map[string]DiskUsage{},
@@ -41,7 +39,6 @@ var grids = ListGrids{
DiskSize: 976, DiskSize: 976,
DiskSizeMax: 1200, DiskSizeMax: 1200,
ExtIPs: 132, ExtIPs: 132,
ExtTraffic: 0,
GPU: 79500, GPU: 79500,
RAM: 0, RAM: 0,
SEPs: map[string]map[string]DiskUsage{}, SEPs: map[string]map[string]DiskUsage{},
@@ -51,7 +48,6 @@ var grids = ListGrids{
DiskSize: 976, DiskSize: 976,
DiskSizeMax: 1200, DiskSizeMax: 1200,
ExtIPs: 132, ExtIPs: 132,
ExtTraffic: 0,
GPU: 0, GPU: 0,
RAM: 152600, RAM: 152600,
SEPs: map[string]map[string]DiskUsage{}, SEPs: map[string]map[string]DiskUsage{},
@@ -71,7 +67,6 @@ var grids = ListGrids{
DiskSize: 976, DiskSize: 976,
DiskSizeMax: 1200, DiskSizeMax: 1200,
ExtIPs: 132, ExtIPs: 132,
ExtTraffic: 0,
GPU: 79500, GPU: 79500,
RAM: 0, RAM: 0,
SEPs: map[string]map[string]DiskUsage{}, SEPs: map[string]map[string]DiskUsage{},
@@ -81,7 +76,6 @@ var grids = ListGrids{
DiskSize: 976, DiskSize: 976,
DiskSizeMax: 1200, DiskSizeMax: 1200,
ExtIPs: 132, ExtIPs: 132,
ExtTraffic: 0,
GPU: 0, GPU: 0,
RAM: 152600, RAM: 152600,
SEPs: map[string]map[string]DiskUsage{}, SEPs: map[string]map[string]DiskUsage{},

View File

@@ -43,9 +43,6 @@ type RecordResource struct {
// External IPs // External IPs
ExtIPs uint64 `json:"extips"` ExtIPs uint64 `json:"extips"`
// External traffic
ExtTraffic uint64 `json:"exttraffic"`
// Number of GPU // Number of GPU
GPU uint64 `json:"gpu"` GPU uint64 `json:"gpu"`

View File

@@ -15,8 +15,8 @@ type PurgeLogsRequest struct {
GID uint64 `url:"gid" json:"gid" validate:"required"` GID uint64 `url:"gid" json:"gid" validate:"required"`
// Age of the records to remove, e.g. -1h for records older than 1 hour, -1w - one week, etc // Age of the records to remove, e.g. -1h for records older than 1 hour, -1w - one week, etc
// Required: true // Required: false
Age string `url:"age" json:"age" validate:"required"` Age string `url:"age,omitempty" json:"age,omitempty"`
} }
// PurgeLogs clear Log and ECO records that are older than the specified age. // PurgeLogs clear Log and ECO records that are older than the specified age.

View File

@@ -53,6 +53,9 @@ type RecordImage struct {
// ID // ID
ID uint64 `json:"id"` ID uint64 `json:"id"`
// Independent
Independent bool `json:"independent"`
// Last modified // Last modified
LastModified uint64 `json:"lastModified"` LastModified uint64 `json:"lastModified"`
@@ -185,6 +188,9 @@ type ItemImage struct {
// ID // ID
ID uint64 `json:"id"` ID uint64 `json:"id"`
// Independent
Independent bool `json:"independent"`
// Last modified // Last modified
LastModified uint64 `json:"lastModified"` LastModified uint64 `json:"lastModified"`

View File

@@ -37,6 +37,11 @@ type Interface struct {
// Required: false // Required: false
MAC string `url:"mac,omitempty" json:"mac,omitempty" validate:"omitempty"` MAC string `url:"mac,omitempty" json:"mac,omitempty" validate:"omitempty"`
// Net mask
// Used only to DPDK or VFNIC net type
// Required: false
NetMask uint64 `url:"netMask,omitempty" json:"netMask,omitempty"`
// SDN interface id // SDN interface id
// Required: false // Required: false
SDNInterfaceID string `url:"sdn_interface_id,omitempty" json:"sdn_interface_id,omitempty"` SDNInterfaceID string `url:"sdn_interface_id,omitempty" json:"sdn_interface_id,omitempty"`
@@ -52,6 +57,22 @@ 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"`
// SDN Segment ID
// Required: false
SDNSegmentID string `url:"sdn_segment_id,omitempty" json:"sdn_segment_id,omitempty"`
// SDN Object Group ID
// Required: false
SDNObjectGroupID string `url:"sdn_object_group_id,omitempty" json:"sdn_object_group_id,omitempty"`
// SDN Logical Port Display Name
// Required: false
SDNLogicalPortDisplayName string `url:"sdn_logical_port_display_name,omitempty" json:"sdn_logical_port_display_name,omitempty"`
// SDN Logical Port Description
// Required: false
SDNLogicalPortDescription string `url:"sdn_logical_port_description,omitempty" json:"sdn_logical_port_description,omitempty"`
} }
// DataDisk detailed struct for DataDisks field in CreateRequest, CreateBlankRequest and MassCreateRequest // DataDisk detailed struct for DataDisks field in CreateRequest, CreateBlankRequest and MassCreateRequest
@@ -85,6 +106,14 @@ type DataDisk struct {
// Specify image id for create disk from template // Specify image id for create disk from template
// Required: false // Required: false
ImageID uint64 `url:"imageId,omitempty" json:"imageId,omitempty"` ImageID uint64 `url:"imageId,omitempty" json:"imageId,omitempty"`
// Cache mode for disk
// Required: false
Cache string `url:"cache,omitempty" json:"cache,omitempty"`
// BLK Discard
// Required: false
BLKDiscard interface{} `url:"blkdiscard,omitempty" json:"blkdiscard,omitempty" validate:"omitempty,isBool"`
} }
// CreateRequest struct to create KVM x86 VM // CreateRequest struct to create KVM x86 VM
@@ -164,14 +193,6 @@ type CreateRequest struct {
// Required: false // Required: false
NodeID uint64 `url:"node_id,omitempty" json:"node_id,omitempty"` NodeID uint64 `url:"node_id,omitempty" json:"node_id,omitempty"`
// System name
// Required: false
IS string `url:"IS,omitempty" json:"IS,omitempty"`
// Compute purpose
// Required: false
IPAType string `url:"ipaType,omitempty" json:"ipaType,omitempty"`
// Custom fields for Compute. Must be dict // Custom fields for Compute. Must be dict
// Required: false // Required: false
CustomField string `url:"customFields,omitempty" json:"customFields,omitempty"` CustomField string `url:"customFields,omitempty" json:"customFields,omitempty"`
@@ -206,6 +227,19 @@ type CreateRequest struct {
// Zone ID // Zone ID
// Required: false // Required: false
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"` ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
// Cache mode for boot disk
// Required: false
BootDiskCache string `url:"boot_disk_cache,omitempty" json:"boot_disk_cache,omitempty"`
// Boot Disk BLK Discard
// Required: false
BootDiskBLKDiscard interface{} `url:"boot_disk_blkdiscard,omitempty" json:"boot_disk_blkdiscard,omitempty" validate:"omitempty,isBool"`
// Priority weight of the VM: higher value means higher priority and later migration
// Required: false
// Default: 1
Weight uint64 `url:"weight,omitempty" json:"weight,omitempty"`
} }
// GetRAM returns RAM field values // GetRAM returns RAM field values

View File

@@ -115,6 +115,19 @@ type CreateBlankRequest struct {
// The OS version that will be installed on the virtual machine // The OS version that will be installed on the virtual machine
// Required: false // Required: false
OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"` OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"`
// Cache mode for boot disk
// Required: false
BootDiskCache string `url:"boot_disk_cache,omitempty" json:"boot_disk_cache,omitempty"`
// Boot Disk BLK Discard
// Required: false
BootDiskBLKDiscard interface{} `url:"boot_disk_blkdiscard" json:"boot_disk_blkdiscard" validate:"omitempty,isBool"`
// Priority weight of the VM: higher value means higher priority and later migration
// Required: false
// Default: 1
Weight uint64 `url:"weight,omitempty" json:"weight,omitempty"`
} }
// GetRAM returns RAM field values // GetRAM returns RAM field values

View File

@@ -14,9 +14,13 @@ type InterfaceMassCreate struct {
// - VINS // - VINS
// - EXTNET // - EXTNET
// - TRUNK // - TRUNK
// - SDN
// For SDN, one of the fields sdn_interface_id or sdn_segment_id is specified, but not both at the same time
// Required: false
NetType string `url:"netType" json:"netType" validate:"required,massCreateNetType"` NetType string `url:"netType" json:"netType" validate:"required,massCreateNetType"`
// Network ID for connect // Network ID for connect
// Required: false
NetID uint64 `url:"netId" json:"netId" validate:"required"` NetID uint64 `url:"netId" json:"netId" validate:"required"`
// IP address to assign to this VM when connecting to the specified network // IP address to assign to this VM when connecting to the specified network
@@ -47,6 +51,22 @@ type InterfaceMassCreate 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"`
// SDN Segment ID
// Required: false
SDNSegmentID string `url:"sdn_segment_id,omitempty" json:"sdn_segment_id,omitempty"`
// SDN Object Group ID
// Required: false
SDNObjectGroupID string `url:"sdn_object_group_id,omitempty" json:"sdn_object_group_id,omitempty"`
// SDN Logical Port Display Name
// Required: false
SDNLogicalPortDisplayName string `url:"sdn_logical_port_display_name,omitempty" json:"sdn_logical_port_display_name,omitempty"`
// SDN Logical Port Description
// Required: false
SDNLogicalPortDescription string `url:"sdn_logical_port_description,omitempty" json:"sdn_logical_port_description,omitempty"`
} }
// MassCreateRequest struct to mass create KVM x86 // MassCreateRequest struct to mass create KVM x86
@@ -132,6 +152,19 @@ type MassCreateRequest struct {
// The OS version that will be installed on the virtual machine // The OS version that will be installed on the virtual machine
// Required: false // Required: false
OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"` OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"`
// Cache mode for boot disk
// Required: false
BootDiskCache string `url:"boot_disk_cache,omitempty" json:"boot_disk_cache,omitempty"`
// Boot Disk BLK Discard
// Required: false
BootDiskBLKDiscard interface{} `url:"boot_disk_blkdiscard" json:"boot_disk_blkdiscard" validate:"omitempty,isBool"`
// Priority weight of the VM: higher value means higher priority and later migration
// Required: false
// Default: 1
Weight uint64 `url:"weight,omitempty" json:"weight,omitempty"`
} }
type asyncWrapperMassCreateRequest struct { type asyncWrapperMassCreateRequest struct {

View File

@@ -30,8 +30,8 @@ type CreateRequest struct {
VINSID uint64 `url:"vinsId" json:"vinsId"` VINSID uint64 `url:"vinsId" json:"vinsId"`
// Start now Load balancer // Start now Load balancer
// Required: true // Required: false
Start bool `url:"start" json:"start" validate:"required"` Start interface{} `url:"start,omitempty" json:"start,omitempty" validate:"omitempty,isBool"`
// Custom sysctl values for Load Balancer instance. Applied on boot // Custom sysctl values for Load Balancer instance. Applied on boot
// Required: false // Required: false

View File

@@ -0,0 +1,42 @@
package node
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// AutoStartRequest struct to set node autostart
type AutoStartRequest struct {
// Node ID
// Required: true
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
// Auto start
// Required: true
AutoStart bool `url:"autostart" json:"autostart" validate:"required"`
}
// AutoStart sets node autostart
func (n Node) AutoStart(ctx context.Context, req AutoStartRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/node/autostart"
res, err := n.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}

View File

@@ -18,9 +18,9 @@ type EnableRequest struct {
Message string `url:"message,omitempty" json:"message,omitempty"` Message string `url:"message,omitempty" json:"message,omitempty"`
// Do not check locks, iscsi-sessions or disk-present // Do not check locks, iscsi-sessions or disk-present
// Default: true // Default: false
// Required: false // Required: false
Force interface{} `url:"force" json:"force" validate:"isBool" ` Force interface{} `url:"force" json:"force" validate:"isBool"`
// Reason // Reason
// Required: false // Required: false
@@ -41,7 +41,7 @@ func (n Node) Enable(ctx context.Context, req EnableRequest) (string, error) {
} }
if req.Force == nil { if req.Force == nil {
req.Force = true req.Force = false
} }
reqWrapped := wrapperEnableRequest{ reqWrapped := wrapperEnableRequest{
@@ -67,7 +67,7 @@ func (n Node) EnableAsync(ctx context.Context, req EnableRequest) (string, error
} }
if req.Force == nil { if req.Force == nil {
req.Force = true req.Force = false
} }
reqWrapped := wrapperEnableRequest{ reqWrapped := wrapperEnableRequest{

View File

@@ -49,6 +49,10 @@ type ListRequest struct {
// Page size // Page size
// Required: false // Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty"` Size uint64 `url:"size,omitempty" json:"size,omitempty"`
// Find by zone ID
// Required: false
ZoneID uint64 `url:"zone_id,omitempty" json:"zone_id,omitempty"`
} }
// List gets list of all nodes as a ListNodes struct // List gets list of all nodes as a ListNodes struct

View File

@@ -26,6 +26,11 @@ type MaintenanceRequest struct {
// Reason // Reason
// Required: false // Required: false
Reason string `url:"reason,omitempty" json:"reason,omitempty"` Reason string `url:"reason,omitempty" json:"reason,omitempty"`
// Allow node auto-enable
// Default: false
// Required: false
AutoStart bool `url:"autostart" json:"autostart"`
} }
// Maintenance places node in maintenance state // Maintenance places node in maintenance state

View File

@@ -26,6 +26,9 @@ type RecordNode struct {
// Isolated Cpus // Isolated Cpus
IsolatedCpus []interface{} `json:"isolatedCpus"` IsolatedCpus []interface{} `json:"isolatedCpus"`
// MemAllocationRatio
MemAllocationRatio float64 `json:"mem_allocation_ratio"`
// Name // Name
Name string `json:"name"` Name string `json:"name"`
@@ -82,6 +85,15 @@ type RecordNode struct {
// SDN Hypervisor Name // SDN Hypervisor Name
SDNHypervisorName string `json:"sdn_hypervisor_name"` SDNHypervisorName string `json:"sdn_hypervisor_name"`
// CPU used by the node
UsableCPUs []string `json:"usable_cpus"`
// AutoStart
AutoStart bool `json:"autostart"`
// AutoStart Count
AutoStartCount uint64 `json:"autostart_count"`
} }
// Resource consumption of the node // Resource consumption of the node
@@ -291,10 +303,19 @@ type ItemNode struct {
CPUAllocationRatio float64 `json:"cpu_allocation_ratio"` CPUAllocationRatio float64 `json:"cpu_allocation_ratio"`
// MemAllocationRatio // MemAllocationRatio
MemAllocationRatio float64 `json:"mem_allocation_ratio"` MemAllocationRatio float64 `json:"mem_allocation_ratio"`
// Packages // Packages
Packages map[string]PackageInfo `json:"packages"` Packages map[string]PackageInfo `json:"packages"`
// CPU used by the node
UsableCPUs []string `json:"usable_cpus"`
// AutoStart
AutoStart bool `json:"autostart"`
// AutoStart Count
AutoStartCount uint64 `json:"autostart_count"`
} }
type PackageInfo struct { type PackageInfo struct {

View File

@@ -5,13 +5,14 @@ import (
"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"
) )
type VFParam struct { type VFParam struct {
// Number of VF to assign // ID of the FN
// Required: true // Required: true
VFNum uint64 `url:"vfNum" json:"vfNum" validate:"required"` FNID uint64 `url:"fnId" json:"fnId" validate:"required"`
// Trust // Trust
// Required: true // Required: true
@@ -46,7 +47,7 @@ func (n Node) SetVFsParams(ctx context.Context, req SetVFsParamsRequest) (bool,
url := "/cloudbroker/node/setVFsParams" url := "/cloudbroker/node/setVFsParams"
res, err := n.client.DecortApiCall(ctx, http.MethodPost, url, req) res, err := n.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil { if err != nil {
return false, err return false, err

View File

@@ -35,9 +35,6 @@ type Reservation struct {
// External IPs // External IPs
ExtIPs int64 `json:"extips"` ExtIPs int64 `json:"extips"`
// External traffic
ExtTraffic int64 `json:"exttraffic"`
// Number of GPU // Number of GPU
GPU int64 `json:"gpu"` GPU int64 `json:"gpu"`
@@ -82,6 +79,9 @@ type ListResourceConsumption struct {
// Access Control List // Access Control List
type ACL struct { type ACL struct {
// Email
Email string `json:"email"`
// Explicit // Explicit
Explicit bool `json:"explicit"` Explicit bool `json:"explicit"`

View File

@@ -20,22 +20,22 @@ type AddConsumerNodesRequest struct {
} }
// AddConsumerNodes adds consumer nodes to SEP parameters // AddConsumerNodes adds consumer nodes to SEP parameters
func (s SEP) AddConsumerNodes(ctx context.Context, req AddConsumerNodesRequest) (bool, error) { func (s SEP) AddConsumerNodes(ctx context.Context, req AddConsumerNodesRequest) (uint64, error) {
err := validators.ValidateRequest(req) err := validators.ValidateRequest(req)
if err != nil { if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err)) return 0, validators.ValidationErrors(validators.GetErrors(err))
} }
url := "/cloudbroker/sep/addConsumerNodes" url := "/cloudbroker/sep/addConsumerNodes"
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req) res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil { if err != nil {
return false, err return 0, err
} }
result, err := strconv.ParseBool(string(res)) result, err := strconv.ParseUint(string(res), 10, 64)
if err != nil { if err != nil {
return false, err return 0, err
} }
return result, nil return result, nil

View File

@@ -20,22 +20,22 @@ type AddProviderNodesRequest struct {
} }
// AddProviderNodes adds provider nodes to SEP parameters // AddProviderNodes adds provider nodes to SEP parameters
func (s SEP) AddProviderNodes(ctx context.Context, req AddProviderNodesRequest) (bool, error) { func (s SEP) AddProviderNodes(ctx context.Context, req AddProviderNodesRequest) (uint64, error) {
err := validators.ValidateRequest(req) err := validators.ValidateRequest(req)
if err != nil { if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err)) return 0, validators.ValidationErrors(validators.GetErrors(err))
} }
url := "/cloudbroker/sep/addProviderNodes" url := "/cloudbroker/sep/addProviderNodes"
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req) res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil { if err != nil {
return false, err return 0, err
} }
result, err := strconv.ParseBool(string(res)) result, err := strconv.ParseUint(string(res), 10, 64)
if err != nil { if err != nil {
return false, err return 0, err
} }
return result, nil return result, nil

View File

@@ -20,7 +20,7 @@ type CreateRequest struct {
// Type of storage // Type of storage
// Required: true // Required: true
SEPType string `url:"sep_type" json:"sep_type" validate:"required"` SEPType string `url:"sep_type" json:"sep_type" validate:"required,sepType"`
// SEP config // SEP config
// Required: true // Required: true
@@ -30,14 +30,6 @@ type CreateRequest struct {
// Required: false // Required: false
Description string `url:"description,omitempty" json:"description,omitempty"` Description string `url:"description,omitempty" json:"description,omitempty"`
// List of provider node IDs
// Required: false
ProviderNIDs []uint64 `url:"provider_nids,omitempty" json:"provider_nids,omitempty"`
// List of consumer node IDs
// Required: false
ConsumerNIDs []uint64 `url:"consumer_nids,omitempty" json:"consumer_nids,omitempty"`
// Enable SEP after creation // Enable SEP after creation
// Required: false // Required: false
Enable bool `url:"enable,omitempty" json:"enable,omitempty"` Enable bool `url:"enable,omitempty" json:"enable,omitempty"`

View File

@@ -20,8 +20,8 @@ type DelConsumerNodesRequest struct {
// The force flag must be set to true only if the node will never come back online // The force flag must be set to true only if the node will never come back online
// Default: false // Default: false
// Required: true // Required: false
Force bool `url:"force" json:"force" validate:"required"` Force bool `url:"force" json:"force"`
} }
// DelConsumerNodes excludes consumer nodes from SEP parameters // DelConsumerNodes excludes consumer nodes from SEP parameters

View File

@@ -42,6 +42,9 @@ type ListRequest struct {
// Required: false // Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"` SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
// Sort by SEP IDs
SepIDs []uint64 `url:"sep_ids,omitempty" json:"sep_ids,omitempty"`
// Page size // Page size
// Required: false // Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty"` Size uint64 `url:"size,omitempty" json:"size,omitempty"`

View File

@@ -56,6 +56,10 @@ type ListRequest struct {
// Search by pool name // Search by pool name
// Required: false // Required: false
PoolName string `url:"pool_name,omitempty" json:"pool_name,omitempty"` PoolName string `url:"pool_name,omitempty" json:"pool_name,omitempty"`
// Filter SEP's by tech status (ENABLED, DISABLED)
// Required: false
SepTechStatus string `url:"sep_tech_status,omitempty" json:"sep_tech_status,omitempty" validate:"omitempty,sepTechStatus"`
} }
// List gets list of storage policies as a ListStoragePolicies struct // List gets list of storage policies as a ListStoragePolicies struct

View File

@@ -22,8 +22,8 @@ type InfoStoragePolicyWithID struct {
// Max IOPS for the sotrage policy // Max IOPS for the sotrage policy
LimitIOPS uint64 `json:"limit_iops"` LimitIOPS uint64 `json:"limit_iops"`
// ID of the storage policy // Which accounts and resource groups use the storage policy
StoragePolicyID uint64 `json:"storage_policy_id"` Usage Usage `json:"usage"`
} }
type ListStoragePolicies struct { type ListStoragePolicies struct {
@@ -103,6 +103,9 @@ type AccessSEPPool struct {
// Pool names // Pool names
PoolNames []string `json:"pool_names"` PoolNames []string `json:"pool_names"`
// Technical status of the SEP
SepTechStatus string `json:"sep_tech_status"`
} }
type Usage struct { type Usage struct {

View File

@@ -5,6 +5,7 @@ import (
"encoding/json" "encoding/json"
"net/http" "net/http"
"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"
) )
@@ -13,6 +14,10 @@ type UpdateRequest struct {
// Required: true // Required: true
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"` StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
// List of storage endpoint access objects
// Required: false
AccessSEPsPools []AccessSEPsPool `url:"access_seps_pools,omitempty" json:"access_seps_pools,omitempty"`
// New name for the storage policy // New name for the storage policy
// Required: false // Required: false
Name string `url:"name,omitempty" json:"name,omitempty"` Name string `url:"name,omitempty" json:"name,omitempty"`
@@ -51,6 +56,6 @@ func (sp StPolicy) UpdateRaw(ctx context.Context, req UpdateRequest) ([]byte, er
url := "/cloudbroker/storage_policy/update" url := "/cloudbroker/storage_policy/update"
res, err := sp.client.DecortApiCall(ctx, http.MethodPost, url, req) res, err := sp.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
return res, err return res, err
} }

View File

@@ -33,6 +33,11 @@ type CreateRequest struct {
// Native VLAN ID // Native VLAN ID
// Required: false // Required: false
NativeVLANID uint64 `url:"native_vlan_id,omitempty" json:"native_vlan_id,omitempty"` NativeVLANID uint64 `url:"native_vlan_id,omitempty" json:"native_vlan_id,omitempty"`
// MTU
// Default value: 1500
// Required: false
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty"`
} }
// Create creates a user. // Create creates a user.

View File

@@ -29,6 +29,9 @@ type ItemTrunk struct {
// MAC // MAC
MAC string `json:"mac"` MAC string `json:"mac"`
// MTU
MTU uint64 `json:"mtu"`
// Name of a trunk // Name of a trunk
Name string `json:"name"` Name string `json:"name"`

View File

@@ -15,12 +15,12 @@ type UpdateRequest struct {
TrunkID uint64 `url:"id" json:"id" validate:"required"` TrunkID uint64 `url:"id" json:"id" validate:"required"`
// New name of the trunk // New name of the trunk
// Required: true // Required: false
Name string `url:"name" json:"name" validate:"required"` Name string `url:"name,omitempty" json:"name,omitempty"`
// List of trunk tags (values between 1-4095) // List of trunk tags (values between 1-4095)
// Required: true // Required: false
TrunkTags string `url:"trunk_tags" json:"trunk_tags" validate:"required,trunkTags"` TrunkTags string `url:"trunk_tags,omitempty" json:"trunk_tags,omitempty" validate:"omitempty,trunkTags"`
// New description of the trunk // New description of the trunk
// Required: false // Required: false
@@ -29,6 +29,11 @@ type UpdateRequest struct {
// New native VLAN ID // New native VLAN ID
// Required: false // Required: false
NativeVLANID uint64 `url:"native_vlan_id,omitempty" json:"native_vlan_id,omitempty"` NativeVLANID uint64 `url:"native_vlan_id,omitempty" json:"native_vlan_id,omitempty"`
// MTU
// Default value: 1500
// Required: false
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty"`
} }
// Update updates a trunk // Update updates a trunk

View File

@@ -3,7 +3,6 @@ package user
import ( import (
"context" "context"
"net/http" "net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
) )
@@ -14,9 +13,9 @@ type CreateRequest struct {
// Required: true // Required: true
Username string `url:"username" json:"username" validate:"required"` Username string `url:"username" json:"username" validate:"required"`
// Email addresses of the user. // Email address of the user.
// Required: true // Required: true
EmailAddress []string `url:"emailaddress" json:"emailaddress" validate:"required"` EmailAddress string `url:"emailaddress" json:"emailaddress" validate:"required"`
// Password of user // Password of user
// Required: false // Required: false
@@ -34,23 +33,18 @@ type CreateRequest struct {
} }
// Create creates a user. // Create creates a user.
func (u User) Create(ctx context.Context, req CreateRequest) (bool, error) { func (u User) Create(ctx context.Context, req CreateRequest) (string, error) {
err := validators.ValidateRequest(req) err := validators.ValidateRequest(req)
if err != nil { if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err)) return "", validators.ValidationErrors(validators.GetErrors(err))
} }
url := "/cloudbroker/user/create" url := "/cloudbroker/user/create"
res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req) res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil { if err != nil {
return false, err return "", err
} }
result, err := strconv.ParseBool(string(res)) return string(res), nil
if err != nil {
return false, err
}
return result, nil
} }

View File

@@ -28,6 +28,11 @@ type GetAuditRequest struct {
// Required: false // Required: false
TimestampTo uint64 `url:"timestampTo,omitempty" json:"timestampTo,omitempty"` TimestampTo uint64 `url:"timestampTo,omitempty" json:"timestampTo,omitempty"`
// Sort by a field, format +|-(field)
// Default: -timestamp
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
// Page number. // Page number.
// Required: false // Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"` Page uint64 `url:"page,omitempty" json:"page,omitempty"`

View File

@@ -15,8 +15,8 @@ type GetMatchingUsernamesRequest struct {
UsernameRegex string `url:"usernameregex" json:"usernameregex" validate:"required"` UsernameRegex string `url:"usernameregex" json:"usernameregex" validate:"required"`
// The number of usernames to return. // The number of usernames to return.
// Required: true // Required: false
Limit uint64 `url:"limit" json:"limit" validate:"required"` Limit uint64 `url:"limit,omitempty" json:"limit,omitempty"`
} }
// GetMatchingUsernames gets a list of the matching usernames for a given string. // GetMatchingUsernames gets a list of the matching usernames for a given string.

View File

@@ -104,16 +104,16 @@ type ItemAudit struct {
Call string `json:"Call"` Call string `json:"Call"`
// Response time // Response time
ResponseTime ResponseTime `json:"Response Time"` ResponseTime ResponseTime `json:"responsetime"`
// StatusCode // StatusCode
StatusCode StatusCode `json:"Status Code"` StatusCode StatusCode `json:"statuscode"`
// Guid // Guid
GUID string `json:"Guid"` GUID string `json:"Guid"`
// Time // Time
Time float64 `json:"Time"` Time float64 `json:"timestampEnd"`
} }
type ListAudits struct { type ListAudits struct {

View File

@@ -17,6 +17,10 @@ type CreateRequest struct {
// Description // Description
// Required: false // Required: false
Description string `url:"description,omitempty" json:"description,omitempty"` Description string `url:"description,omitempty" json:"description,omitempty"`
// If true, all nodes belonging to the given zone will be marked for autostart
// Required: false
AutoStart interface{} `url:"autostart,omitempty" json:"autostart,omitempty" validate:"omitempty,isBool"`
} }
// Create creates zone object // Create creates zone object

View File

@@ -10,6 +10,9 @@ type ListZones struct {
// Detailed information about the zone record // Detailed information about the zone record
type RecordZone struct { type RecordZone struct {
// If true, all nodes belonging to the given zone will be marked for autostart
AutoStart bool `json:"autostart"`
// ID // ID
ID uint64 `json:"id"` ID uint64 `json:"id"`

View File

@@ -0,0 +1,43 @@
package zone
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// NodeAutoStartRequest struct to set node autostart in zone
type NodeAutoStartRequest struct {
// ID of zone
// Required: true
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
// AutoStart nodes in zone
// Required: true
AutoStart bool `url:"autostart" json:"autostart" validate:"required"`
}
// NodeAutoStart sets node autostart in zone
func (e Zone) NodeAutoStart(ctx context.Context, req NodeAutoStartRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/zone/node_autostart"
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}

Some files were not shown because too many files have changed in this diff Show More