Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
365a4991d2 | ||
| bb90a2d511 | |||
|
|
f111bf25fc |
70
CHANGELOG.md
70
CHANGELOG.md
@@ -1,71 +1,53 @@
|
|||||||
## Version 1.13.1
|
## Version 1.13.4
|
||||||
|
|
||||||
Методы `Audits` в cloudapi/compute, cloudbroker/compute, cloudapi/account, cloudbroker/account, cloudapi/vins, cloudbroker/vins, cloudapi/rg и cloudbroker/rg стали deprecated и в следующих версиях будут удалены, вместо них необходимо использовать метод `List` в cloudapi/audit и cloudbroker/audit с соответствующими фильтрами
|
Методы `Audits` в cloudapi/compute, cloudbroker/compute, cloudapi/account, cloudbroker/account, cloudapi/vins, cloudbroker/vins, cloudapi/rg и cloudbroker/rg стали deprecated и в следующих версиях будут удалены, вместо них необходимо использовать метод `List` в cloudapi/audit и cloudbroker/audit с соответствующими фильтрами
|
||||||
Метод `ListNodes` в cloudbroker/image стал deprecated и в следующих версиях будет удалён
|
Метод `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/computeGetAudits и `GetAudits` в cloudbroker/compute стали deprecated и будут удалены в следующих версиях
|
||||||
|
|
||||||
Все методы группы `.SDN()` находятся в альфа-версии.
|
Все методы группы `.SDN()` находятся в альфа-версии.
|
||||||
|
|
||||||
### Добавлено
|
### Добавлено
|
||||||
|
|
||||||
#### account
|
#### compute
|
||||||
| Идентификатор<br>задачи | Описание |
|
|
||||||
| --- | ---|
|
|
||||||
| BGOS-686 | Поле `Policies` в структуры ответа `LimitsRG` в cloudapi/account и `Limits` в cloudbroker/account |
|
|
||||||
|
|
||||||
#### access groups
|
|
||||||
| Идентификатор<br>задачи | Описание |
|
| Идентификатор<br>задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-693 | Поле `OwnerDisplayName` в структуру запроса `ListGroupsRequest` и поле `Comment` в структуру ответа `AccessGroupItem` |
|
| BGOS-732 | Опциональное поле `NetMask` в структуру запроса `NetAttachRequest` в cloudapi/compute |
|
||||||
|
| BGOS-727 | Опциональное поле `Cache` в структуру запроса `DiskAddRequest` в cloudapi/compute и в cloudbroker/compute |
|
||||||
|
| BGOS-727 | Поле `Cache` в структуры ответа `ItemComputeDisk` в cloudapi/compute и в `ItemDisk` в cloudbroker/compute |
|
||||||
|
|
||||||
#### backup
|
#### disks
|
||||||
| Идентификатор<br>задачи | Описание |
|
| Идентификатор<br>задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-688 | Опциональное поле `NodeID` в структуры запросов `RestoreDiskFromBackupRequest` и `RestoreDisksFromBackupRequest` в cloudbroker/backup |
|
| BGOS-725 | Структура запроса `UpdateRequest`, метод `Update` в cloudbroker/disks |
|
||||||
|
| BGOS-725 | Опциональное поле `Cache` в структуру запроса `CreateRequest` в cloudapi/disks и в cloudbroker/disks |
|
||||||
|
| BGOS-725 | Поле `Cache` в структуру ответа `InfoDisk` в cloudbroker/disks |
|
||||||
|
| BGOS-725 | Поле `Cache` в структуры ответа `RecordDisk`,`ItemDisk` в cloudapi/disks |
|
||||||
|
|
||||||
#### node
|
#### kvmx86
|
||||||
| Идентификатор<br>задачи | Описание |
|
| Идентификатор<br>задачи | Описание |
|
||||||
| --- | ---|
|
| --- | --- |
|
||||||
| BGOS-691 | Поле `UsableCPUs` в структурах ответа `RecordNode` и `ItemNode` в cloudbroker/node |
|
| BGOS-727 | Опциональное поле `BootDiskCache` в структуры запроса `CreateRequest`, `CreateBlankRequest` в cloudapi/kvmx86 и в cloudbroker/kvmx86 |
|
||||||
|
| BGOS-727 | Опциональное поле `BootDiskCache` в структуру запроса `MassCreateRequest` в cloudbroker/kvmx86 |
|
||||||
#### storage policy
|
|
||||||
| Идентификатор<br>задачи | Описание |
|
|
||||||
| --- | ---|
|
|
||||||
| BGOS-690 | Поле `SepTechStatus` в структуру `AccessSEPPool` в структуре ответа `ItemStoragePolicy` в cloudapi/stpolicy и в cloudbroker/stpolicy |
|
|
||||||
|
|
||||||
#### user
|
|
||||||
| Идентификатор<br>задачи | Описание |
|
|
||||||
| --- | ---|
|
|
||||||
| BGOS-692 | Поле `SortBy` в структуру запроса `GetAuditRequest` в cloudbroker/user |
|
|
||||||
|
|
||||||
### Изменено
|
### Изменено
|
||||||
|
|
||||||
#### user
|
#### bservice
|
||||||
| Идентификатор<br>задачи | Описание |
|
|
||||||
| --- | ---|
|
|
||||||
| BGOS-700 | Изменен тип поля `EmailAddress` с `[]string` на `string` в структуре запроса `CreateRequest` в cloudbroker/user |
|
|
||||||
| BGOS-700 | Изменен тип возвращаемого значения метода `Create` с `bool` на `string` в cloudbroker/user |
|
|
||||||
|
|
||||||
### Удалено
|
|
||||||
|
|
||||||
#### account
|
|
||||||
| Идентификатор<br>задачи | Описание |
|
|
||||||
| --- | ---|
|
|
||||||
| BGOS-686 | Поле `CUNP` из структуры ответа `ResourceLimits` в cloudapi/account и cloudbroker/account |
|
|
||||||
| BGOS-686 | Поле `ExtTraffic` из структур ответа `Resource` и `LimitsRG` в cloudapi/account и `Resource` и `Limits` в cloudbroker/account |
|
|
||||||
|
|
||||||
#### grid
|
|
||||||
| Идентификатор<br>задачи | Описание |
|
| Идентификатор<br>задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-686 | Поле `ExtTraffic` из структуры ответа `RecordResource` в cloudbroker/grid |
|
| BGOS-728 | Тип полей `Chipset` и `Mode` с обязательного на опциональный в структуре запроса `GroupResizeRequest` в cloudapi/bservice и в cloudbroker/bservice |
|
||||||
|
|
||||||
#### rg
|
#### lb
|
||||||
| Идентификатор<br>задачи | Описание |
|
| Идентификатор<br>задачи | Описание |
|
||||||
| --- | ---|
|
| --- | --- |
|
||||||
| BGOS-686 | Поле `ExtTraffic` из структур ответа `Resource` и `RecordResourceUsage` в cloudapi/rg и `Reservation` в cloudbroker/rg |
|
| BGOS-733 | Тип поля `Start` с обязательного на опциональный в структуре запроса `CreateRequest`в cloudapi/lb и в cloudbroker/lb |
|
||||||
|
|
||||||
|
#### trunk
|
||||||
|
| Идентификатор<br>задачи | Описание |
|
||||||
|
| --- | --- |
|
||||||
|
| BGOS-730 | Тип полей `Name` и `TrunkTags` с обязательного на опциональный в структуре запроса `UpdateRequest` в cloudbroker/trunk |
|
||||||
|
|
||||||
#### user
|
#### user
|
||||||
| Идентификатор<br>задачи | Описание |
|
| Идентификатор<br>задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-686 | Поле `ExtTraffic` из структуры ответа `Resources` в cloudapi/user |
|
| BGOS-729 | Тип поля `Limit` с обязательного на опциональный в структуре запроса `GetMatchingUsernamesRequest` в cloudbroker/user |
|
||||||
@@ -471,3 +471,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)
|
||||||
|
}
|
||||||
|
|||||||
@@ -366,6 +366,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()
|
||||||
|
|||||||
@@ -311,5 +311,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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,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,6 +81,8 @@ 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 (
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -58,6 +58,10 @@ 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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiskAdd creates new disk and attach to compute
|
// DiskAdd creates new disk and attach to compute
|
||||||
|
|||||||
@@ -795,6 +795,9 @@ type ItemComputeDisk struct {
|
|||||||
// 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"`
|
||||||
|
|
||||||
@@ -1237,6 +1240,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
|
||||||
|
|||||||
@@ -45,6 +45,11 @@ type NetAttachRequest 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"`
|
||||||
|
|
||||||
// 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"`
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ 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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create creates a disk
|
// Create creates a disk
|
||||||
|
|||||||
@@ -139,6 +139,9 @@ 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 {
|
||||||
@@ -503,6 +506,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 {
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ 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"`
|
||||||
@@ -204,6 +209,10 @@ 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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRAM returns RAM field values
|
// GetRAM returns RAM field values
|
||||||
|
|||||||
@@ -115,6 +115,10 @@ 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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRAM returns RAM field values
|
// GetRAM returns RAM field values
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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"`
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -58,6 +58,10 @@ 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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiskAdd creates new disk and attach to compute
|
// DiskAdd creates new disk and attach to compute
|
||||||
|
|||||||
@@ -397,6 +397,9 @@ type ItemDisk struct {
|
|||||||
// 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"`
|
||||||
|
|
||||||
@@ -841,7 +844,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"`
|
||||||
@@ -1171,6 +1174,9 @@ type RecordCompute struct {
|
|||||||
|
|
||||||
// Zone ID
|
// Zone ID
|
||||||
ZoneID uint64 `json:"zoneId"`
|
ZoneID uint64 `json:"zoneId"`
|
||||||
|
|
||||||
|
//todo
|
||||||
|
_ uint64 `json:"nodeId"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type LoaderMetaIso struct {
|
type LoaderMetaIso struct {
|
||||||
@@ -1280,6 +1286,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
|
||||||
|
|||||||
@@ -45,6 +45,11 @@ type NetAttachRequest 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"`
|
||||||
|
|
||||||
// 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"`
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ 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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create creates a disk
|
// Create creates a disk
|
||||||
|
|||||||
@@ -187,6 +187,9 @@ type InfoDisk 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 {
|
||||||
|
|||||||
42
pkg/cloudbroker/disks/update.go
Normal file
42
pkg/cloudbroker/disks/update.go
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
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"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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
|
||||||
|
}
|
||||||
@@ -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.
|
||||||
|
|||||||
@@ -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"`
|
||||||
@@ -206,6 +211,10 @@ 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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRAM returns RAM field values
|
// GetRAM returns RAM field values
|
||||||
|
|||||||
@@ -115,6 +115,10 @@ 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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRAM returns RAM field values
|
// GetRAM returns RAM field values
|
||||||
|
|||||||
@@ -132,6 +132,10 @@ 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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type asyncWrapperMassCreateRequest struct {
|
type asyncWrapperMassCreateRequest struct {
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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"`
|
||||||
|
|||||||
@@ -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"`
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
@@ -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"`
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
@@ -8,9 +8,11 @@
|
|||||||
- [Тесты Raw методов (Get, List)](#тесты-raw-методов-get-list)
|
- [Тесты Raw методов (Get, List)](#тесты-raw-методов-get-list)
|
||||||
- [Cloudapi](#cloudapi)
|
- [Cloudapi](#cloudapi)
|
||||||
- [Cloudbroker](#cloudbroker)
|
- [Cloudbroker](#cloudbroker)
|
||||||
|
- [SDN](#sdn)
|
||||||
- [Тесты запросов](#тесты-запросов)
|
- [Тесты запросов](#тесты-запросов)
|
||||||
- [Cloudapi](#cloudapi-1)
|
- [Cloudapi](#cloudapi-1)
|
||||||
- [Cloudbroker](#cloudbroker-1)
|
- [Cloudbroker](#cloudbroker-1)
|
||||||
|
- [SDN](#sdn-1)
|
||||||
- [Тесты API методов](#тесты-api-методов)
|
- [Тесты API методов](#тесты-api-методов)
|
||||||
|
|
||||||
## Подготовка к тестам
|
## Подготовка к тестам
|
||||||
@@ -46,6 +48,13 @@
|
|||||||
Запустить тест `TestGetListCloudbroker` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
|
Запустить тест `TestGetListCloudbroker` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
|
||||||
При наличии подсвеченных полей, проверить, что они содержатся на платформе и не содержатся в go структурах, завести и исправить ошибку.
|
При наличии подсвеченных полей, проверить, что они содержатся на платформе и не содержатся в go структурах, завести и исправить ошибку.
|
||||||
|
|
||||||
|
### SDN
|
||||||
|
|
||||||
|
Запустить тест `TestGetListSDNAPI` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
|
||||||
|
При наличии подсвеченных полей, проверить, что они содержатся на платформе и не содержатся в go структурах, завести и исправить ошибку.
|
||||||
|
|
||||||
|
Пример вывода аналогичен тестам для Cloudapi и Cloudbroker.
|
||||||
|
|
||||||
## Тесты запросов
|
## Тесты запросов
|
||||||
|
|
||||||
### Cloudapi
|
### Cloudapi
|
||||||
@@ -89,6 +98,13 @@ FAIL
|
|||||||
FAIL
|
FAIL
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### SDN
|
||||||
|
|
||||||
|
Запустить тест `TestRequestsSDN` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
|
||||||
|
При наличии подсвеченных ошибок, проверить, что они являются ошибками (возможны ситуации, когда расхождение платформы и sdk задумано специально), завести и исправить ошибку.
|
||||||
|
|
||||||
|
Пример вывода аналогичен тестам для Cloudapi и Cloudbroker.
|
||||||
|
|
||||||
## Тесты API методов
|
## Тесты API методов
|
||||||
|
|
||||||
Запустить тест `TestGetAllPaths` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
|
Запустить тест `TestGetAllPaths` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
|
|||||||
"/restmachine/cloudapi/bservice/snapshotRollback": bservice.SnapshotRollbackRequest{},
|
"/restmachine/cloudapi/bservice/snapshotRollback": bservice.SnapshotRollbackRequest{},
|
||||||
"/restmachine/cloudapi/bservice/start": bservice.StartRequest{},
|
"/restmachine/cloudapi/bservice/start": bservice.StartRequest{},
|
||||||
"/restmachine/cloudapi/bservice/stop": bservice.StopRequest{},
|
"/restmachine/cloudapi/bservice/stop": bservice.StopRequest{},
|
||||||
|
"/restmachine/cloudapi/bservice/migrateToZone": bservice.MigrateToZoneRequest{},
|
||||||
// compute
|
// compute
|
||||||
"/restmachine/cloudapi/compute/abort_shared_snapshot_merge": compute.AbortSharedSnapshotMergeRequest{},
|
"/restmachine/cloudapi/compute/abort_shared_snapshot_merge": compute.AbortSharedSnapshotMergeRequest{},
|
||||||
"/restmachine/cloudapi/compute/shared_snapshot_merge_status": compute.SharedSnapshotMergeStatusRequest{},
|
"/restmachine/cloudapi/compute/shared_snapshot_merge_status": compute.SharedSnapshotMergeStatusRequest{},
|
||||||
@@ -194,7 +194,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
|
|||||||
"/restmachine/cloudapi/compute/pfwDel": compute.PFWDelRequest{},
|
"/restmachine/cloudapi/compute/pfwDel": compute.PFWDelRequest{},
|
||||||
"/restmachine/cloudapi/compute/pfwList": compute.PFWListRequest{},
|
"/restmachine/cloudapi/compute/pfwList": compute.PFWListRequest{},
|
||||||
"/restmachine/cloudapi/compute/pause": compute.PauseRequest{},
|
"/restmachine/cloudapi/compute/pause": compute.PauseRequest{},
|
||||||
"/restmachine/cloudapi/compute/pinToNode": compute.PinToNodeRequest{},
|
"/restmachine/cloudapi/compute/pin_to_node": compute.PinToNodeRequest{},
|
||||||
"/restmachine/cloudapi/compute/powerCycle": compute.PowerCycleRequest{},
|
"/restmachine/cloudapi/compute/powerCycle": compute.PowerCycleRequest{},
|
||||||
"/restmachine/cloudapi/compute/reboot": compute.RebootRequest{},
|
"/restmachine/cloudapi/compute/reboot": compute.RebootRequest{},
|
||||||
"/restmachine/cloudapi/compute/redeploy": compute.RedeployRequest{},
|
"/restmachine/cloudapi/compute/redeploy": compute.RedeployRequest{},
|
||||||
@@ -212,7 +212,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
|
|||||||
"/restmachine/cloudapi/compute/stop": compute.StopRequest{},
|
"/restmachine/cloudapi/compute/stop": compute.StopRequest{},
|
||||||
"/restmachine/cloudapi/compute/tagAdd": compute.TagAddRequest{},
|
"/restmachine/cloudapi/compute/tagAdd": compute.TagAddRequest{},
|
||||||
"/restmachine/cloudapi/compute/tagRemove": compute.TagRemoveRequest{},
|
"/restmachine/cloudapi/compute/tagRemove": compute.TagRemoveRequest{},
|
||||||
"/restmachine/cloudapi/compute/unpinFromNode": compute.UnpinFromNodeRequest{},
|
"/restmachine/cloudapi/compute/unpin_from_node": compute.UnpinFromNodeRequest{},
|
||||||
"/restmachine/cloudapi/compute/update": compute.UpdateRequest{},
|
"/restmachine/cloudapi/compute/update": compute.UpdateRequest{},
|
||||||
"/restmachine/cloudapi/compute/userGrant": compute.UserGrantRequest{},
|
"/restmachine/cloudapi/compute/userGrant": compute.UserGrantRequest{},
|
||||||
"/restmachine/cloudapi/compute/userList": compute.UserListRequest{},
|
"/restmachine/cloudapi/compute/userList": compute.UserListRequest{},
|
||||||
@@ -225,6 +225,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
|
|||||||
"/restmachine/cloudapi/compute/guest_agent_execute": compute.GuestAgentExecuteRequest{},
|
"/restmachine/cloudapi/compute/guest_agent_execute": compute.GuestAgentExecuteRequest{},
|
||||||
"/restmachine/cloudapi/compute/guest_agent_feature_get": compute.GuestAgentFeatureGetRequest{},
|
"/restmachine/cloudapi/compute/guest_agent_feature_get": compute.GuestAgentFeatureGetRequest{},
|
||||||
"/restmachine/cloudapi/compute/guest_agent_feature_update": compute.GuestAgentFeatureUpdateRequest{},
|
"/restmachine/cloudapi/compute/guest_agent_feature_update": compute.GuestAgentFeatureUpdateRequest{},
|
||||||
|
"/restmachine/cloudapi/compute/migrateToZone": compute.MigrateToZoneRequest{},
|
||||||
|
|
||||||
// disks
|
// disks
|
||||||
"/restmachine/cloudapi/disks/change_disk_storage_policy": disks.ChangeDiskStoragePolicyRequest{},
|
"/restmachine/cloudapi/disks/change_disk_storage_policy": disks.ChangeDiskStoragePolicyRequest{},
|
||||||
@@ -314,6 +315,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
|
|||||||
"/restmachine/cloudapi/k8s/workersGroupGetByName": k8s.WorkersGroupGetByNameRequest{},
|
"/restmachine/cloudapi/k8s/workersGroupGetByName": k8s.WorkersGroupGetByNameRequest{},
|
||||||
"/restmachine/cloudapi/k8s/workerReset": k8s.WorkerResetRequest{},
|
"/restmachine/cloudapi/k8s/workerReset": k8s.WorkerResetRequest{},
|
||||||
"/restmachine/cloudapi/k8s/workerRestart": k8s.WorkerRestartRequest{},
|
"/restmachine/cloudapi/k8s/workerRestart": k8s.WorkerRestartRequest{},
|
||||||
|
"/restmachine/cloudapi/k8s/migrateToZone": k8s.MigrateToZoneRequest{},
|
||||||
|
|
||||||
// kvmx86
|
// kvmx86
|
||||||
"/restmachine/cloudapi/kvmx86/create": kvmx86.CreateRequest{},
|
"/restmachine/cloudapi/kvmx86/create": kvmx86.CreateRequest{},
|
||||||
@@ -346,6 +348,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
|
|||||||
"/restmachine/cloudapi/lb/stop": lb.StopRequest{},
|
"/restmachine/cloudapi/lb/stop": lb.StopRequest{},
|
||||||
"/restmachine/cloudapi/lb/update": lb.UpdateRequest{},
|
"/restmachine/cloudapi/lb/update": lb.UpdateRequest{},
|
||||||
"/restmachine/cloudapi/lb/updateSysctlParams": lb.UpdateSysctParamsRequest{},
|
"/restmachine/cloudapi/lb/updateSysctlParams": lb.UpdateSysctParamsRequest{},
|
||||||
|
"/restmachine/cloudapi/lb/migrateToZone": lb.MigrateToZoneRequest{},
|
||||||
|
|
||||||
// locations
|
// locations
|
||||||
"/restmachine/cloudapi/locations/getUrl": EmptyStruct{},
|
"/restmachine/cloudapi/locations/getUrl": EmptyStruct{},
|
||||||
@@ -465,6 +468,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
|
|||||||
"/restmachine/cloudapi/vins/staticRouteList": vins.StaticRouteListRequest{},
|
"/restmachine/cloudapi/vins/staticRouteList": vins.StaticRouteListRequest{},
|
||||||
"/restmachine/cloudapi/vins/vnfdevRedeploy": vins.VNFDevRedeployRequest{},
|
"/restmachine/cloudapi/vins/vnfdevRedeploy": vins.VNFDevRedeployRequest{},
|
||||||
"/restmachine/cloudapi/vins/vnfdevRestart": vins.VNFDevRestartRequest{},
|
"/restmachine/cloudapi/vins/vnfdevRestart": vins.VNFDevRestartRequest{},
|
||||||
|
"/restmachine/cloudapi/vins/migrateToZone": vins.MigrateToZoneRequest{},
|
||||||
|
|
||||||
// zone
|
// zone
|
||||||
"/restmachine/cloudapi/zone/get": zone.GetRequest{},
|
"/restmachine/cloudapi/zone/get": zone.GetRequest{},
|
||||||
@@ -508,6 +512,8 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
|||||||
"/restmachine/cloudbroker/account/updateComputeFeatures": account_cb.UpdateComputeFeaturesRequest{},
|
"/restmachine/cloudbroker/account/updateComputeFeatures": account_cb.UpdateComputeFeaturesRequest{},
|
||||||
"/restmachine/cloudbroker/account/updateResourceTypes": account_cb.UpdateResourceTypesRequest{},
|
"/restmachine/cloudbroker/account/updateResourceTypes": account_cb.UpdateResourceTypesRequest{},
|
||||||
"/restmachine/cloudbroker/account/updateUser": account_cb.UpdateUserRequest{},
|
"/restmachine/cloudbroker/account/updateUser": account_cb.UpdateUserRequest{},
|
||||||
|
"/restmachine/cloudbroker/account/addZone": account_cb.AddZoneRequest{},
|
||||||
|
"/restmachine/cloudbroker/account/removeZone": account_cb.RemoveZoneRequest{},
|
||||||
|
|
||||||
// apiaccess_cb
|
// apiaccess_cb
|
||||||
"/restmachine/cloudbroker/apiaccess/apisExclude": apiaccess_cb.APIsExcludeRequest{},
|
"/restmachine/cloudbroker/apiaccess/apisExclude": apiaccess_cb.APIsExcludeRequest{},
|
||||||
@@ -650,6 +656,10 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
|||||||
"/restmachine/cloudbroker/compute/guest_agent_feature_get": compute_cb.GuestAgentFeatureGetRequest{},
|
"/restmachine/cloudbroker/compute/guest_agent_feature_get": compute_cb.GuestAgentFeatureGetRequest{},
|
||||||
"/restmachine/cloudbroker/compute/guest_agent_feature_update": compute_cb.GuestAgentFeatureUpdateRequest{},
|
"/restmachine/cloudbroker/compute/guest_agent_feature_update": compute_cb.GuestAgentFeatureUpdateRequest{},
|
||||||
"/restmachine/cloudbroker/compute/change_read_only": compute_cb.ChangeReadOnlyRequest{},
|
"/restmachine/cloudbroker/compute/change_read_only": compute_cb.ChangeReadOnlyRequest{},
|
||||||
|
"/restmachine/cloudbroker/compute/migrateToZone": compute_cb.MigrateToZoneRequest{},
|
||||||
|
"/restmachine/cloudbroker/compute/migrate_abort": compute_cb.MigrateAbortRequest{},
|
||||||
|
"/restmachine/cloudbroker/compute/start_migration_out": compute_cb.StartMigrationOutRequest{},
|
||||||
|
"/restmachine/cloudbroker/compute/stop_migration_out": compute_cb.StopMigrationOutRequest{},
|
||||||
|
|
||||||
// disks
|
// disks
|
||||||
"/restmachine/cloudbroker/disks/change_disk_storage_policy": disks_cb.ChangeDiskStoragePolicyRequest{},
|
"/restmachine/cloudbroker/disks/change_disk_storage_policy": disks_cb.ChangeDiskStoragePolicyRequest{},
|
||||||
@@ -683,6 +693,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
|||||||
"/restmachine/cloudbroker/disks/migrate": disks_cb.MigrateRequest{},
|
"/restmachine/cloudbroker/disks/migrate": disks_cb.MigrateRequest{},
|
||||||
"/restmachine/cloudbroker/disks/migrate_abort": disks_cb.MigrateAbortRequest{},
|
"/restmachine/cloudbroker/disks/migrate_abort": disks_cb.MigrateAbortRequest{},
|
||||||
"/restmachine/cloudbroker/disks/migrate_status": disks_cb.GetMigrateStatusRequest{},
|
"/restmachine/cloudbroker/disks/migrate_status": disks_cb.GetMigrateStatusRequest{},
|
||||||
|
"/restmachine/cloudbroker/disks/update": disks_cb.UpdateRequest{},
|
||||||
|
|
||||||
// dpdknet
|
// dpdknet
|
||||||
"/restmachine/cloudbroker/dpdknet/get": dpdknet_cb.GetRequest{},
|
"/restmachine/cloudbroker/dpdknet/get": dpdknet_cb.GetRequest{},
|
||||||
@@ -726,6 +737,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
|||||||
"/restmachine/cloudbroker/extnet/staticRouteDel": extnet_cb.StaticRouteDelRequest{},
|
"/restmachine/cloudbroker/extnet/staticRouteDel": extnet_cb.StaticRouteDelRequest{},
|
||||||
"/restmachine/cloudbroker/extnet/staticRouteList": extnet_cb.StaticRouteListRequest{},
|
"/restmachine/cloudbroker/extnet/staticRouteList": extnet_cb.StaticRouteListRequest{},
|
||||||
"/restmachine/cloudbroker/extnet/update": extnet_cb.UpdateRequest{},
|
"/restmachine/cloudbroker/extnet/update": extnet_cb.UpdateRequest{},
|
||||||
|
"/restmachine/cloudbroker/extnet/migrateToZone": extnet_cb.MigrateToZoneRequest{},
|
||||||
|
|
||||||
// flipgroup
|
// flipgroup
|
||||||
"/restmachine/cloudbroker/flipgroup/computeAdd": flipgroup_cb.ComputeAddRequest{},
|
"/restmachine/cloudbroker/flipgroup/computeAdd": flipgroup_cb.ComputeAddRequest{},
|
||||||
@@ -824,6 +836,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
|||||||
"/restmachine/cloudbroker/k8s/workersGroupGetByName": k8s_cb.WorkersGroupGetByNameRequest{},
|
"/restmachine/cloudbroker/k8s/workersGroupGetByName": k8s_cb.WorkersGroupGetByNameRequest{},
|
||||||
"/restmachine/cloudbroker/k8s/workerReset": k8s_cb.WorkerResetRequest{},
|
"/restmachine/cloudbroker/k8s/workerReset": k8s_cb.WorkerResetRequest{},
|
||||||
"/restmachine/cloudbroker/k8s/workerRestart": k8s_cb.WorkerRestartRequest{},
|
"/restmachine/cloudbroker/k8s/workerRestart": k8s_cb.WorkerRestartRequest{},
|
||||||
|
"/restmachine/cloudbroker/k8s/migrateToZone": k8s_cb.MigrateToZoneRequest{},
|
||||||
|
|
||||||
// kvmx86
|
// kvmx86
|
||||||
"/restmachine/cloudbroker/kvmx86/create": kvmx86_cb.CreateRequest{},
|
"/restmachine/cloudbroker/kvmx86/create": kvmx86_cb.CreateRequest{},
|
||||||
@@ -857,6 +870,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
|||||||
"/restmachine/cloudbroker/lb/stop": lb_cb.StopRequest{},
|
"/restmachine/cloudbroker/lb/stop": lb_cb.StopRequest{},
|
||||||
"/restmachine/cloudbroker/lb/update": lb_cb.UpdateRequest{},
|
"/restmachine/cloudbroker/lb/update": lb_cb.UpdateRequest{},
|
||||||
"/restmachine/cloudbroker/lb/updateSysctlParams": lb_cb.UpdateSysctParamsRequest{},
|
"/restmachine/cloudbroker/lb/updateSysctlParams": lb_cb.UpdateSysctParamsRequest{},
|
||||||
|
"/restmachine/cloudbroker/lb/migrateToZone": lb_cb.MigrateToZoneRequest{},
|
||||||
|
|
||||||
// node
|
// node
|
||||||
"/restmachine/cloudbroker/node/add_ssh_identity": node_cb.AddSSHIdentityRequest{},
|
"/restmachine/cloudbroker/node/add_ssh_identity": node_cb.AddSSHIdentityRequest{},
|
||||||
@@ -876,7 +890,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
|||||||
"/restmachine/cloudbroker/node/setVFsNumber": node_cb.SetVFsNumberRequest{},
|
"/restmachine/cloudbroker/node/setVFsNumber": node_cb.SetVFsNumberRequest{},
|
||||||
"/restmachine/cloudbroker/node/update": node_cb.UpdateRequest{},
|
"/restmachine/cloudbroker/node/update": node_cb.UpdateRequest{},
|
||||||
"/restmachine/cloudbroker/node/update_description": node_cb.UpdateDescriptionRequest{},
|
"/restmachine/cloudbroker/node/update_description": node_cb.UpdateDescriptionRequest{},
|
||||||
"/restmachine/cloudbroker/node/setVFsParams": node_cb.VFParam{},
|
"/restmachine/cloudbroker/node/setVFsParams": node_cb.SetVFsParamsRequest{},
|
||||||
"/restmachine/cloudbroker/node/get_logical_cores_count": node_cb.GetLogicalCoresCountRequest{},
|
"/restmachine/cloudbroker/node/get_logical_cores_count": node_cb.GetLogicalCoresCountRequest{},
|
||||||
"/restmachine/cloudbroker/node/set_cpu_allocation_ratio": node_cb.SetCpuAllocationRatioRequest{},
|
"/restmachine/cloudbroker/node/set_cpu_allocation_ratio": node_cb.SetCpuAllocationRatioRequest{},
|
||||||
"/restmachine/cloudbroker/node/set_mem_allocation_ratio": node_cb.SetMemAllocationRatioRequest{},
|
"/restmachine/cloudbroker/node/set_mem_allocation_ratio": node_cb.SetMemAllocationRatioRequest{},
|
||||||
@@ -976,6 +990,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
|||||||
"/restmachine/cloudbroker/sep/sharedLockStop": sep_cb.SharedLockStopRequest{},
|
"/restmachine/cloudbroker/sep/sharedLockStop": sep_cb.SharedLockStopRequest{},
|
||||||
"/restmachine/cloudbroker/sep/listAvailableSepAndPools": sep_cb.ListAvailableSEPAndPoolsRequest{},
|
"/restmachine/cloudbroker/sep/listAvailableSepAndPools": sep_cb.ListAvailableSEPAndPoolsRequest{},
|
||||||
"/restmachine/cloudbroker/sep/sharedLockStart": sep_cb.SharedLockStartRequest{},
|
"/restmachine/cloudbroker/sep/sharedLockStart": sep_cb.SharedLockStartRequest{},
|
||||||
|
"/restmachine/cloudbroker/sep/getTemplate": sep_cb.GetTemplateRequest{},
|
||||||
|
|
||||||
// storage_policy
|
// storage_policy
|
||||||
"/restmachine/cloudbroker/storage_policy/get": stpolicy_cb.GetRequest{},
|
"/restmachine/cloudbroker/storage_policy/get": stpolicy_cb.GetRequest{},
|
||||||
@@ -1074,6 +1089,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
|||||||
"/restmachine/cloudbroker/vins/vnfdevReset": vins_cb.VNFDevResetRequest{},
|
"/restmachine/cloudbroker/vins/vnfdevReset": vins_cb.VNFDevResetRequest{},
|
||||||
"/restmachine/cloudbroker/vins/vnfdevStart": vins_cb.VNFDevStartRequest{},
|
"/restmachine/cloudbroker/vins/vnfdevStart": vins_cb.VNFDevStartRequest{},
|
||||||
"/restmachine/cloudbroker/vins/vnfdevStop": vins_cb.VNFDevStopRequest{},
|
"/restmachine/cloudbroker/vins/vnfdevStop": vins_cb.VNFDevStopRequest{},
|
||||||
|
"/restmachine/cloudbroker/vins/migrateToZone": vins_cb.MigrateToZoneRequest{},
|
||||||
|
|
||||||
// zone
|
// zone
|
||||||
"/restmachine/cloudbroker/zone/get": zone_cb.GetRequest{},
|
"/restmachine/cloudbroker/zone/get": zone_cb.GetRequest{},
|
||||||
|
|||||||
@@ -9,6 +9,31 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// extractTypeFromSchema extracts type from schema, handling oneOf cases
|
||||||
|
// When oneOf contains a type and null, it returns the non-null type
|
||||||
|
func extractTypeFromSchema(schema map[string]interface{}) string {
|
||||||
|
// Check for direct type
|
||||||
|
if paramType, ok := schema["type"].(string); ok {
|
||||||
|
return paramType
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for oneOf
|
||||||
|
if oneOf, ok := schema["oneOf"].([]interface{}); ok {
|
||||||
|
for _, item := range oneOf {
|
||||||
|
if itemMap, ok := item.(map[string]interface{}); ok {
|
||||||
|
if itemType, ok := itemMap["type"].(string); ok {
|
||||||
|
// Skip null type, return the first non-null type found
|
||||||
|
if itemType != "null" {
|
||||||
|
return itemType
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func getParameters(input map[string]interface{}) []interface{} {
|
func getParameters(input map[string]interface{}) []interface{} {
|
||||||
var emptySlice []interface{}
|
var emptySlice []interface{}
|
||||||
methods := []string{"get", "post", "put", "delete", "patch", "head", "options"}
|
methods := []string{"get", "post", "put", "delete", "patch", "head", "options"}
|
||||||
@@ -33,37 +58,41 @@ func getParameters(input map[string]interface{}) []interface{} {
|
|||||||
return emptySlice
|
return emptySlice
|
||||||
}
|
}
|
||||||
|
|
||||||
params, ok := parameters["parameters"]
|
var result []interface{}
|
||||||
if !ok {
|
|
||||||
return emptySlice
|
if requestBody, ok := parameters["requestBody"].(map[string]interface{}); ok {
|
||||||
|
if content, ok := requestBody["content"].(map[string]interface{}); ok {
|
||||||
|
// Check for application/x-www-form-urlencoded, application/json, or multipart/form-data
|
||||||
|
var schemaData map[string]interface{}
|
||||||
|
var found bool
|
||||||
|
|
||||||
|
if formData, ok := content["application/x-www-form-urlencoded"].(map[string]interface{}); ok {
|
||||||
|
if schema, ok := formData["schema"].(map[string]interface{}); ok {
|
||||||
|
schemaData = schema
|
||||||
|
found = true
|
||||||
|
}
|
||||||
|
} else if jsonData, ok := content["application/json"].(map[string]interface{}); ok {
|
||||||
|
if schema, ok := jsonData["schema"].(map[string]interface{}); ok {
|
||||||
|
schemaData = schema
|
||||||
|
found = true
|
||||||
|
}
|
||||||
|
} else if multipartData, ok := content["multipart/form-data"].(map[string]interface{}); ok {
|
||||||
|
if schema, ok := multipartData["schema"].(map[string]interface{}); ok {
|
||||||
|
schemaData = schema
|
||||||
|
found = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res, ok := params.([]interface{})
|
if found && schemaData != nil {
|
||||||
if !ok {
|
if properties, ok := schemaData["properties"].(map[string]interface{}); ok {
|
||||||
return emptySlice
|
|
||||||
}
|
|
||||||
// Check if there's a body parameter
|
|
||||||
for _, p := range res {
|
|
||||||
param, ok := p.(map[string]interface{})
|
|
||||||
if !ok {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if param["name"] == "body" {
|
|
||||||
schema, ok := param["schema"].(map[string]interface{})
|
|
||||||
if !ok {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
properties, ok := schema["properties"].(map[string]interface{})
|
|
||||||
if !ok {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
requiredFields := make(map[string]bool)
|
requiredFields := make(map[string]bool)
|
||||||
if req, ok := schema["required"].([]interface{}); ok {
|
if req, ok := schemaData["required"].([]interface{}); ok {
|
||||||
for _, r := range req {
|
for _, r := range req {
|
||||||
requiredFields[r.(string)] = true
|
if reqStr, ok := r.(string); ok {
|
||||||
|
requiredFields[reqStr] = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var newParams []interface{}
|
|
||||||
for name, prop := range properties {
|
for name, prop := range properties {
|
||||||
propMap, ok := prop.(map[string]interface{})
|
propMap, ok := prop.(map[string]interface{})
|
||||||
if !ok {
|
if !ok {
|
||||||
@@ -71,19 +100,84 @@ func getParameters(input map[string]interface{}) []interface{} {
|
|||||||
}
|
}
|
||||||
newParam := make(map[string]interface{})
|
newParam := make(map[string]interface{})
|
||||||
newParam["name"] = name
|
newParam["name"] = name
|
||||||
newParam["type"] = propMap["type"]
|
propType := extractTypeFromSchema(propMap)
|
||||||
|
if propType != "" {
|
||||||
|
newParam["type"] = propType
|
||||||
|
}
|
||||||
newParam["required"] = requiredFields[name]
|
newParam["required"] = requiredFields[name]
|
||||||
if propMap["type"] == "array" {
|
if propType == "array" {
|
||||||
|
// Try to get items from propMap first
|
||||||
if items, ok := propMap["items"].(map[string]interface{}); ok {
|
if items, ok := propMap["items"].(map[string]interface{}); ok {
|
||||||
newParam["items"] = items
|
newParam["items"] = items
|
||||||
|
} else if oneOf, ok := propMap["oneOf"].([]interface{}); ok {
|
||||||
|
// If items not in propMap, try to get from oneOf array element
|
||||||
|
for _, item := range oneOf {
|
||||||
|
if itemMap, ok := item.(map[string]interface{}); ok {
|
||||||
|
if itemType, ok := itemMap["type"].(string); ok && itemType == "array" {
|
||||||
|
if items, ok := itemMap["items"].(map[string]interface{}); ok {
|
||||||
|
newParam["items"] = items
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newParams = append(newParams, newParam)
|
|
||||||
}
|
|
||||||
return newParams
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res
|
}
|
||||||
|
}
|
||||||
|
result = append(result, newParam)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if params, ok := parameters["parameters"].([]interface{}); ok {
|
||||||
|
for _, p := range params {
|
||||||
|
param, ok := p.(map[string]interface{})
|
||||||
|
if !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
newParam := make(map[string]interface{})
|
||||||
|
if name, ok := param["name"].(string); ok {
|
||||||
|
newParam["name"] = name
|
||||||
|
}
|
||||||
|
if schema, ok := param["schema"].(map[string]interface{}); ok {
|
||||||
|
paramType := extractTypeFromSchema(schema)
|
||||||
|
if paramType != "" {
|
||||||
|
newParam["type"] = paramType
|
||||||
|
}
|
||||||
|
if paramType == "array" {
|
||||||
|
if items, ok := schema["items"].(map[string]interface{}); ok {
|
||||||
|
newParam["items"] = items
|
||||||
|
} else if oneOf, ok := schema["oneOf"].([]interface{}); ok {
|
||||||
|
for _, item := range oneOf {
|
||||||
|
if itemMap, ok := item.(map[string]interface{}); ok {
|
||||||
|
if itemType, ok := itemMap["type"].(string); ok && itemType == "array" {
|
||||||
|
if items, ok := itemMap["items"].(map[string]interface{}); ok {
|
||||||
|
newParam["items"] = items
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Handle required field
|
||||||
|
if required, ok := param["required"].(bool); ok {
|
||||||
|
newParam["required"] = required
|
||||||
|
} else {
|
||||||
|
newParam["required"] = false
|
||||||
|
}
|
||||||
|
result = append(result, newParam)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(result) > 0 {
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
return emptySlice
|
||||||
}
|
}
|
||||||
|
|
||||||
func getBytesFromJSON(fileName string, t *testing.T) []byte {
|
func getBytesFromJSON(fileName string, t *testing.T) []byte {
|
||||||
@@ -144,6 +238,25 @@ func getErrorsFromJSON(bytes []byte, t *testing.T, cloud string) {
|
|||||||
if len(params) != typStruct.NumField() {
|
if len(params) != typStruct.NumField() {
|
||||||
errs = append(errs, fmt.Sprintf("Platform (%d) and golang structure (%d) have different amount of fields.", len(params), typStruct.NumField()))
|
errs = append(errs, fmt.Sprintf("Platform (%d) and golang structure (%d) have different amount of fields.", len(params), typStruct.NumField()))
|
||||||
}
|
}
|
||||||
|
paramMap := make(map[string]bool)
|
||||||
|
paramRequiredMap := make(map[string]bool)
|
||||||
|
for _, p := range params {
|
||||||
|
param, ok := p.(map[string]interface{})
|
||||||
|
if !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
name, ok := param["name"].(string)
|
||||||
|
if ok {
|
||||||
|
paramMap[name] = true
|
||||||
|
required, ok := param["required"].(bool)
|
||||||
|
if ok {
|
||||||
|
paramRequiredMap[name] = required
|
||||||
|
} else {
|
||||||
|
paramRequiredMap[name] = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, p := range params {
|
for _, p := range params {
|
||||||
param, ok := p.(map[string]interface{})
|
param, ok := p.(map[string]interface{})
|
||||||
if !ok {
|
if !ok {
|
||||||
@@ -198,6 +311,33 @@ func getErrorsFromJSON(bytes []byte, t *testing.T, cloud string) {
|
|||||||
errs = append(errs, fmt.Sprintf("Platform has field %s that golang structure doesn't", name))
|
errs = append(errs, fmt.Sprintf("Platform has field %s that golang structure doesn't", name))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if required fields in Go structure are missing from platform JSON
|
||||||
|
// or if they exist but are not required on platform
|
||||||
|
for i := 0; i < typStruct.NumField(); i++ {
|
||||||
|
jsonTag := typStruct.Field(i).Tag.Get("json")
|
||||||
|
validation, _ := typStruct.Field(i).Tag.Lookup("validate")
|
||||||
|
|
||||||
|
fieldName := strings.Split(jsonTag, ",")[0]
|
||||||
|
if fieldName == "" || fieldName == "-" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.Contains(validation, "required") {
|
||||||
|
if !paramMap[fieldName] {
|
||||||
|
errs = append(errs, fmt.Sprintf("Golang structure has required field %s that platform doesn't", fieldName))
|
||||||
|
} else {
|
||||||
|
platformRequired := paramRequiredMap[fieldName]
|
||||||
|
if !platformRequired {
|
||||||
|
fieldType := typStruct.Field(i).Type
|
||||||
|
if fieldType.Kind() == reflect.Bool {
|
||||||
|
errs = append(errs, fmt.Sprintf("Golang structure has required field %s that platform doesn't", fieldName))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if len(errs) > 0 {
|
if len(errs) > 0 {
|
||||||
msg := fmt.Sprintf("Path %s has following errors: %v", k, errs)
|
msg := fmt.Sprintf("Path %s has following errors: %v", k, errs)
|
||||||
t.Error(msg)
|
t.Error(msg)
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ var DEPRECATED_GROUPS = []string{
|
|||||||
"/cloudbroker/vins/staticRouteAccessGrant",
|
"/cloudbroker/vins/staticRouteAccessGrant",
|
||||||
"/cloudbroker/vins/staticRouteAccessRevoke",
|
"/cloudbroker/vins/staticRouteAccessRevoke",
|
||||||
"/restmachine/cloudbroker/image/updateNodes",
|
"/restmachine/cloudbroker/image/updateNodes",
|
||||||
|
"/restmachine/cloudbroker/image/uploadImageFile",
|
||||||
}
|
}
|
||||||
|
|
||||||
// getUrlsFromBytes converts bytes to array of urls strings
|
// getUrlsFromBytes converts bytes to array of urls strings
|
||||||
|
|||||||
Reference in New Issue
Block a user