Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c701001bb6 | ||
|
|
c2c810504d | ||
|
|
b834e5d074 | ||
| e1f0d354af | |||
|
|
d149ba19fd |
61
CHANGELOG.md
61
CHANGELOG.md
@@ -1,7 +1,6 @@
|
||||
## Version 1.13.6
|
||||
## 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 с соответствующими фильтрами
|
||||
Метод `ListNodes` в cloudbroker/image стал deprecated и в следующих версиях будет удалён
|
||||
Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke`, `AccessRevokeToPool` в cloudbroker/sep стали deprecated и в следующих версиях будут удалены
|
||||
Методы `ComputeCISet`, `ComputeCIUnset`, `GetAudits` в cloudbroker/compute и `GetAudits` в cloudapi/compute стали deprecated и будут удалены в следующих версиях
|
||||
Методы `ComputeCISet`, `ComputeCIUnset` в cloudbroker/image стали deprecated и будут удалены в следующих версиях
|
||||
@@ -10,49 +9,47 @@
|
||||
|
||||
### Добавлено
|
||||
|
||||
#### account
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-796 | Опциональное поле `CpuAllocationParameter` в структуру запроса `UpdateRequest` в cloudbroker/account |
|
||||
| BGOS-790 | Вычисляемое поле `UpdatedBy` в структуру ответа `ItemAccount` в cloudapi/account |
|
||||
|
||||
#### compute
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-751 | Опциональные поля `SDNSegmentID`, `SDNObjectGroupID`, `SDNLogicalPortDisplayName`, `SDNLogicalPortDescription` в структуры запроса в `Interface` в cloudapi/compute и в `Interface`, `InterfaceMassCreate` в cloudbroker/compute |
|
||||
| BGOS-752 | Опциональные поля `SDNSegmentID`, `SDNObjectGroupID`, `SDNLogicalPortDisplayName`, `SDNLogicalPortDescription` в структуру запроса `NetAttachRequest` в cloudapi/compute и в cloudbroker/compute |
|
||||
| BGOS-793 | Вычисляемые поля `Aborted` и `BlockcopyAbortJobID` в структуру ответа `RecordCloneAbort` в cloudbroker/compute |
|
||||
| BGOS-792 | Структуры ответа `RecordCloneAbort` и `ListCloneAbort` в cloudapi/compute |
|
||||
| BGOS-791 | Вычисляемое поле `Independent` в структуру ответа `ItemComputeDisk` в cloudapi/compute и в структуру ответа `ItemDisk` в cloudbroker/compute |
|
||||
|
||||
#### disks
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-735 | Вычисляемое поле `Cache` в структуры ответа `ItemDiskUnattached` в cloudapi/disks и в cloudbroker/disks |
|
||||
| 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>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-799 | Минимальное значение поля `MTU` в структуре запроса `NetAttachRequest` в cloudapi/compute и cloudbroker/compute с 1 на 1500 |
|
||||
| BGOS-792 | Тип возвращаемого значения метода `CloneAbort` с `bool` на `ListCloneAbort` в cloudapi/compute |
|
||||
|
||||
#### node
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-738 | Структура запроса `AutoStartRequest`, метод `AutoStart` в cloudbroker/node |
|
||||
| BGOS-738 | Опциональное поле `AutoStart` в структуру запроса `MaintenanceRequest` в cloudbroker/node |
|
||||
| BGOS-738 | Вычисляемые поля `AutoStart`, `AutoStartCount` в структуры ответов `ItemNode` и `RecordNode` в cloudbroker/node |
|
||||
| BGOS-746 | Вычисляемое поле `MemAllocationRatio` в структуру ответа `RecordNode` в cloudbroker/node |
|
||||
|
||||
#### zone
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-737 | Опциональное поле `AutoStart` в структуру запроса `UpdateRequest` в cloudbroker/zone |
|
||||
| BGOS-737 | Вычисляемое поле `AutoStart` в структуры ответа `RecordZone` в cloudapi/zone и в cloudbroker/zone |
|
||||
| BGOS-748 | Опциональное поле `AutoStart` в структуру запроса `CreateRequest` в cloudbroker/zone |
|
||||
| BGOS-743 | Структура запроса `NodeAutoStartRequest`, метод `NodeAutoStart` в cloudbroker/zone |
|
||||
|
||||
### Изменено
|
||||
|
||||
#### sep
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-740 | Тип поля `Force` с обязательного на опциональный в структуре запроса `DelConsumerNodesRequest` в cloudbroker/sep |
|
||||
| BGOS-789 | Дефолтное значение поля `Force` в структуре запроса `EnableRequest` в cloudbroker/node с `true` на `false` |
|
||||
|
||||
### Удалено
|
||||
|
||||
#### bservice
|
||||
#### compute
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-739 | Обязательное поле `Driver` в структурах запроса `GroupAddRequest` в cloudapi/bservice и в cloudbroker/bservice |
|
||||
|
||||
#### flipgroup
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-742 | Опциональное поле `RGID` из структуры запроса `ListRequest` в cloudapi/flipgroup и в cloudbroker/flipgroup |
|
||||
| BGOS-742 | Вычисляемые поля `RGName` и `RGID` из структуры ответа `RecordFLIPGroup` в cloudapi/flipgroup и в cloudbroker/flipgroup |
|
||||
| BGOS-793 | Вычисляемое поле `Status` из структуры ответа `RecordCloneAbort` в cloudbroker/compute |
|
||||
|
||||
11
README.md
11
README.md
@@ -18,6 +18,7 @@ Decort SDK - это библиотека, написанная на языке G
|
||||
- Версия 1.11.х Decort-SDK соответствует 4.3.0 версии платформы
|
||||
- Версия 1.12.х Decort-SDK соответствует 4.4.0 версии платформы
|
||||
- Версия 1.13.х Decort-SDK соответствует 4.5.0 версии платформы
|
||||
- Версия 1.14.х Decort-SDK соответствует 4.6.0 версии платформы
|
||||
|
||||
## Оглавление
|
||||
|
||||
@@ -466,16 +467,6 @@ type CreateRequest struct {
|
||||
// Node ID
|
||||
// Required: false
|
||||
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"`
|
||||
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ var FileName = map[string]string{
|
||||
var K8sValues = []string{"labels", "taints", "annotations, additionalSANs"}
|
||||
|
||||
var VersionMap = map[string]string{
|
||||
"4.6.0": "-",
|
||||
"4.5.0": "-",
|
||||
"4.4.0": "-",
|
||||
"4.3.0": "-",
|
||||
|
||||
@@ -86,13 +86,6 @@ func computeModeValidator(fe validator.FieldLevel) bool {
|
||||
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.
|
||||
func computeNetTypeValidator(fe validator.FieldLevel) bool {
|
||||
fieldValue := fe.Field().String()
|
||||
@@ -151,13 +144,6 @@ func computeDataDisksValidator(fe validator.FieldLevel) bool {
|
||||
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.
|
||||
func flipgroupClientTypeValidator(fe validator.FieldLevel) bool {
|
||||
fieldValue := fe.Field().String()
|
||||
|
||||
@@ -86,12 +86,6 @@ func errorMessage(fe validator.FieldError) string {
|
||||
fe.Field(),
|
||||
joinValues(computeModeValues))
|
||||
|
||||
case "computeDiskType":
|
||||
return fmt.Sprintf("%s %s must be one of the following: %s",
|
||||
prefix,
|
||||
fe.Field(),
|
||||
joinValues(computeDiskTypeValues))
|
||||
|
||||
case "mtu":
|
||||
return fmt.Sprint(prefix, fe.Field(), "must be ", mtuMin, "-", mtuMax)
|
||||
|
||||
@@ -122,13 +116,6 @@ func errorMessage(fe validator.FieldError) string {
|
||||
fe.Field(),
|
||||
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
|
||||
case "flipgroupClientType":
|
||||
return fmt.Sprintf("%s %s must be one of the following: %s",
|
||||
|
||||
@@ -86,11 +86,6 @@ func registerAllValidators(validate *validator.Validate) error {
|
||||
return err
|
||||
}
|
||||
|
||||
err = validate.RegisterValidation("computeDiskType", computeDiskTypeValidator)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = validate.RegisterValidation("computeNetType", computeNetTypeValidator)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -111,11 +106,6 @@ func registerAllValidators(validate *validator.Validate) error {
|
||||
return err
|
||||
}
|
||||
|
||||
err = validate.RegisterValidation("diskType", diskTypeValidator)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = validate.RegisterValidation("flipgroupClientType", flipgroupClientTypeValidator)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -14,14 +14,11 @@ var (
|
||||
computeTopologyValues = []string{"compute", "node"}
|
||||
computePolicyValues = []string{"RECOMMENDED", "REQUIRED"}
|
||||
computeModeValues = []string{"EQ", "EN", "ANY"}
|
||||
computeDiskTypeValues = []string{"D", "B"}
|
||||
computeNetTypeValues = []string{"EXTNET", "VINS"}
|
||||
computex86NetTypeValues = []string{"EXTNET", "VINS", "VFNIC", "DPDK", "SDN", "EMPTY", "TRUNK"}
|
||||
computeOrderValues = []string{"cdrom", "network", "hd"}
|
||||
computeDataDisksValues = []string{"KEEP", "DETACH", "DESTROY"}
|
||||
|
||||
diskTypeValues = []string{"B", "T", "D"}
|
||||
|
||||
flipgroupClientTypeValues = []string{"compute", "vins"}
|
||||
|
||||
massCreateNetTypeValues = []string{"EXTNET", "VINS", "TRUNK"}
|
||||
@@ -86,7 +83,7 @@ var (
|
||||
)
|
||||
|
||||
const (
|
||||
mtuMin = 1
|
||||
mtuMin = 1500
|
||||
mtuMax = 9216
|
||||
|
||||
trunkTagsMin = 1
|
||||
|
||||
@@ -95,6 +95,9 @@ type ItemAccount struct {
|
||||
// Deleted time
|
||||
DeletedTime uint64 `json:"deletedTime"`
|
||||
|
||||
// Deleted by
|
||||
DeletedBy string `json:"deletedBy"`
|
||||
|
||||
// Description
|
||||
Description string `json:"desc"`
|
||||
|
||||
@@ -107,6 +110,9 @@ type ItemAccount struct {
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Updated by
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
|
||||
// Updated time
|
||||
UpdatedTime uint64 `json:"updatedTime"`
|
||||
|
||||
@@ -299,6 +305,9 @@ type RecordAccount struct {
|
||||
// UniqPools
|
||||
UniqPools []interface{} `json:"uniqPools"`
|
||||
|
||||
// Updated By
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
|
||||
// Updated time
|
||||
UpdatedTime uint64 `json:"updatedTime"`
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
@@ -17,22 +17,24 @@ type CloneAbortRequest struct {
|
||||
}
|
||||
|
||||
// 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)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/clone_abort"
|
||||
|
||||
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
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 {
|
||||
return false, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
|
||||
@@ -26,13 +26,6 @@ type DiskAddRequest struct {
|
||||
// Required: true
|
||||
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
|
||||
// By default the same with boot disk
|
||||
// Required: false
|
||||
@@ -58,10 +51,6 @@ type DiskAddRequest struct {
|
||||
// Desired bus number (hex string, e.g. "0x03")
|
||||
// Required: false
|
||||
BusNumber string `url:"bus_number,omitempty" json:"bus_number,omitempty"`
|
||||
|
||||
// Disk cache mode
|
||||
// Required: false
|
||||
Cache string `url:"cache,omitempty" json:"cache,omitempty"`
|
||||
}
|
||||
|
||||
// DiskAdd creates new disk and attach to compute
|
||||
|
||||
@@ -18,10 +18,6 @@ type DiskAttachRequest struct {
|
||||
// Required: true
|
||||
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")
|
||||
// Required: false
|
||||
PCISlot string `url:"pci_slot,omitempty" json:"pci_slot,omitempty"`
|
||||
|
||||
@@ -545,6 +545,9 @@ type RecordCompute struct {
|
||||
// VNC password
|
||||
VNCPassword string `json:"vncPasswd"`
|
||||
|
||||
// Weight
|
||||
Weight uint64 `json:"weight"`
|
||||
|
||||
// Zone ID
|
||||
// Required: false
|
||||
ZoneID uint64 `json:"zoneId"`
|
||||
@@ -789,6 +792,12 @@ type ItemComputeDisk struct {
|
||||
// Account ID
|
||||
AccountID uint64 `json:"accountId"`
|
||||
|
||||
// BLK Discard
|
||||
BLKDiscard bool `json:"blkdiscard"`
|
||||
|
||||
// Block Size
|
||||
BlockSize string `json:"block_size"`
|
||||
|
||||
// Boot partition
|
||||
BootPartition uint64 `json:"bootPartition"`
|
||||
|
||||
@@ -834,6 +843,9 @@ type ItemComputeDisk struct {
|
||||
// Image ID
|
||||
ImageID uint64 `json:"imageId"`
|
||||
|
||||
// Independent
|
||||
Independent bool `json:"independent"`
|
||||
|
||||
// List image IDs
|
||||
Images []uint64 `json:"images"`
|
||||
|
||||
@@ -1229,6 +1241,9 @@ type ItemCompute struct {
|
||||
// VINS connected
|
||||
VINSConnected uint64 `json:"vinsConnected"`
|
||||
|
||||
// Weight
|
||||
Weight uint64 `json:"weight"`
|
||||
|
||||
// Zone ID
|
||||
ZoneID uint64 `json:"zoneId"`
|
||||
}
|
||||
@@ -1370,6 +1385,21 @@ type RecordCloneStatus struct {
|
||||
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
|
||||
Type int `json:"type"`
|
||||
|
||||
@@ -39,9 +39,8 @@ type NetAttachRequest struct {
|
||||
// Required: false
|
||||
MACAddr string `url:"mac_addr,omitempty" json:"mac_addr,omitempty"`
|
||||
|
||||
// Used only for EXTNET and DPDK
|
||||
// For DPDK must be 1-9216
|
||||
// For EXTNET must be 1500-9216
|
||||
// Used for EXTNET, TRUNK and DPDK
|
||||
// Must be 1500-9216
|
||||
// Required: false
|
||||
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`
|
||||
|
||||
|
||||
@@ -37,10 +37,6 @@ type CreateRequest struct {
|
||||
// Pool name to create disk
|
||||
// Required: false
|
||||
Pool string `url:"pool,omitempty" json:"pool,omitempty"`
|
||||
|
||||
// Cache mode of disk
|
||||
// Required: false
|
||||
Cache string `url:"cache,omitempty" json:"cache,omitempty"`
|
||||
}
|
||||
|
||||
// Create creates a disk
|
||||
|
||||
@@ -48,7 +48,6 @@ var disks = ListDisks{
|
||||
Snapshots: []ItemSnapshot{},
|
||||
Status: "ASSIGNED",
|
||||
TechStatus: techStatusAllocated,
|
||||
Type: "B",
|
||||
VMID: 48500,
|
||||
},
|
||||
{
|
||||
@@ -92,7 +91,6 @@ var disks = ListDisks{
|
||||
Snapshots: []ItemSnapshot{},
|
||||
Status: "ASSIGNED",
|
||||
TechStatus: techStatusAllocated,
|
||||
Type: "B",
|
||||
VMID: 48502,
|
||||
},
|
||||
},
|
||||
@@ -224,7 +222,6 @@ var searchDisks = ListSearchDisks{
|
||||
Snapshots: []ItemSnapshot{},
|
||||
Status: "ASSIGNED",
|
||||
TechStatus: techStatusAllocated,
|
||||
Type: "B",
|
||||
VMID: 48500,
|
||||
},
|
||||
ItemDisk{
|
||||
@@ -268,7 +265,6 @@ var searchDisks = ListSearchDisks{
|
||||
Snapshots: []ItemSnapshot{},
|
||||
Status: "ASSIGNED",
|
||||
TechStatus: techStatusAllocated,
|
||||
Type: "B",
|
||||
VMID: 48502,
|
||||
},
|
||||
}
|
||||
@@ -360,7 +356,6 @@ func TestListSearchDisks_SortByCreatedTime(t *testing.T) {
|
||||
var unattachedDisks = ListDisksUnattached{
|
||||
Data: []ItemDiskUnattached{
|
||||
{
|
||||
CKey: "",
|
||||
Meta: []interface{}{
|
||||
"cloudbroker",
|
||||
"disk",
|
||||
@@ -408,11 +403,9 @@ var unattachedDisks = ListDisksUnattached{
|
||||
Snapshots: nil,
|
||||
Status: "CREATED",
|
||||
TechStatus: techStatusAllocated,
|
||||
Type: "D",
|
||||
VMID: 0,
|
||||
},
|
||||
{
|
||||
CKey: "",
|
||||
Meta: []interface{}{
|
||||
"cloudbroker",
|
||||
"disk",
|
||||
@@ -463,7 +456,6 @@ var unattachedDisks = ListDisksUnattached{
|
||||
Snapshots: nil,
|
||||
Status: "CREATED",
|
||||
TechStatus: techStatusAllocated,
|
||||
Type: "B",
|
||||
VMID: 0,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -38,10 +38,6 @@ type ListRequest struct {
|
||||
// Required: false
|
||||
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
|
||||
// Required: false
|
||||
SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`
|
||||
@@ -65,6 +61,14 @@ type ListRequest struct {
|
||||
// Page size
|
||||
// Required: false
|
||||
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
|
||||
|
||||
@@ -34,10 +34,6 @@ type ListDeletedRequest struct {
|
||||
// Required: false
|
||||
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)
|
||||
// Required: false
|
||||
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -26,10 +26,6 @@ type ListUnattachedRequest struct {
|
||||
// Required: false
|
||||
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
|
||||
// Required: false
|
||||
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
|
||||
|
||||
@@ -11,6 +11,12 @@ type ItemDisk struct {
|
||||
// Account name
|
||||
AccountName string `json:"accountName"`
|
||||
|
||||
// BLK Discard
|
||||
BLKDiscard bool `json:"blkdiscard"`
|
||||
|
||||
// Block size of disk
|
||||
BlockSize string `json:"block_size"`
|
||||
|
||||
// Computes
|
||||
Computes map[string]string `json:"computes"`
|
||||
|
||||
@@ -44,6 +50,9 @@ type ItemDisk struct {
|
||||
// Image ID
|
||||
ImageID uint64 `json:"imageId"`
|
||||
|
||||
// Independent
|
||||
Independent bool `json:"independent"`
|
||||
|
||||
// List of image IDs
|
||||
Images []uint64 `json:"images"`
|
||||
|
||||
@@ -128,9 +137,6 @@ type ItemDisk struct {
|
||||
// Need to clean before destroy
|
||||
ToClean bool `json:"to_clean"`
|
||||
|
||||
// Type
|
||||
Type string `json:"type"`
|
||||
|
||||
// Virtual machine ID
|
||||
VMID uint64 `json:"vmid"`
|
||||
|
||||
@@ -145,9 +151,6 @@ type ItemDisk struct {
|
||||
}
|
||||
|
||||
type ItemDiskUnattached struct {
|
||||
// CKey
|
||||
CKey string `json:"_ckey"`
|
||||
|
||||
// Meta
|
||||
Meta []interface{} `json:"_meta"`
|
||||
|
||||
@@ -160,6 +163,12 @@ type ItemDiskUnattached struct {
|
||||
// Access Control List
|
||||
ACL map[string]interface{} `json:"acl"`
|
||||
|
||||
// BLK Discard
|
||||
BLKDiscard bool `json:"blkdiscard"`
|
||||
|
||||
// Block size of disk
|
||||
BlockSize string `json:"block_size"`
|
||||
|
||||
// Boot Partition
|
||||
BootPartition uint64 `json:"bootPartition"`
|
||||
|
||||
@@ -274,8 +283,11 @@ type ItemDiskUnattached struct {
|
||||
// Tech status
|
||||
TechStatus string `json:"techStatus"`
|
||||
|
||||
// Type
|
||||
Type string `json:"type"`
|
||||
// Need to clean before destroy
|
||||
ToClean bool `json:"to_clean"`
|
||||
|
||||
// ID of the Storage Policy
|
||||
StoragePolicyID uint64 `json:"storage_policy_id"`
|
||||
|
||||
// Virtual machine ID
|
||||
VMID uint64 `json:"vmid"`
|
||||
@@ -381,6 +393,12 @@ type RecordDisk struct {
|
||||
// Account name
|
||||
AccountName string `json:"accountName"`
|
||||
|
||||
// BLK Discard
|
||||
BLKDiscard bool `json:"blkdiscard"`
|
||||
|
||||
// Block size of disk
|
||||
BlockSize string `json:"block_size"`
|
||||
|
||||
// Computes
|
||||
Computes map[string]string `json:"computes"`
|
||||
|
||||
@@ -414,6 +432,9 @@ type RecordDisk struct {
|
||||
// Image ID
|
||||
ImageID uint64 `json:"imageId"`
|
||||
|
||||
// Independent
|
||||
Independent bool `json:"independent"`
|
||||
|
||||
// List of image IDs
|
||||
Images []uint64 `json:"images"`
|
||||
|
||||
@@ -498,9 +519,6 @@ type RecordDisk struct {
|
||||
// Need to clean before destroy
|
||||
ToClean bool `json:"to_clean"`
|
||||
|
||||
// Type
|
||||
Type string `json:"type"`
|
||||
|
||||
// Virtual machine ID
|
||||
VMID uint64 `json:"vmid"`
|
||||
|
||||
@@ -533,11 +551,3 @@ type ItemReplication struct {
|
||||
// VolumeID
|
||||
VolumeID string `json:"volumeId"`
|
||||
}
|
||||
|
||||
type ListTypes struct {
|
||||
// Data
|
||||
Data []interface{} `json:"data"`
|
||||
|
||||
// Entry count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
@@ -92,9 +92,6 @@ type RecordImage struct {
|
||||
// UNCPathj
|
||||
UNCPath string `json:"UNCPath"`
|
||||
|
||||
// CKey
|
||||
CKey string `json:"_ckey"`
|
||||
|
||||
// Account ID
|
||||
AccountID uint64 `json:"accountId"`
|
||||
|
||||
@@ -143,6 +140,9 @@ type RecordImage struct {
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Independent
|
||||
Independent bool `json:"independent"`
|
||||
|
||||
// Last modified
|
||||
LastModified uint64 `json:"lastModified"`
|
||||
|
||||
|
||||
@@ -183,14 +183,6 @@ type CreateRequest struct {
|
||||
// Required: false
|
||||
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
|
||||
// Required: false
|
||||
CustomFields string `url:"customFields,omitempty" json:"customFields,omitempty"`
|
||||
@@ -225,10 +217,6 @@ type CreateRequest struct {
|
||||
// Zone ID
|
||||
// Required: false
|
||||
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"`
|
||||
}
|
||||
|
||||
// GetRAM returns RAM field values
|
||||
|
||||
@@ -115,10 +115,6 @@ type CreateBlankRequest struct {
|
||||
// The OS version that will be installed on the virtual machine
|
||||
// Required: false
|
||||
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"`
|
||||
}
|
||||
|
||||
// GetRAM returns RAM field values
|
||||
|
||||
@@ -267,6 +267,9 @@ type ListResourceGroups struct {
|
||||
|
||||
// Main information about Access Control List
|
||||
type ItemACL struct {
|
||||
// Email
|
||||
Email string `json:"email"`
|
||||
|
||||
// Explicit
|
||||
Explicit bool `json:"explicit"`
|
||||
|
||||
|
||||
@@ -215,6 +215,9 @@ type InfoAccount struct {
|
||||
// UniqPools
|
||||
UniqPools []string `json:"uniqPools"`
|
||||
|
||||
// Updated By
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
|
||||
// UpdatedTime
|
||||
UpdatedTime uint64 `json:"updatedTime"`
|
||||
|
||||
|
||||
@@ -64,6 +64,10 @@ type UpdateRequest struct {
|
||||
// Default zone ID
|
||||
// Required: false
|
||||
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
|
||||
|
||||
47
pkg/cloudbroker/compute/check_compute_placement.go
Normal file
47
pkg/cloudbroker/compute/check_compute_placement.go
Normal 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
|
||||
}
|
||||
@@ -2,8 +2,8 @@ package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
@@ -17,22 +17,24 @@ type CloneAbortRequest struct {
|
||||
}
|
||||
|
||||
// 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)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/clone_abort"
|
||||
|
||||
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
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 {
|
||||
return false, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
|
||||
@@ -31,13 +31,6 @@ type DiskAddRequest struct {
|
||||
// Required: true
|
||||
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
|
||||
// By default will be chosen automatically
|
||||
// Required: false
|
||||
@@ -62,6 +55,10 @@ type DiskAddRequest struct {
|
||||
// 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
|
||||
|
||||
@@ -18,10 +18,6 @@ type DiskAttachRequest struct {
|
||||
// Required: true
|
||||
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")
|
||||
// Required: false
|
||||
PCISlot string `url:"pci_slot,omitempty" json:"pci_slot,omitempty"`
|
||||
|
||||
@@ -391,6 +391,12 @@ type ItemDisk struct {
|
||||
// Access Control List
|
||||
ACL ItemACL `json:"acl"`
|
||||
|
||||
// BLK Discard
|
||||
BLKDiscard bool `json:"blkdiscard"`
|
||||
|
||||
// Block Size
|
||||
BlockSize string `json:"block_size"`
|
||||
|
||||
// Boot partition
|
||||
BootPartition uint64 `json:"bootPartition"`
|
||||
|
||||
@@ -436,6 +442,9 @@ type ItemDisk struct {
|
||||
// Image ID
|
||||
ImageID uint64 `json:"imageId"`
|
||||
|
||||
// Independent
|
||||
Independent bool `json:"independent"`
|
||||
|
||||
// List image IDs
|
||||
Images []uint64 `json:"images"`
|
||||
|
||||
@@ -885,6 +894,9 @@ type InfoCompute struct {
|
||||
// VINS connected
|
||||
VINSConnected uint64 `json:"vinsConnected"`
|
||||
|
||||
// Weight
|
||||
Weight uint64 `json:"weight"`
|
||||
|
||||
// Zone ID
|
||||
ZoneID uint64 `json:"zoneId"`
|
||||
}
|
||||
@@ -1172,6 +1184,9 @@ type RecordCompute struct {
|
||||
// VNC password
|
||||
VNCPassword string `json:"vncPasswd"`
|
||||
|
||||
// Weight
|
||||
Weight uint64 `json:"weight"`
|
||||
|
||||
// Zone ID
|
||||
ZoneID uint64 `json:"zoneId"`
|
||||
|
||||
@@ -1463,6 +1478,17 @@ type MigrateStorageItem struct {
|
||||
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 {
|
||||
// Disk ID
|
||||
DiskID int `json:"disk_id"`
|
||||
@@ -1490,3 +1516,20 @@ type CloneStatus struct {
|
||||
// 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
|
||||
|
||||
@@ -39,9 +39,8 @@ type NetAttachRequest struct {
|
||||
// Required: false
|
||||
MACAddr string `url:"mac_addr,omitempty" json:"mac_addr,omitempty"`
|
||||
|
||||
// Used only for EXTNET and DPDK
|
||||
// For DPDK must be 1-9216
|
||||
// For EXTNET must be 1500-9216
|
||||
// Used for EXTNET, TRUNK and DPDK
|
||||
// Must be 1500-9216
|
||||
// Required: false
|
||||
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`
|
||||
|
||||
|
||||
@@ -69,6 +69,10 @@ type UpdateRequest struct {
|
||||
// The OS version that will be installed on the virtual machine
|
||||
// Required: false
|
||||
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
|
||||
|
||||
@@ -41,6 +41,10 @@ type CreateRequest struct {
|
||||
// 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
|
||||
|
||||
@@ -59,7 +59,6 @@ var disks = ListDisks{
|
||||
Snapshots: []ItemSnapshot{},
|
||||
Status: "ASSIGNED",
|
||||
TechStatus: "ALLOCATED",
|
||||
Type: "B",
|
||||
VMID: 48500,
|
||||
},
|
||||
},
|
||||
@@ -120,7 +119,6 @@ var disks = ListDisks{
|
||||
Snapshots: []ItemSnapshot{},
|
||||
Status: "ASSIGNED",
|
||||
TechStatus: "ALLOCATED",
|
||||
Type: "B",
|
||||
VMID: 48502,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -38,10 +38,6 @@ type ListRequest struct {
|
||||
// Required: false
|
||||
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
|
||||
// Required: false
|
||||
SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`
|
||||
@@ -65,6 +61,14 @@ type ListRequest struct {
|
||||
// Page size
|
||||
// Required: false
|
||||
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
|
||||
|
||||
@@ -34,10 +34,6 @@ type ListDeletedRequest struct {
|
||||
// Required: false
|
||||
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)
|
||||
// Required: false
|
||||
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
|
||||
|
||||
@@ -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
|
||||
|
||||
}
|
||||
@@ -26,10 +26,6 @@ type ListUnattachedRequest struct {
|
||||
// Required: false
|
||||
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
|
||||
// Required: false
|
||||
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
|
||||
|
||||
@@ -53,6 +53,12 @@ type InfoDisk struct {
|
||||
// Access Control Control
|
||||
ACL map[string]interface{} `json:"acl"`
|
||||
|
||||
// BLK Discard
|
||||
BLKDiscard bool `json:"blkdiscard"`
|
||||
|
||||
// Block size of disk
|
||||
BlockSize string `json:"block_size"`
|
||||
|
||||
// Boot partition
|
||||
BootPartition uint64 `json:"bootPartition"`
|
||||
|
||||
@@ -179,9 +185,6 @@ type InfoDisk struct {
|
||||
// Need to clean before destroy
|
||||
ToClean bool `json:"to_clean"`
|
||||
|
||||
// Type
|
||||
Type string `json:"type"`
|
||||
|
||||
// Virtual machine ID
|
||||
VMID uint64 `json:"vmid"`
|
||||
|
||||
@@ -215,6 +218,9 @@ type ItemReplication struct {
|
||||
// Detailed indormation about disk
|
||||
type RecordDisk struct {
|
||||
|
||||
// Block size of disk
|
||||
BlockSize string `json:"block_size"`
|
||||
|
||||
//Created by
|
||||
CreatedBy string `json:"createdBy"`
|
||||
|
||||
@@ -236,6 +242,9 @@ type RecordDisk struct {
|
||||
// Main information about disk
|
||||
InfoDisk
|
||||
|
||||
// Independent
|
||||
Independent bool `json:"independent"`
|
||||
|
||||
//Updated by
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
|
||||
@@ -264,9 +273,6 @@ type SearchListDisks []ItemDisk
|
||||
|
||||
// Main information about unattached disk
|
||||
type ItemUnattachedDisk struct {
|
||||
// CKey
|
||||
CKey string `json:"_ckey"`
|
||||
|
||||
// Meta
|
||||
Meta []interface{} `json:"_meta"`
|
||||
|
||||
@@ -316,14 +322,6 @@ type ItemSnapshot struct {
|
||||
// List snapshots
|
||||
type ListSnapshots []ItemSnapshot
|
||||
|
||||
type ListTypes struct {
|
||||
// Data
|
||||
Data []interface{} `json:"data"`
|
||||
|
||||
// Entry count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
type MigrateStatus struct {
|
||||
// Type
|
||||
Type int `json:"type"`
|
||||
|
||||
@@ -17,6 +17,14 @@ type UpdateRequest struct {
|
||||
// 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
|
||||
|
||||
@@ -53,6 +53,9 @@ type RecordImage struct {
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Independent
|
||||
Independent bool `json:"independent"`
|
||||
|
||||
// Last modified
|
||||
LastModified uint64 `json:"lastModified"`
|
||||
|
||||
@@ -185,6 +188,9 @@ type ItemImage struct {
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Independent
|
||||
Independent bool `json:"independent"`
|
||||
|
||||
// Last modified
|
||||
LastModified uint64 `json:"lastModified"`
|
||||
|
||||
|
||||
@@ -106,6 +106,14 @@ type DataDisk struct {
|
||||
// Specify image id for create disk from template
|
||||
// Required: false
|
||||
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
|
||||
@@ -185,14 +193,6 @@ type CreateRequest struct {
|
||||
// Required: false
|
||||
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
|
||||
// Required: false
|
||||
CustomField string `url:"customFields,omitempty" json:"customFields,omitempty"`
|
||||
@@ -231,6 +231,15 @@ type CreateRequest struct {
|
||||
// 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
|
||||
|
||||
@@ -119,6 +119,15 @@ type CreateBlankRequest struct {
|
||||
// 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
|
||||
|
||||
@@ -156,6 +156,15 @@ type MassCreateRequest struct {
|
||||
// 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 {
|
||||
|
||||
@@ -18,9 +18,9 @@ type EnableRequest struct {
|
||||
Message string `url:"message,omitempty" json:"message,omitempty"`
|
||||
|
||||
// Do not check locks, iscsi-sessions or disk-present
|
||||
// Default: true
|
||||
// Default: false
|
||||
// Required: false
|
||||
Force interface{} `url:"force" json:"force" validate:"isBool" `
|
||||
Force interface{} `url:"force" json:"force" validate:"isBool"`
|
||||
|
||||
// Reason
|
||||
// Required: false
|
||||
@@ -41,7 +41,7 @@ func (n Node) Enable(ctx context.Context, req EnableRequest) (string, error) {
|
||||
}
|
||||
|
||||
if req.Force == nil {
|
||||
req.Force = true
|
||||
req.Force = false
|
||||
}
|
||||
|
||||
reqWrapped := wrapperEnableRequest{
|
||||
@@ -67,7 +67,7 @@ func (n Node) EnableAsync(ctx context.Context, req EnableRequest) (string, error
|
||||
}
|
||||
|
||||
if req.Force == nil {
|
||||
req.Force = true
|
||||
req.Force = false
|
||||
}
|
||||
|
||||
reqWrapped := wrapperEnableRequest{
|
||||
|
||||
@@ -49,6 +49,10 @@ type ListRequest struct {
|
||||
// Page size
|
||||
// Required: false
|
||||
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
|
||||
|
||||
@@ -79,6 +79,9 @@ type ListResourceConsumption struct {
|
||||
|
||||
// Access Control List
|
||||
type ACL struct {
|
||||
// Email
|
||||
Email string `json:"email"`
|
||||
|
||||
// Explicit
|
||||
Explicit bool `json:"explicit"`
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ type InfoStoragePolicyWithID struct {
|
||||
// Max IOPS for the sotrage policy
|
||||
LimitIOPS uint64 `json:"limit_iops"`
|
||||
|
||||
// ID of the storage policy
|
||||
StoragePolicyID uint64 `json:"storage_policy_id"`
|
||||
// Which accounts and resource groups use the storage policy
|
||||
Usage Usage `json:"usage"`
|
||||
}
|
||||
|
||||
type ListStoragePolicies struct {
|
||||
|
||||
@@ -62,10 +62,18 @@ type ListRequest struct {
|
||||
// Required: false
|
||||
CreatedFrom string `url:"created_from,omitempty" json:"created_from,omitempty"`
|
||||
|
||||
// Filter lby create date to
|
||||
// Filter by create date to
|
||||
// Required: false
|
||||
CreatedTo string `url:"created_to,omitempty" json:"created_to,omitempty"`
|
||||
|
||||
// Filter by operation status
|
||||
// Required: false
|
||||
OperationStatus string `url:"operation_status,omitempty" json:"operation_status,omitempty"`
|
||||
|
||||
// Filter by hypervisor status
|
||||
// Required: false
|
||||
HypervisorStatus string `url:"hypervisor_status,omitempty" json:"hypervisor_status,omitempty"`
|
||||
|
||||
// Page number for pagination
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
62
pkg/sdn/netobjgroups/attach_l2_connection_ports.go
Normal file
62
pkg/sdn/netobjgroups/attach_l2_connection_ports.go
Normal file
@@ -0,0 +1,62 @@
|
||||
package netobjgroups
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// AttachL2ConnectionPortsRequest struct to attach l2 ports to a network object group
|
||||
type AttachL2ConnectionPortsRequest struct {
|
||||
// ID of a network object group
|
||||
// Required: true
|
||||
ObjectGroupID string `url:"object_group_id" json:"object_group_id" validate:"required"`
|
||||
|
||||
// ID of an access group
|
||||
// Required: true
|
||||
AccessGroupID string `url:"access_group_id" json:"access_group_id" validate:"required"`
|
||||
|
||||
// Version ID
|
||||
// Required: true
|
||||
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
|
||||
|
||||
// Port Bindings
|
||||
// Required: true
|
||||
PortBindings []L2PortBindings `url:"port_bindings" json:"port_bindings" validate:"required,dive"`
|
||||
}
|
||||
type L2PortBindings struct {
|
||||
// ID of a logical port
|
||||
// Required: true
|
||||
PortID string `url:"port_id" json:"port_id" validate:"required"`
|
||||
|
||||
// Version of a logical port
|
||||
// Required: true
|
||||
PortVersion int64 `url:"port_version" json:"port_version" validate:"required"`
|
||||
}
|
||||
|
||||
// AttachLogicalPorts attaches l2 ports to a network object group
|
||||
func (nog NetworkObjectGroups) AttachL2ConnectionPorts(ctx context.Context, req AttachL2ConnectionPortsRequest) (*RecordVersion, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/sdn/network_object_group/attach_l2_connection_ports"
|
||||
|
||||
res, err := nog.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := RecordVersion{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
62
pkg/sdn/netobjgroups/detach_l2_connection_ports.go
Normal file
62
pkg/sdn/netobjgroups/detach_l2_connection_ports.go
Normal file
@@ -0,0 +1,62 @@
|
||||
package netobjgroups
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// DetachL2ConnectionPortsRequest struct to detach an l2 port from a network object group
|
||||
type DetachL2ConnectionPortsRequest struct {
|
||||
// ID of a network object group
|
||||
// Required: true
|
||||
ObjectGroupID string `url:"object_group_id" json:"object_group_id" validate:"required"`
|
||||
|
||||
// ID of an access group
|
||||
// Required: true
|
||||
AccessGroupID string `url:"access_group_id" json:"access_group_id" validate:"required"`
|
||||
|
||||
// Version ID
|
||||
// Required: true
|
||||
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
|
||||
|
||||
// Port Bindings
|
||||
// Required: true
|
||||
PortBindings []DetachL2PortBindings `url:"port_bindings" json:"port_bindings" validate:"required,dive"`
|
||||
}
|
||||
type DetachL2PortBindings struct {
|
||||
// ID of a logical port
|
||||
// Required: true
|
||||
PortID string `url:"port_id" json:"port_id" validate:"required"`
|
||||
|
||||
// Version of a logical port
|
||||
// Required: true
|
||||
PortVersion int64 `url:"port_version" json:"port_version" validate:"required"`
|
||||
}
|
||||
|
||||
// DetachL2ConnectionPorts detaches logical ports from a network object group
|
||||
func (nog NetworkObjectGroups) DetachL2ConnectionPorts(ctx context.Context, req DetachL2ConnectionPortsRequest) (*RecordVersion, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/sdn/network_object_group/detach_l2_connection_ports"
|
||||
|
||||
res, err := nog.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := RecordVersion{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
7
tests/platform_upgrade/platform_tests_start.sh
Normal file
7
tests/platform_upgrade/platform_tests_start.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
go test -v -run TestGetListCloudAPI > TestGetListCloudAPI.txt
|
||||
go test -v -run TestGetListCloudbroker > TestGetListCloudbroker.txt
|
||||
go test -v -run TestGetListSDNAPI > TestGetListSDNAPI.txt
|
||||
go test -v -run TestRequestsCloudAPI > TestRequestsCloudAPI.txt
|
||||
go test -v -run TestRequestsCloudbroker > TestRequestsCloudbroker.txt
|
||||
go test -v -run TestRequestsSDN > TestRequestsSDN.txt
|
||||
go test -v -run TestGetAllPaths > TestGetAllPaths.txt
|
||||
@@ -237,7 +237,6 @@ func getRequestsMapCloudAPI() map[string]interface{} {
|
||||
"/restmachine/cloudapi/disks/limitIO": disks.LimitIORequest{},
|
||||
"/restmachine/cloudapi/disks/list": disks.ListRequest{},
|
||||
"/restmachine/cloudapi/disks/listDeleted": disks.ListDeletedRequest{},
|
||||
"/restmachine/cloudapi/disks/listTypes": disks.ListTypesRequest{},
|
||||
"/restmachine/cloudapi/disks/listUnattached": disks.ListUnattachedRequest{},
|
||||
"/restmachine/cloudapi/disks/rename": disks.RenameRequest{},
|
||||
"/restmachine/cloudapi/disks/replicate": disks.ReplicateRequest{},
|
||||
@@ -570,6 +569,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
||||
"/restmachine/cloudbroker/compute/cdInsert": compute_cb.CDInsertRequest{},
|
||||
"/restmachine/cloudbroker/compute/changeLinkState": compute_cb.ChangeLinkStateRequest{},
|
||||
"/restmachine/cloudbroker/compute/change_mtu": compute_cb.ChangeMTURequest{},
|
||||
"/restmachine/cloudbroker/compute/check_compute_placement": compute_cb.CheckComputePlacementRequest{},
|
||||
"/restmachine/cloudbroker/compute/change_security_groups": compute_cb.ChangeSecGroupsRequest{},
|
||||
"/restmachine/cloudbroker/compute/clone": compute_cb.CloneRequest{},
|
||||
"/restmachine/cloudbroker/compute/clone_abort": compute_cb.CloneAbortRequest{},
|
||||
@@ -672,7 +672,6 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
||||
"/restmachine/cloudbroker/disks/limitIO": disks_cb.LimitIORequest{},
|
||||
"/restmachine/cloudbroker/disks/list": disks_cb.ListRequest{},
|
||||
"/restmachine/cloudbroker/disks/listDeleted": disks_cb.ListDeletedRequest{},
|
||||
"/restmachine/cloudbroker/disks/listTypes": disks_cb.ListTypesRequest{},
|
||||
"/restmachine/cloudbroker/disks/listUnattached": disks_cb.ListUnattachedRequest{},
|
||||
"/restmachine/cloudbroker/disks/rename": disks_cb.RenameRequest{},
|
||||
"/restmachine/cloudbroker/disks/present": disks_cb.PresentRequest{},
|
||||
@@ -1165,6 +1164,8 @@ func getRequestsMapSDN() map[string]interface{} {
|
||||
"/restmachine/sdn/network_object_group/get": netobjgroups.GetRequest{},
|
||||
"/restmachine/sdn/network_object_group/list": netobjgroups.ListRequest{},
|
||||
"/restmachine/sdn/network_object_group/update": netobjgroups.UpdateRequest{},
|
||||
"/restmachine/sdn/network_object_group/attach_l2_connection_ports": netobjgroups.AttachL2ConnectionPortsRequest{},
|
||||
"/restmachine/sdn/network_object_group/detach_l2_connection_ports": netobjgroups.DetachL2ConnectionPortsRequest{},
|
||||
|
||||
// segments
|
||||
"/restmachine/sdn/segment/create": segments.CreateRequest{},
|
||||
|
||||
Reference in New Issue
Block a user