Compare commits

..
13 Commits
Author SHA1 Message Date
arsvolkov faa9487e03 v14.14.0 2026-09-28 15:16:21 +04:00
arsvolkov f61319c21b v14.13.0 2026-07-31 16:47:20 +04:00
arsvolkov fe413c7182 v14.12.0 2026-07-17 16:55:08 +04:00
dayterr 3e2edf53a5 v14.11.0 2026-05-29 17:54:28 +03:00
aafetisov 8f8a81eea4 v14.10.0 2026-05-22 19:20:44 +03:00
dayterr d82ae52951 v14.9.0 2026-05-08 14:18:23 +03:00
dayterr 5e5d90e24f v14.8.0 2026-04-17 17:10:10 +03:00
dayterr cd67633a52 v14.7.0 2026-04-10 16:47:00 +03:00
aafetisov 0812c5a8af v14.6.0 2026-04-03 16:41:45 +03:00
aafetisov 8abb20dcde v14.5.0 2026-03-27 17:48:48 +03:00
dayterr 825cc4387f v14.4.0
v14.4.0
2026-03-20 17:22:29 +03:00
aafetisov aa3e9ad4ab v14.3.0 2026-03-13 17:20:54 +03:00
dayterr 5b2866bf0e v14.2.0 2026-03-06 16:37:54 +03:00
153 changed files with 3725 additions and 534 deletions

No files matched your search

+34 -43
View File
@@ -1,4 +1,4 @@
## Version 14.1.0 ## Version 14.14.0
Методы `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 с соответствующими фильтрами
Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke`, `AccessRevokeToPool` в cloudbroker/sep стали deprecated и в следующих версиях будут удалены Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke`, `AccessRevokeToPool` в cloudbroker/sep стали deprecated и в следующих версиях будут удалены
@@ -7,64 +7,55 @@
Все методы группы `.SDN()` находятся в альфа-версии. Все методы группы `.SDN()` находятся в альфа-версии.
### Добавлено ### Добавлено
#### account #### apiaccess
| Идентификатор<br>задачи | Описание | | Идентификатор задачи | Описание |
| --- | --- | | --- | --- |
| BGOS-780 | Вычисляемое поле `DeletedBy` в структуру ответа `ItemAccount` в cloudapi/account | | BGOS-1057 | Опциональное поле `SDN` в структуру `APIsEndpoints` в cloudbroker/apiaccess |
| BGOS-1057 | Опциональные поля `Audit`, `DPDKNet`, `SecurityGroup`, `SEP`, `StoragePolicy`, `Trunk`, `VFPool` и `Zone` в структуру `CloudAPIEndpoints` в cloudbroker/apiaccess |
| BGOS-1057 | Опциональные поля `Backup`, `DPDKNet`, `ResourceOptimizer`, `SecurityGroup`, `StoragePolicy`, `Trunk`, `VFPool` и `Zone` в структуру `CloudBrokerEndpoints` в cloudbroker/apiaccess |
| BGOS-1057 | Опциональные поля `Cache` и `InfoWellknown` в структуру `SystemEndpoints` в cloudbroker/apiaccess |
#### compute #### compute
| Идентификатор<br>задачи | Описание | | Идентификатор задачи | Описание |
| --- | --- | | --- | --- |
| BGOS-777 | Структура ответа `RecordCloneAbort` в cloudbroker/compute | | BGOS-1038 | Опциональные поля `FolderID` и `IncludeDescendants` в структуру запроса `ListRequest` в cloudapi/compute |
| BGOS-774 | Опциональное поле `Weight` в структуру запроса `UpdateRequest` в cloudbroker/compute | | BGOS-1038 | Опциональные поля `FolderID` и `IncludeDescendants` в структуру запроса `ListRequest` в cloudbroker/compute |
| BGOS-774 | Вычисляемое поле `Weight` в структуры ответа `InfoCompute` и `RecordCompute` в cloudbroker/compute и в структуры ответа `RecordCompute` и `ItemCompute` в cloudapi/compute | | BGOS-1071 | Вычисляемое поле `FolderID` в структуры ответа `RecordCompute` и `ItemCompute` в cloudapi/compute |
| BGOS-1071 | Вычисляемое поле `FolderID` в структуры ответа `RecordCompute` и `InfoCompute` в cloudapi/compute |
#### kvmx86 #### grid
| Идентификатор<br>задачи | Описание | | Идентификатор задачи | Описание |
| --- | --- | | --- | --- |
| BGOS-775 | Опциональное поле `Weight` в структуры запроса `CreateRequest`, `CreateBlankRequest` и `MassCreateRequest` в cloudbroker/kvmx86 | | BGOS-1076 | Вычисляемое поле `VMFoldersEnabled` в структуры ответа `RecordGrid` и `ItemGridList` в cloudbroker/grid |
#### rg #### locations
| Идентификатор<br>задачи | Описание | | Идентификатор задачи | Описание |
| --- | --- | | --- | --- |
| BGOS-776 | Вычисляемое поле `Email` в структуры ответа `ItemACL` в cloudapi/rg и в `ACL` в cloudbroker/rg | | BGOS-1036 | Вычисляемое поле `VMFoldersEnabled` в структуру ответа `ItemLocation` в cloudapi/locations |
| BGOS-779 | Опциональные поля `RGID` и `ComputeID` в структуру запроса `ListRequest` в cloudapi/rg и в cloudbroker/rg |
#### stpolicy #### vmfolder
| Идентификатор<br>задачи | Описание | | Идентификатор задачи | Описание |
| --- | --- | | --- | --- |
| BGOS-784 | Вычисляемое поле `Usage` в структуру ответа `InfoStoragePolicyWithID` в cloudbroker/stpolicy | | BGOS-1052 | Группа api методов vmfolder в cloudapi и cloudbroker |
### Изменено
#### compute
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-777 | Тип возвращаемого значения метода `CloneAbort` с `bool` на `[]RecordCloneAbort` в cloudbroker/compute |
### Удалено ### Удалено
#### compute #### apiaccess
| Идентификатор<br>задачи | Описание | | Идентификатор задачи | Описание |
| --- | --- | | --- | --- |
| BGOS-781 | Опциональное поле `DiskType` из структур `DiskAddRequest` и `DiskAttachRequest` в cloudapi/compute и в cloudbroker/compute | | BGOS-1057 | Опциональное поле `LibCloud` из структуры `APIsEndpoints` в cloudbroker/apiaccess |
| BGOS-785 | Вычисляемое поле `Type` из структур `ItemDisk`, `RecordDisk` и `ItemDiskUnattached` в cloudapi/compute и из структуры `InfoDisk` в cloudbroker/compute | | BGOS-1057 | Опциональные поля `CloudSpace`, `ComputeCI`, `DPDK`, `Machine`, `Openshift`, `OpenshiftCI`, `PortForwarding` и `Sizes` из структуры `CloudAPIEndpoints` в cloudbroker/apiaccess |
| BGOS-1057 | Опциональные поля `CloudSpace`, `ComputeCI`, `Desnode`, `Diagnostics`, `DPDK`, `IaaS`, `Machine`, `Openshift`, `OpenshiftCI`, `Ovsnode` и `QOS` из структуры `CloudBrokerEndpoints` в cloudbroker/apiaccess |
| BGOS-1057 | Опциональные поля `AgentController`, `Alerts`, `ErrorConditionHandler`, `Job`, `Log` и `Logo` из структуры `SystemEndpoints` в cloudbroker/apiaccess |
#### disks ### Исправлено
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-781 | Структура запросов `ListTypesRequest`, структура ответов `ListTypes`, метод `ListTypes` в cloudapi/disks и в cloudbroker/disks |
| BGOS-781 | Опциональное поле `Type` из структур `ListRequest`, `ListDeletedRequest` и `ListUnattachedRequest` в cloudapi/disks и в cloudbroker/disks |
#### kvmx86 #### apiaccess
| Идентификатор<br>задачи | Описание | | Идентификатор задачи | Описание |
| --- | --- | | --- | --- |
| BGOS-773 | Опциональные поля `IS` и `IPAType` из структур запроса `CreateRequest` в cloudapi/kvmx86 и в cloudbroker/kvmx86 | | BGOS-1057 | Ошибка при вызове метода `Update` в cloudbroker/apiaccess |
| BGOS-1057 | Исправлен тип ответа методов `Update` и `DescUpdate` в cloudbroker/apiaccess |
#### stpolicy
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-784 | Вычисляемое поле `StoragePolicyID` из структуры ответа `InfoStoragePolicyWithID` в cloudbroker/stpolicy |
+55 -40
View File
@@ -123,6 +123,8 @@ go get -u repository.basistech.ru/BASIS/dynamix-golang-sdk/v14
- `Trunk` - получение информации о транковых портах; - `Trunk` - получение информации о транковых портах;
- `VFPool` - управление пулом виртуальных сетевых функций; - `VFPool` - управление пулом виртуальных сетевых функций;
- `VINS` - управление виртуальными изолированными сетями; - `VINS` - управление виртуальными изолированными сетями;
- `VGPU` - управление виртуальными графическими процессорами;
- `VMFolder` – управление директориями ВМ;
- `Zone` - управление зонами. - `Zone` - управление зонами.
### Cloudbroker ### Cloudbroker
@@ -160,7 +162,8 @@ go get -u repository.basistech.ru/BASIS/dynamix-golang-sdk/v14
- `User` - управление пользователями (индивидуально); - `User` - управление пользователями (индивидуально);
- `VGPU` - управление виртуальными графическими процессорами; - `VGPU` - управление виртуальными графическими процессорами;
- `VFPool` - управление пулом виртуальных сетевых функций; - `VFPool` - управление пулом виртуальных сетевых функций;
- `VINS` - управление виртуальными изолированными сетями. - `VINS` - управление виртуальными изолированными сетями;
- `VMFolder` – управление директориями ВМ;
- `Zone` - управление зонами. - `Zone` - управление зонами.
### SDN ### SDN
@@ -172,12 +175,14 @@ go get -u repository.basistech.ru/BASIS/dynamix-golang-sdk/v14
- `Address pool` - управление пулами адресов; - `Address pool` - управление пулами адресов;
- `DefaultSecurityPolicies` - управление политиками хранения по умолчанию; - `DefaultSecurityPolicies` - управление политиками хранения по умолчанию;
- `ExtNet` - управление виртуальными сетями, отвечающими за внешний доступ; - `ExtNet` - управление виртуальными сетями, отвечающими за внешний доступ;
- `Hypervisors` - управление гипервизорами;
- `FloatingIPs` - управление плавающими IP-адресами; - `FloatingIPs` - управление плавающими IP-адресами;
- `Logical ports` - управление логическими портами; - `Logical ports` - управление логическими портами;
- `NetworkObjectGroups` - управление группами объектов сети; - `NetworkObjectGroups` - управление группами объектов сети;
- `Routers` - управление роутерами; - `Routers` - управление роутерами;
- `SecurityPolicies` - управление политиками хранения; - `SecurityPolicies` - управление политиками хранения;
- `Segments` - управление сегментами; - `Segments` - управление сегментами;
- `Version` - получение информации о версии SDN;
## Работа с библиотекой ## Работа с библиотекой
@@ -333,6 +338,8 @@ func main() {
- `pkg/cloudapi/trunk` - для `Trunk` - `pkg/cloudapi/trunk` - для `Trunk`
- `pkg/cloudapi/vfpool` - для `VFPool` - `pkg/cloudapi/vfpool` - для `VFPool`
- `pkg/cloudapi/vins` - для `VINS` - `pkg/cloudapi/vins` - для `VINS`
- `pkg/cloudapi/vgpu` - для `VGPU`
- `pkg/cloudapi/vmfolder` - для `VMFolder`
- `pkg/cloudapi/zone` - для `Zone` - `pkg/cloudapi/zone` - для `Zone`
- **cloudbroker**: - **cloudbroker**:
- `pkg/cloudbroker/account` - для `Account` - `pkg/cloudbroker/account` - для `Account`
@@ -366,18 +373,21 @@ func main() {
- `pkg/cloudbroker/vgpu` - для `VGPU` - `pkg/cloudbroker/vgpu` - для `VGPU`
- `pkg/cloudbroker/vfpool` - для `VFPool` - `pkg/cloudbroker/vfpool` - для `VFPool`
- `pkg/cloudbroker/vins` - для `VINS` - `pkg/cloudbroker/vins` - для `VINS`
- `pkg/cloudbroker/vmfolder` - для `VMFolder`
- `pkg/cloudbroker/zone` - для `Zone` - `pkg/cloudbroker/zone` - для `Zone`
- **sdn**: - **sdn**:
- `pkg/sdn/acsgroups` - для `Access groups` - `pkg/sdn/acsgroups` - для `Access groups`
- `pkg/sdn/adrspools` - для `Address pool` - `pkg/sdn/adrspools` - для `Address pool`
- `pkg/sdn/defsecpolicies` - для `DefaultSecurityPolicies` - `pkg/sdn/defsecpolicies` - для `DefaultSecurityPolicies`
- `pkg/sdn/external_networks` - для `ExtNet` - `pkg/sdn/external_networks` - для `ExtNet`
- `pkg/sdn/hypervisors` - для `Hypervisors`
- `pkg/sdn/flips` - для `FloatingIPs` - `pkg/sdn/flips` - для `FloatingIPs`
- `pkg/sdn/logicalports` - для `Logical ports` - `pkg/sdn/logicalports` - для `Logical ports`
- `pkg/sdn/netobjgroups` - для `NetworkObjectGroups` - `pkg/sdn/netobjgroups` - для `NetworkObjectGroups`
- `pkg/sdn/routers` - для `Routers` - `pkg/sdn/routers` - для `Routers`
- `pkg/sdn/secpolicies` - для `SecurityPolicies` - `pkg/sdn/secpolicies` - для `SecurityPolicies`
- `pkg/sdn/segments` - для `Segments` - `pkg/sdn/segments` - для `Segments`
- `pkg/sdn/version` - для `Version`
Все поля структуры имеют описание, в которых содержится: Все поля структуры имеют описание, в которых содержится:
@@ -457,7 +467,7 @@ type CreateRequest struct {
// Node ID // Node ID
// Required: false // Required: false
NodeID uint64 `url:"nodeId,omitempty" json:"nodeId,omitempty"` NodeID uint64 `url:"nodeId,omitempty" json:"nodeId,omitempty"`
} }
``` ```
@@ -529,6 +539,8 @@ func main() {
- `.Trunk()` - для работы с `Trunk` - `.Trunk()` - для работы с `Trunk`
- `.VFPool()` - для работы с `VFPool` - `.VFPool()` - для работы с `VFPool`
- `.VINS()` - для работы с `VINS` - `.VINS()` - для работы с `VINS`
- `.VGPU()` - для работы с `VGPU`
- `.VMFolder()` - для работы с `VMFolder`
- `.Zone()` - для работы с `Zone` - `.Zone()` - для работы с `Zone`
Доступные методы для `.CloudBroker()`: Доступные методы для `.CloudBroker()`:
@@ -564,20 +576,23 @@ func main() {
- `.VGPU()` - для работы с `VGPU` - `.VGPU()` - для работы с `VGPU`
- `.VFPool()` - для работы с `VFPool` - `.VFPool()` - для работы с `VFPool`
- `.VINS()` - для работы с `VINS` - `.VINS()` - для работы с `VINS`
- `.VMFolder()` - для работы с `VMFolder`
- `.Zone()` - для работы с `Zone` - `.Zone()` - для работы с `Zone`
Доступные методы для `.SDN()`: Доступные методы для `.SDN()`:
- `.AccessGroup()` - для работы с `Access group` - `.AccessGroup()` - для работы с `Access group`
- `.AddressPool()` - для работы с `Addres pool` - `.AddressPool()` - для работы с `Addres pool`
- `.DefaultSecurityPolicies()` - для работы с `DefaultSecurityPolicies` - `.DefaultSecurityPolicies()` - для работы с `DefaultSecurityPolicies`
- `.ExtNet()` - для работы с `ExtNet` - `.ExtNet()` - для работы с `ExtNet`
- `.Hypervisors()` - для работы с `Hypervisors`
- `.FloatingIPs()` - для работы с `FloatingIPs` - `.FloatingIPs()` - для работы с `FloatingIPs`
- `.LogicalPorts()` - для работы с `Logical ports` - `.LogicalPorts()` - для работы с `Logical ports`
- `.NetworkObjectGroups()` - для работы с `NetworkObjectGroups` - `.NetworkObjectGroups()` - для работы с `NetworkObjectGroups`
- `.Routers()` - для работы с `Routers` - `.Routers()` - для работы с `Routers`
- `.SecurityPolicies()` - для работы с `SecurityPolicies` - `.SecurityPolicies()` - для работы с `SecurityPolicies`
- `.Segments()` - для работы с `Segments` - `.Segments()` - для работы с `Segments`
- `.Version()` - для работы с `Version`
3. Вызвать метод, отвечающий за выполнение запроса и передать в него: 3. Вызвать метод, отвечающий за выполнение запроса и передать в него:
@@ -937,7 +952,7 @@ func main() {
- ToString(): строковое представление результата выполнения задачи - ToString(): строковое представление результата выполнения задачи
- ID() и Name(): получение ID и имени созданного в результате выполнения задачи ресурса - ID() и Name(): получение ID и имени созданного в результате выполнения задачи ресурса
- ToMaps(): получение списка карт, содержащих информацию о дисках, восстановленных в результате выполнения задачи. - ToMaps(): получение списка карт, содержащих информацию о дисках, восстановленных в результате выполнения задачи.
Все методы оборудованы возвратом ошибок. Непустая ошибка означает, что из поля Result нельзя получить информацию, которую предоставляет метод. Все методы оборудованы возвратом ошибок. Непустая ошибка означает, что из поля Result нельзя получить информацию, которую предоставляет метод.
```go ```go
package main package main
@@ -1544,7 +1559,7 @@ func main() {
| BVSConfig | *BVSConfig | Нет | Конфигурация BVS | | BVSConfig | *BVSConfig | Нет | Конфигурация BVS |
| LegacyConfig | string | Нет | Конфигурация Legacy | | LegacyConfig | string | Нет | Конфигурация Legacy |
В универсальном клиенте можно использовать только один тип конфигурации одновременно. В универсальном клиенте можно использовать только один тип конфигурации одновременно.
#### Пример конфигурации универсального клиента #### Пример конфигурации универсального клиента
@@ -1615,53 +1630,53 @@ package main
import ( import (
"fmt" "fmt"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/config" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/config"
decort "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14" decort "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14"
) )
func main() { func main() {
// Настройка конфигурации // Настройка конфигурации
legacyCfg := config.LegacyConfig{ legacyCfg := config.LegacyConfig{
Username: "<USERNAME>", Username: "<USERNAME>",
Password: "<PASSWORD>", Password: "<PASSWORD>",
Domain: "dynamix", Domain: "dynamix",
DecortURL: "https://mr4.digitalenergy.online", DecortURL: "https://mr4.digitalenergy.online",
Retries: 5, Retries: 5,
}
legacyCfg.SetTimeout(5 * time.Minute)
cfg := config.UniversalConfig{
LegacyConfig: &legacyCfg,
} }
legacyCfg.SetTimeout(5 * time.Minute) // Создание клиента
universalClient := decort.NewUniversal(cfg)
// Создание структуры запроса
// CreateRequest - реквест на создание виртуальной машины
req := kvmx86.CreateRequest{
RGID: 123,
Name: "compute",
CPU: 4,
RAM: 4096,
ImageID: 321,
}
cfg := config.UniversalConfig{ // Выполнение запроса
LegacyConfig: &legacyCfg, res, err := universalClient.CloudAPI().KVMX86().Create(context.Background(), req)
} if err != nil {
log.Fatal(err)
}
// Создание клиента fmt.Println(res)
universalClient := decort.NewUniversal(cfg)
// Создание структуры запроса
// CreateRequest - реквест на создание виртуальной машины
req := kvmx86.CreateRequest{
RGID: 123,
Name: "compute",
CPU: 4,
RAM: 4096,
ImageID: 321,
}
// Выполнение запроса
res, err := universalClient.CloudAPI().KVMX86().Create(context.Background(), req)
if err != nil {
log.Fatal(err)
}
fmt.Println(res)
} }
``` ```
## Проверка соответствия версии платформы и версии dynamix ## Проверка соответствия версии платформы и версии dynamix
С версии v1.11.0 для каждого клиента добавлен метод `Check` для проверки соответствия decort-sdk и платформы dynamix. С версии v11.0.0 для каждого клиента добавлен метод `Check` для проверки соответствия decort-sdk и платформы dynamix.
В случае соответсвия decort-sdk и платформы dynamix возвращается структура, содержащая информацию о версии и актуальном билде платформы. В случае соответсвия decort-sdk и платформы dynamix возвращается структура, содержащая информацию о версии и актуальном билде платформы.
#### Пример выполнения запроса #### Пример выполнения запроса
+4
View File
@@ -350,6 +350,10 @@ func isBoolTypeValidator(fe validator.FieldLevel) bool {
return fe.Field().CanConvert(reflect.TypeOf(true)) return fe.Field().CanConvert(reflect.TypeOf(true))
} }
func isStringTypeValidator(fe validator.FieldLevel) bool {
return fe.Field().Kind() == reflect.String
}
func urlValidartor(fl validator.FieldLevel) bool { func urlValidartor(fl validator.FieldLevel) bool {
fieldValues := fl.Field().String() fieldValues := fl.Field().String()
+1
View File
@@ -2,6 +2,7 @@ package validators
import ( import (
"errors" "errors"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/multierror" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/multierror"
"github.com/go-playground/validator/v10" "github.com/go-playground/validator/v10"
+2
View File
@@ -27,6 +27,8 @@ func errorMessage(fe validator.FieldError) string {
return fmt.Sprintf("%s %s: unexpected E-Mail format", prefix, fe.Field()) return fmt.Sprintf("%s %s: unexpected E-Mail format", prefix, fe.Field())
case "isBool": case "isBool":
return fmt.Sprintf("%s %s: must be bool type", prefix, fe.Field()) return fmt.Sprintf("%s %s: must be bool type", prefix, fe.Field())
case "isString":
return fmt.Sprintf("%s %s: must be string type", prefix, fe.Field())
case "accessType": case "accessType":
return fmt.Sprintf("%s %s must be one of the following: %s", return fmt.Sprintf("%s %s must be one of the following: %s",
+5
View File
@@ -231,6 +231,11 @@ func registerAllValidators(validate *validator.Validate) error {
return err return err
} }
err = validate.RegisterValidation("isString", isStringTypeValidator)
if err != nil {
return err
}
err = validate.RegisterValidation("url", urlValidartor) err = validate.RegisterValidation("url", urlValidartor)
if err != nil { if err != nil {
return err return err
+1 -1
View File
@@ -83,7 +83,7 @@ var (
) )
const ( const (
mtuMin = 1 mtuMin = 1500
mtuMax = 9216 mtuMax = 9216
trunkTagsMin = 1 trunkTagsMin = 1
+3
View File
@@ -110,6 +110,9 @@ type ItemAccount struct {
// Status // Status
Status string `json:"status"` Status string `json:"status"`
// Updated by
UpdatedBy string `json:"updatedBy"`
// Updated time // Updated time
UpdatedTime uint64 `json:"updatedTime"` UpdatedTime uint64 `json:"updatedTime"`
@@ -3,7 +3,6 @@ package compute
import ( import (
"context" "context"
"net/http" "net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
@@ -20,23 +19,18 @@ type AbortSharedSnapshotMergeRequest struct {
} }
// AbortSharedSnapshotMerge shared snapshots merge abort // AbortSharedSnapshotMerge shared snapshots merge abort
func (c Compute) AbortSharedSnapshotMerge(ctx context.Context, req AbortSharedSnapshotMergeRequest) (bool, error) { func (c Compute) AbortSharedSnapshotMerge(ctx context.Context, req AbortSharedSnapshotMergeRequest) (string, error) {
err := validators.ValidateRequest(req) err := validators.ValidateRequest(req)
if err != nil { if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err)) return "", validators.ValidationErrors(validators.GetErrors(err))
} }
url := "/cloudapi/compute/abort_shared_snapshot_merge" url := "/cloudapi/compute/abort_shared_snapshot_merge"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req) res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil { if err != nil {
return false, err return "", err
} }
result, err := strconv.ParseBool(string(res)) return string(res), nil
if err != nil {
return false, err
}
return result, nil
} }
+1
View File
@@ -4,6 +4,7 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
+1
View File
@@ -4,6 +4,7 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
+2 -1
View File
@@ -3,8 +3,9 @@ package compute
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// ChangeLinkStateRequest struct to change link state // ChangeLinkStateRequest struct to change link state
+8 -6
View File
@@ -2,8 +2,8 @@ package compute
import ( import (
"context" "context"
"encoding/json"
"net/http" "net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
@@ -17,22 +17,24 @@ type CloneAbortRequest struct {
} }
// CloneAbort aborts a compute clone // CloneAbort aborts a compute clone
func (c Compute) CloneAbort(ctx context.Context, req CloneAbortRequest) (bool, error) { func (c Compute) CloneAbort(ctx context.Context, req CloneAbortRequest) (ListCloneAbort, error) {
err := validators.ValidateRequest(req) err := validators.ValidateRequest(req)
if err != nil { if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err)) return nil, validators.ValidationErrors(validators.GetErrors(err))
} }
url := "/cloudapi/compute/clone_abort" url := "/cloudapi/compute/clone_abort"
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req) res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil { if err != nil {
return false, err return nil, err
} }
result, err := strconv.ParseBool(string(res)) var result ListCloneAbort
err = json.Unmarshal(res, &result)
if err != nil { if err != nil {
return false, err return nil, err
} }
return result, nil return result, nil
+8
View File
@@ -63,6 +63,14 @@ type ListRequest struct {
// Required: false // Required: false
ZoneID uint64 `url:"zone_id,omitempty" json:"zone_id,omitempty"` ZoneID uint64 `url:"zone_id,omitempty" json:"zone_id,omitempty"`
// Find by VM folder ID
// Required: false
FolderID uint64 `url:"folder_id,omitempty" json:"folder_id,omitempty"`
// Include computes from descendant folders.
// Required: false
IncludeDescendants interface{} `url:"include_descendants,omitempty" json:"include_descendants,omitempty" validate:"omitempty,isBool"`
// Page number // Page number
// Required: false // Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"` Page uint64 `url:"page,omitempty" json:"page,omitempty"`
+27
View File
@@ -551,6 +551,9 @@ type RecordCompute struct {
// Zone ID // Zone ID
// Required: false // Required: false
ZoneID uint64 `json:"zoneId"` ZoneID uint64 `json:"zoneId"`
// Folder ID
FolderID uint64 `json:"folder_id"`
} }
type LoaderMetaIso struct { type LoaderMetaIso struct {
// Name // Name
@@ -843,6 +846,9 @@ type ItemComputeDisk struct {
// Image ID // Image ID
ImageID uint64 `json:"imageId"` ImageID uint64 `json:"imageId"`
// Independent
Independent bool `json:"independent"`
// List image IDs // List image IDs
Images []uint64 `json:"images"` Images []uint64 `json:"images"`
@@ -879,6 +885,9 @@ type ItemComputeDisk struct {
// Present to // Present to
PresentTo map[string]uint64 `json:"presentTo"` PresentTo map[string]uint64 `json:"presentTo"`
// Provision
Provision string `json:"provision"`
// Purge time // Purge time
PurgeTime uint64 `json:"purgeTime"` PurgeTime uint64 `json:"purgeTime"`
@@ -1243,6 +1252,9 @@ type ItemCompute struct {
// Zone ID // Zone ID
ZoneID uint64 `json:"zoneId"` ZoneID uint64 `json:"zoneId"`
// Folder ID
FolderID uint64 `json:"folder_id"`
} }
// ListInfoDisks // ListInfoDisks
@@ -1382,6 +1394,21 @@ type RecordCloneStatus struct {
Status CloneStatus `json:"status"` Status CloneStatus `json:"status"`
} }
// Information about aborted clone disk
type RecordCloneAbort struct {
// Disk ID
DiskID uint64 `json:"disk_id"`
// Aborted
Aborted bool `json:"aborted"`
// Blockcopy abort job ID
BlockcopyAbortJobID string `json:"blockcopy_abort_job_id"`
}
// List of aborted clone disks
type ListCloneAbort []RecordCloneAbort
type CloneStatus struct { type CloneStatus struct {
// Type // Type
Type int `json:"type"` Type int `json:"type"`
+3 -3
View File
@@ -39,9 +39,8 @@ type NetAttachRequest struct {
// Required: false // Required: false
MACAddr string `url:"mac_addr,omitempty" json:"mac_addr,omitempty"` MACAddr string `url:"mac_addr,omitempty" json:"mac_addr,omitempty"`
// Used only for EXTNET and DPDK // Used for EXTNET, TRUNK and DPDK
// For DPDK must be 1-9216 // Must be 1500-9216
// For EXTNET must be 1500-9216
// Required: false // Required: false
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"` MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`
@@ -75,6 +74,7 @@ type NetAttachRequest struct {
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"` SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
// Flag indicating whether security groups are enabled for this interface // Flag indicating whether security groups are enabled for this interface
// Not applicable to netType VFNIC, TRUNK, or SDN
// Required: false // Required: false
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"` EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
+1 -1
View File
@@ -15,7 +15,7 @@ type RedeployRequest struct {
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
// Storage policy id of compute. The rules of the specified storage policy will be used. // Storage policy id of compute. The rules of the specified storage policy will be used.
// Required: true // Required: false
StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"` StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"`
// ID of the new OS image, if image change is required // ID of the new OS image, if image change is required
+3 -1
View File
@@ -16,8 +16,10 @@ type SnapshotCreateRequest struct {
// Text label for snapshot. // Text label for snapshot.
// Must be unique among this compute snapshots // Must be unique among this compute snapshots
// Allowed characters: a-z, 0-9, spaces, punctuation except '<' and '>'
// Maximum length: 36 characters
// Required: true // Required: true
Label string `url:"label" json:"label" validate:"required"` Label string `url:"label" json:"label" validate:"required,max=36,excludesall=<>"`
} }
// SnapshotCreate create compute snapshot // SnapshotCreate create compute snapshot
-2
View File
@@ -403,7 +403,6 @@ var unattachedDisks = ListDisksUnattached{
Snapshots: nil, Snapshots: nil,
Status: "CREATED", Status: "CREATED",
TechStatus: techStatusAllocated, TechStatus: techStatusAllocated,
Type: "D",
VMID: 0, VMID: 0,
}, },
{ {
@@ -457,7 +456,6 @@ var unattachedDisks = ListDisksUnattached{
Snapshots: nil, Snapshots: nil,
Status: "CREATED", Status: "CREATED",
TechStatus: techStatusAllocated, TechStatus: techStatusAllocated,
Type: "B",
VMID: 0, VMID: 0,
}, },
}, },
+21
View File
@@ -50,6 +50,9 @@ type ItemDisk struct {
// Image ID // Image ID
ImageID uint64 `json:"imageId"` ImageID uint64 `json:"imageId"`
// Independent
Independent bool `json:"independent"`
// List of image IDs // List of image IDs
Images []uint64 `json:"images"` Images []uint64 `json:"images"`
@@ -86,6 +89,9 @@ type ItemDisk struct {
// Present to // Present to
PresentTo map[string]uint64 `json:"presentTo"` PresentTo map[string]uint64 `json:"presentTo"`
// Provision
Provision string `json:"provision"`
// Purge time // Purge time
PurgeTime uint64 `json:"purgeTime"` PurgeTime uint64 `json:"purgeTime"`
@@ -238,6 +244,9 @@ type ItemDiskUnattached struct {
// Present to // Present to
PresentTo map[string]uint64 `json:"presentTo"` PresentTo map[string]uint64 `json:"presentTo"`
// Provision
Provision string `json:"provision"`
// Purge attempts // Purge attempts
PurgeAttempts uint64 `json:"purgeAttempts"` PurgeAttempts uint64 `json:"purgeAttempts"`
@@ -280,6 +289,12 @@ type ItemDiskUnattached struct {
// Tech status // Tech status
TechStatus string `json:"techStatus"` TechStatus string `json:"techStatus"`
// Need to clean before destroy
ToClean bool `json:"to_clean"`
// ID of the Storage Policy
StoragePolicyID uint64 `json:"storage_policy_id"`
// Virtual machine ID // Virtual machine ID
VMID uint64 `json:"vmid"` VMID uint64 `json:"vmid"`
} }
@@ -423,6 +438,9 @@ type RecordDisk struct {
// Image ID // Image ID
ImageID uint64 `json:"imageId"` ImageID uint64 `json:"imageId"`
// Independent
Independent bool `json:"independent"`
// List of image IDs // List of image IDs
Images []uint64 `json:"images"` Images []uint64 `json:"images"`
@@ -459,6 +477,9 @@ type RecordDisk struct {
// Present to // Present to
PresentTo map[string]uint64 `json:"presentTo"` PresentTo map[string]uint64 `json:"presentTo"`
// Provision
Provision string `json:"provision"`
// Purge time // Purge time
PurgeTime uint64 `json:"purgeTime"` PurgeTime uint64 `json:"purgeTime"`
+6
View File
@@ -140,12 +140,18 @@ type RecordImage struct {
// ID // ID
ID uint64 `json:"id"` ID uint64 `json:"id"`
// Independent
Independent bool `json:"independent"`
// Last modified // Last modified
LastModified uint64 `json:"lastModified"` LastModified uint64 `json:"lastModified"`
// Link to // Link to
LinkTo uint64 `json:"linkTo"` LinkTo uint64 `json:"linkTo"`
// Links to
LinksTo []uint64 `json:"linksTo"`
// Milestones // Milestones
Milestones uint64 `json:"milestones"` Milestones uint64 `json:"milestones"`
+3 -2
View File
@@ -30,8 +30,8 @@ type Interface struct {
// Required: false // Required: false
IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"` IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"`
// Maximum transmission unit, must be 1-9216 // Used for EXTNET, TRUNK and DPDK
// Used only to DPDK net type // Must be 1500-9216
// Required: false // Required: false
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"` MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`
@@ -69,6 +69,7 @@ type Interface struct {
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"` SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
// Flag indicating whether security groups are enabled for this interface // Flag indicating whether security groups are enabled for this interface
// Not applicable to netType VFNIC, TRUNK, or SDN
// Required: false // Required: false
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"` EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
+5 -5
View File
@@ -16,22 +16,22 @@ type HighlyAvailableRequest struct {
} }
// HighlyAvailable makes load balancer highly available // HighlyAvailable makes load balancer highly available
func (l LB) HighlyAvailable(ctx context.Context, req HighlyAvailableRequest) (uint64, error) { func (l LB) HighlyAvailable(ctx context.Context, req HighlyAvailableRequest) (bool, error) {
err := validators.ValidateRequest(req) err := validators.ValidateRequest(req)
if err != nil { if err != nil {
return 0, validators.ValidationErrors(validators.GetErrors(err)) return false, validators.ValidationErrors(validators.GetErrors(err))
} }
url := "/cloudapi/lb/makeHighlyAvailable" url := "/cloudapi/lb/makeHighlyAvailable"
res, err := l.client.DecortApiCall(ctx, http.MethodPost, url, req) res, err := l.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil { if err != nil {
return 0, err return false, err
} }
result, err := strconv.ParseUint(string(res), 10, 64) result, err := strconv.ParseBool(string(res))
if err != nil { if err != nil {
return 0, err return false, err
} }
return result, nil return result, nil
+9
View File
@@ -34,6 +34,15 @@ type ItemLocation struct {
// Support of SDN // Support of SDN
SDNSupport bool `json:"sdn_support"` SDNSupport bool `json:"sdn_support"`
// Is Zero Access enabled
ZeroAccessEnabled bool `json:"zeroaccess_enabled"`
// Is BRO enabled
BROEnabled bool `json:"bro_enabled"`
// Are VM Folders enabled
VMFoldersEnabled bool `json:"vm_folders_enabled"`
} }
// List of locations // List of locations
+1
View File
@@ -2,6 +2,7 @@ package pcidevice
import ( import (
"encoding/json" "encoding/json"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/serialization" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/serialization"
) )
+8
View File
@@ -0,0 +1,8 @@
package cloudapi
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/pkg/cloudapi/vgpu"
// Accessing the VGPU method group
func (ca *CloudAPI) VGPU() *vgpu.VGPU {
return vgpu.New(ca.client)
}
+10
View File
@@ -0,0 +1,10 @@
package vgpu
// IDs gets array of VGPU IDs from ListVGPU struct
func (l ListVGPU) IDs() []uint64 {
res := make([]uint64, 0, len(l.Data))
for _, v := range l.Data {
res = append(res, v.ID)
}
return res
}
+88
View File
@@ -0,0 +1,88 @@
package vgpu
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// ListRequest struct to get list of VGPU
type ListRequest struct {
// Find by id
// Required: false
ByID uint64 `url:"by_id,omitempty" json:"by_id,omitempty"`
// Find by vgpu status
// Required: false
Status string `url:"status,omitempty" json:"status,omitempty"`
// Find by vgpu type
// Required: false
Type string `url:"type,omitempty" json:"type,omitempty"`
// Find by vgpu mode
// Required: false
Mode string `url:"mode,omitempty" json:"mode,omitempty"`
// Find by id resgroup
// Required: false
RGID uint64 `url:"rgId,omitempty" json:"rgId,omitempty"`
// Find by account id
// Required: false
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
// Find by compute id
// Required: false
ComputeID uint64 `url:"computeId,omitempty" json:"computeId,omitempty"`
// Find by pgpu id
// Required: false
PGPUID uint64 `url:"pgpuId,omitempty" json:"pgpuId,omitempty"`
// 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"`
}
// List gets list of all VGPU as a ListVGPU struct
func (v VGPU) List(ctx context.Context, req ListRequest) (*ListVGPU, error) {
res, err := v.ListRaw(ctx, req)
if err != nil {
return nil, err
}
list := ListVGPU{}
err = json.Unmarshal(res, &list)
if err != nil {
return nil, err
}
return &list, nil
}
// ListRaw gets list of all VGPU as an array of bytes
func (v VGPU) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/vgpu/list"
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
return res, err
}
+69
View File
@@ -0,0 +1,69 @@
package vgpu
type ItemVGPU struct {
// Account ID
AccountID uint64 `json:"accountId"`
// Created time
CreatedTime uint64 `json:"createdTime"`
// Deleted time
DeletedTime uint64 `json:"deletedTime"`
//Grid ID
GID uint64 `json:"gid"`
// GUID
GUID uint64 `json:"guid"`
// VGPU ID
ID uint64 `json:"id"`
// Last claimed by
LastClaimedBy uint64 `json:"lastClaimedBy"`
// Last update time
LastUpdateTime uint64 `json:"lastUpdateTime"`
// Mode
Mode string `json:"mode"`
// Bus number
BusNumber int `json:"bus_number"`
// PCI Slot
PCISlot int `json:"pciSlot"`
// PGPUID
PGPUID uint64 `json:"pgpuid"`
// Profile ID
ProfileID uint64 `json:"profileId"`
// RAM
RAM uint64 `json:"ram"`
// Reference ID
ReferenceID string `json:"referenceId"`
// RGID
RGID uint64 `json:"rgId"`
// Status
Status string `json:"status"`
// Type
Type string `json:"type"`
// VMID
VMID uint64 `json:"vmid"`
}
// List of VGPU
type ListVGPU struct {
// Data
Data []ItemVGPU `json:"data"`
// Entry count
EntryCount uint64 `json:"entryCount"`
}
+43
View File
@@ -0,0 +1,43 @@
package vgpu
import (
"encoding/json"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/serialization"
)
// Serialize returns JSON-serialized []byte. Used as a wrapper over json.Marshal and json.MarshalIndent functions.
//
// In order to serialize with indent make sure to follow these guidelines:
// - First argument -> prefix
// - Second argument -> indent
func (l ListVGPU) Serialize(params ...string) (serialization.Serialized, error) {
if len(l.Data) == 0 {
return []byte{}, nil
}
if len(params) > 1 {
prefix := params[0]
indent := params[1]
return json.MarshalIndent(l, prefix, indent)
}
return json.Marshal(l)
}
// Serialize returns JSON-serialized []byte. Used as a wrapper over json.Marshal and json.MarshalIndent functions.
//
// In order to serialize with indent make sure to follow these guidelines:
// - First argument -> prefix
// - Second argument -> indent
func (i ItemVGPU) Serialize(params ...string) (serialization.Serialized, error) {
if len(params) > 1 {
prefix := params[0]
indent := params[1]
return json.MarshalIndent(i, prefix, indent)
}
return json.Marshal(i)
}
+15
View File
@@ -0,0 +1,15 @@
package vgpu
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/interfaces"
// Structure for creating request to VGPU
type VGPU struct {
client interfaces.Caller
}
// Builder for VGPU endpoints
func New(client interfaces.Caller) *VGPU {
return &VGPU{
client: client,
}
}
+5
View File
@@ -57,6 +57,11 @@ type CreateInAccountRequest 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"`
// Enable security groups for VINS
// Required: false
// Default: false
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
} }
type wrapperCreateRequestInAcc struct { type wrapperCreateRequestInAcc struct {
+5
View File
@@ -51,6 +51,11 @@ type CreateInRGRequest 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"`
// Enable security groups for VINS
// Required: false
// Default: false
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
} }
type wrapperCreateRequestInRG struct { type wrapperCreateRequestInRG struct {
+10
View File
@@ -0,0 +1,10 @@
package cloudapi
import (
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/pkg/cloudapi/vmfolder"
)
// Accessing the VMFolder method group
func (ca *CloudAPI) VMFolder() *vmfolder.VMFolder {
return vmfolder.New(ca.client)
}
+47
View File
@@ -0,0 +1,47 @@
package vmfolder
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// AddACLAccessRequest adds ACL access to a vm folder
type AddACLAccessRequest struct {
// ID of a folder
// Required: true
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
// User or group name to grant access
// Required: true
User string `url:"user" json:"user" validate:"required"`
// ID of a folder
// Required: true
Right string `url:"right" json:"right" validate:"required"`
}
// AddACLAccess adds ACL access to a vm folder
func (v VMFolder) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/vmfolder/add_acl_access"
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
+43
View File
@@ -0,0 +1,43 @@
package vmfolder
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// ComputesMoveRequest struct to move computes to a vm folder
type ComputesMoveRequest struct {
// IDs of computes to move
// Required: true
ComputeIDs []uint64 `url:"compute_ids" json:"compute_ids" validate:"required"`
// Target vm folder ID
// Required: true
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
}
// ComputesMove moves computes to a vm folder
func (v VMFolder) ComputesMove(ctx context.Context, req ComputesMoveRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/vmfolder/computes_move"
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
+47
View File
@@ -0,0 +1,47 @@
package vmfolder
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// CreateRequest struct to create a vm folder
type CreateRequest struct {
// Resource Group ID
// Required: true
RGID uint64 `url:"rg_id" json:"rg_id" validate:"required"`
// Name
// Required: true
Name string `url:"name" json:"name" validate:"required"`
// Parent ID
// Required: false
ParentID uint64 `url:"parent_id,omitempty" json:"parent_id,omitempty"`
}
// Create creates a vm folder
func (v VMFolder) Create(ctx context.Context, req CreateRequest) (uint64, error) {
err := validators.ValidateRequest(req)
if err != nil {
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/vmfolder/create"
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return 0, err
}
result, err := strconv.ParseUint(string(res), 10, 64)
if err != nil {
return 0, err
}
return result, nil
}
+43
View File
@@ -0,0 +1,43 @@
package vmfolder
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// DeleteACLAccessRequest deletes ACL access from a vm folder
type DelACLAccessRequest struct {
// ID of a folder
// Required: true
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
// User or group name to revoke access from
// Required: true
User string `url:"user" json:"user" validate:"required"`
}
// DeleteACLAccess deletes ACL access from a vm foler
func (v VMFolder) DeleteACLAccess(ctx context.Context, req DelACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/vmfolder/del_acl_access"
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
+39
View File
@@ -0,0 +1,39 @@
package vmfolder
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// DeleteRequest struct to delete a VM folder
type DeleteRequest struct {
// ID of a folder to delete
// Required: true
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
}
// Delete deletes a vm folder
func (v VMFolder) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/vmfolder/delete"
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
+47
View File
@@ -0,0 +1,47 @@
package vmfolder
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// GetRequest struct to get detailed information about a vm folder
type GetRequest struct {
// ID of a folder
// Required: true
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
}
// Get gets current configuration of the vm folder as a RecordVMFolder struct
func (v VMFolder) Get(ctx context.Context, req GetRequest) (*RecordVMFolder, error) {
res, err := v.GetRaw(ctx, req)
if err != nil {
return nil, err
}
info := RecordVMFolder{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}
// GetRaw gets current configuration of the vm folder as an array of bytes
func (v VMFolder) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/vmfolder/get"
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
return res, err
}
+56
View File
@@ -0,0 +1,56 @@
package vmfolder
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// ListRequest struct to get list of vm folders
type ListRequest struct {
// Resource group ID
// Required: true
RGID uint64 `url:"rg_id" json:"rg_id" validate:"required"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
// Page size
// Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of all vm folders in a resource group as a ListVMFolder struct
func (v VMFolder) List(ctx context.Context, req ListRequest) (*ListVMFolder, error) {
res, err := v.ListRaw(ctx, req)
if err != nil {
return nil, err
}
list := ListVMFolder{}
err = json.Unmarshal(res, &list)
if err != nil {
return nil, err
}
return &list, nil
}
// ListRaw gets list of all vm folders in a resource group as an array of bytes
func (v VMFolder) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
if err := validators.ValidateRequest(req); err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/vmfolder/list"
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
return res, err
}
+79
View File
@@ -0,0 +1,79 @@
package vmfolder
// Detailed information about a folder
type RecordVMFolder struct {
// ID
ID uint64 `json:"id"`
// RG ID
RGID uint64 `json:"rg_id"`
// GID
GID uint64 `json:"gid"`
// Name of a folder
Name string `json:"name"`
// ACL
ACL []ACL `json:"acl"`
// Time of creation
CreatedTime uint64 `json:"created_time"`
// Parent ID
ParentID uint64 `json:"parent_id"`
// Status of a folder
Status string `json:"status"`
// Compute IDs
ComputeIDs []uint64 `json:"compute_ids"`
}
// ACL
type ACL struct {
// Explicit
Explicit bool `json:"explicit"`
// Right
Right string `json:"right"`
// Status
Status string `json:"status"`
// Type
Type string `json:"type"`
// User group ID
UserGroupID string `json:"userGroupId"`
}
// List of vm folders
type ListVMFolder struct {
// Entry count
EntryCount uint64 `json:"entryCount"`
// Data
Data []ItemVMFolder `json:"data"`
}
// Detailed information about a folder item
type ItemVMFolder struct {
// Folder ID
ID uint64 `json:"id"`
// Parent ID
ParentID uint64 `json:"parent_id"`
// Name
Name string `json:"name"`
// ACL
ACL []ACL `json:"acl"`
// Status
Status string `json:"status"`
// VM count
VMCount uint64 `json:"vm_count"`
}
+43
View File
@@ -0,0 +1,43 @@
package vmfolder
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// MoveRequest to move a vm folder to a compute
type MoveRequest struct {
// VM Folder ID
// Required: true
FolderID uint64 `url:"folder_id" json:"folder_id"`
// New parent folder ID
// Required: true
NewParentID uint64 `url:"new_parent_id" json:"new_parent_id"`
}
// Move moves a vm folder to a compute
func (v VMFolder) Move(ctx context.Context, req MoveRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/vmfolder/move"
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
+43
View File
@@ -0,0 +1,43 @@
package vmfolder
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// RenameRequest struct to rename a VM folder
type RenameRequest struct {
// ID of a folder to rename
// Required: true
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
// A new name
// Required: true
Name string `url:"name" json:"name" validate:"required"`
}
// Rename renames a vm folder
func (v VMFolder) Rename(ctx context.Context, req RenameRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/vmfolder/rename"
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
+17
View File
@@ -0,0 +1,17 @@
package vmfolder
import (
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/interfaces"
)
// Structure for creating request to VMFolder
type VMFolder struct {
client interfaces.Caller
}
// Builder for VMFolder endpoints
func New(client interfaces.Caller) *VMFolder {
return &VMFolder{
client,
}
}
+7 -7
View File
@@ -2,7 +2,7 @@ package zone
// FilterByID returns ListZones with specified ID. // FilterByID returns ListZones with specified ID.
func (list ListZones) FilterByID(id uint64) ListZones { func (list ListZones) FilterByID(id uint64) ListZones {
predicate := func(izone RecordZone) bool { predicate := func(izone ItemZone) bool {
return izone.ID == id return izone.ID == id
} }
@@ -11,7 +11,7 @@ func (list ListZones) FilterByID(id uint64) ListZones {
// FilterByName returns ListZones with specified Name. // FilterByName returns ListZones with specified Name.
func (list ListZones) FilterByName(name string) ListZones { func (list ListZones) FilterByName(name string) ListZones {
predicate := func(izone RecordZone) bool { predicate := func(izone ItemZone) bool {
return izone.Name == name return izone.Name == name
} }
@@ -20,7 +20,7 @@ func (list ListZones) FilterByName(name string) ListZones {
// FilterByStatus returns ListZones with specified Status. // FilterByStatus returns ListZones with specified Status.
func (list ListZones) FilterByStatus(status string) ListZones { func (list ListZones) FilterByStatus(status string) ListZones {
predicate := func(izone RecordZone) bool { predicate := func(izone ItemZone) bool {
return izone.Status == status return izone.Status == status
} }
@@ -28,7 +28,7 @@ func (list ListZones) FilterByStatus(status string) ListZones {
} }
// FilterFunc allows filtering ListZones based on a user-specified predicate. // FilterFunc allows filtering ListZones based on a user-specified predicate.
func (list ListZones) FilterFunc(predicate func(RecordZone) bool) ListZones { func (list ListZones) FilterFunc(predicate func(ItemZone) bool) ListZones {
var result ListZones var result ListZones
for _, item := range list.Data { for _, item := range list.Data {
@@ -42,11 +42,11 @@ func (list ListZones) FilterFunc(predicate func(RecordZone) bool) ListZones {
return result return result
} }
// FindOne returns first found RecordZone // FindOne returns first found ItemZone
// If none was found, returns an empty struct. // If none was found, returns an empty struct.
func (list ListZones) FindOne() RecordZone { func (list ListZones) FindOne() ItemZone {
if list.EntryCount == 0 { if list.EntryCount == 0 {
return RecordZone{} return ItemZone{}
} }
return list.Data[0] return list.Data[0]
+2 -2
View File
@@ -3,7 +3,7 @@ package zone
import "testing" import "testing"
var zones = ListZones{ var zones = ListZones{
Data: []RecordZone{ Data: []ItemZone{
{ {
ID: 2, ID: 2,
@@ -76,7 +76,7 @@ func TestFilterByStatus(t *testing.T) {
} }
func TestFilterFunc(t *testing.T) { func TestFilterFunc(t *testing.T) {
actual := zones.FilterFunc(func(ien RecordZone) bool { actual := zones.FilterFunc(func(ien ItemZone) bool {
return ien.Deletable == true return ien.Deletable == true
}) })
+104 -2
View File
@@ -5,7 +5,7 @@ type ListZones struct {
EntryCount uint64 `json:"entryCount"` EntryCount uint64 `json:"entryCount"`
// Data // Data
Data []RecordZone `json:"data"` Data []ItemZone `json:"data"`
} }
// Detailed information about the zone record // Detailed information about the zone record
@@ -47,7 +47,7 @@ type RecordZone struct {
K8SIDs []uint64 `json:"k8sIds"` K8SIDs []uint64 `json:"k8sIds"`
// List of associated LB IDs // List of associated LB IDs
LBIDs []uint64 `json:"lbIds"` LBIDs []uint64 `json:"lbsIds"`
// Status // Status
Status string `json:"status"` Status string `json:"status"`
@@ -63,4 +63,106 @@ type RecordZone struct {
// List of associated VINS IDs // List of associated VINS IDs
VinsIDs []uint64 `json:"vinsIds"` VinsIDs []uint64 `json:"vinsIds"`
// DRS
DRS bool `json:"drs"`
// DRS UID
DRSUID string `json:"drs_uid"`
// App ID
AppID string `json:"app_id"`
// Decort URL
DecortURL string `json:"decort_url"`
// DRS Name
DRSName string `json:"drs_name"`
// SSO URL
SSOURL string `json:"sso_url"`
// SSO type
SSOType string `json:"sso_type"`
// Ping address
PingAddr string `json:"ping_addr"`
// Broadcast address
BroadcastAddr string `json:"broadcast_addr"`
// Skip ssl verify
SSLSkipVerify bool `json:"ssl_skip_verify"`
// Domain
Domain string `json:"domain"`
}
// A zone item from a list
type ItemZone struct {
// App ID
AppID string `json:"app_id"`
// If true, all nodes belonging to the given zone will be marked for autostart
AutoStart bool `json:"autostart"`
// Created timestamp
CreatedTime uint64 `json:"createdTime"`
// Decort URL
DecortURL string `json:"decort_url"`
// Deletable flag
Deletable bool `json:"deletable"`
// Description
Description string `json:"description"`
// DRS
DRS bool `json:"drs"`
// DRS Name
DRSName string `json:"drs_name"`
// DRS UID
DRSUID string `json:"drs_uid"`
// GID
GID uint64 `json:"gid"`
// GUID
GUID uint64 `json:"guid"`
// ID
ID uint64 `json:"id"`
// Name
Name string `json:"name"`
// List of associated Node IDs
NodeIDs []uint64 `json:"nodeIds"`
// SSO URL
SSOURL string `json:"sso_url"`
// SSO type
SSOType string `json:"sso_type"`
// Status
Status string `json:"status"`
// Updated timestamp
UpdatedTime uint64 `json:"updatedTime"`
// Ping address
PingAddr string `json:"ping_addr"`
// Broadcast address
BroadcastAddr string `json:"broadcast_addr"`
// Skip ssl verify
SSLSkipVerify bool `json:"ssl_skip_verify"`
// Domain
Domain string `json:"domain"`
} }
@@ -3,8 +3,9 @@ package account
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter // SetCPUAllocationParameterRequest struct for setting CPU allocation parameter
+4
View File
@@ -64,6 +64,10 @@ type UpdateRequest struct {
// Default zone ID // Default zone ID
// Required: false // Required: false
DefaultZoneID uint64 `url:"defaultZoneId,omitempty" json:"defaultZoneId,omitempty"` DefaultZoneID uint64 `url:"defaultZoneId,omitempty" json:"defaultZoneId,omitempty"`
// CPU allocation parameter
// Required: false
CpuAllocationParameter string `url:"cpu_allocation_parameter,omitempty" json:"cpu_allocation_parameter,omitempty"`
} }
// Update updates an account name and resource types and limits // Update updates an account name and resource types and limits
+9 -7
View File
@@ -2,8 +2,8 @@ package apiaccess
import ( import (
"context" "context"
"encoding/json"
"net/http" "net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
@@ -20,23 +20,25 @@ type DescUpdateRequest struct {
} }
// DescUpdate sets a new text description of the apiaccess group. // DescUpdate sets a new text description of the apiaccess group.
func (a APIAccess) DescUpdate(ctx context.Context, req DescUpdateRequest) (bool, error) { func (a APIAccess) DescUpdate(ctx context.Context, req DescUpdateRequest) (*ItemAPIAccess, error) {
err := validators.ValidateRequest(req) err := validators.ValidateRequest(req)
if err != nil { if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err)) return nil, validators.ValidationErrors(validators.GetErrors(err))
} }
url := "/cloudbroker/apiaccess/descUpdate" url := "/cloudbroker/apiaccess/descUpdate"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req) res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil { if err != nil {
return false, err return nil, err
} }
result, err := strconv.ParseBool(string(res)) info := ItemAPIAccess{}
err = json.Unmarshal(res, &info)
if err != nil { if err != nil {
return false, err return nil, err
} }
return result, nil return &info, nil
} }
+144 -101
View File
@@ -1,5 +1,7 @@
package apiaccess package apiaccess
import "encoding/json"
type ItemAPIAccess struct { type ItemAPIAccess struct {
// APIs // APIs
APIs APIsEndpoints `json:"apis"` APIs APIsEndpoints `json:"apis"`
@@ -88,119 +90,160 @@ type APIsEndpoints struct {
// CloudBroker endpoints // CloudBroker endpoints
CloudBroker CloudBrokerEndpoints `json:"cloudbroker,omitempty"` CloudBroker CloudBrokerEndpoints `json:"cloudbroker,omitempty"`
// LibCloud endpoints // SDN endpoints
LibCloud LibCloudEndpoints `json:"libcloud,omitempty"` SDN SDNEndpoints `json:"sdn,omitempty"`
// System endpoints // System endpoints
System SystemEndpoints `json:"system,omitempty"` System SystemEndpoints `json:"system,omitempty"`
} }
// MarshalJSON omits empty namespaces, so that "{}" is not sent in requests.
func (a APIsEndpoints) MarshalJSON() ([]byte, error) {
namespaces := []struct {
key string
value interface{}
}{
{"cloudapi", a.CloudAPI},
{"cloudbroker", a.CloudBroker},
{"sdn", a.SDN},
{"system", a.System},
}
result := make(map[string]json.RawMessage, len(namespaces))
for _, ns := range namespaces {
data, err := json.Marshal(ns.value)
if err != nil {
return nil, err
}
if string(data) == "{}" {
continue
}
result[ns.key] = data
}
return json.Marshal(result)
}
type CloudAPIEndpoints struct { type CloudAPIEndpoints struct {
Account []string `json:"account,omitempty"` Account []string `json:"account,omitempty"`
BService []string `json:"bservice,omitempty"` Audit []string `json:"audit,omitempty"`
CloudSpace []string `json:"cloudspace,omitempty"` BService []string `json:"bservice,omitempty"`
Compute []string `json:"compute,omitempty"` Compute []string `json:"compute,omitempty"`
ComputeCI []string `json:"computeci,omitempty"` Disks []string `json:"disks,omitempty"`
Disks []string `json:"disks,omitempty"` DPDKNet []string `json:"dpdknet,omitempty"`
DPDK []string `json:"dpdk,omitempty"` ExtNet []string `json:"extnet,omitempty"`
ExtNet []string `json:"extnet,omitempty"` FLIPGroup []string `json:"flipgroup,omitempty"`
FLIPGroup []string `json:"flipgroup,omitempty"` GPU []string `json:"gpu,omitempty"`
GPU []string `json:"gpu,omitempty"` Image []string `json:"image,omitempty"`
Image []string `json:"image,omitempty"` K8CI []string `json:"k8ci,omitempty"`
K8CI []string `json:"k8ci,omitempty"` K8S []string `json:"k8s,omitempty"`
K8S []string `json:"k8s,omitempty"` KVMX86 []string `json:"kvmx86,omitempty"`
KVMX86 []string `json:"kvmx86,omitempty"` LB []string `json:"lb,omitempty"`
LB []string `json:"lb,omitempty"` Loactions []string `json:"locations,omitempty"`
Loactions []string `json:"locations,omitempty"` PCIDevice []string `json:"pcidevice,omitempty"`
Machine []string `json:"machine,omitempty"` Prometheus []string `json:"prometheus,omitempty"`
Openshift []string `json:"openshift,omitempty"` RG []string `json:"rg,omitempty"`
OpenshiftCI []string `json:"openshiftci,omitempty"` SecurityGroup []string `json:"security_group,omitempty"`
PCIDevice []string `json:"pcidevice,omitempty"` SEP []string `json:"sep,omitempty"`
PortForwarding []string `json:"portforwarding,omitempty"` StoragePolicy []string `json:"storage_policy,omitempty"`
Prometheus []string `json:"prometheus,omitempty"` Tasks []string `json:"tasks,omitempty"`
RG []string `json:"rg,omitempty"` Trunk []string `json:"trunk,omitempty"`
Sizes []string `json:"sizes,omitempty"` User []string `json:"user,omitempty"`
Tasks []string `json:"tasks,omitempty"` VFPool []string `json:"vfpool,omitempty"`
User []string `json:"user,omitempty"` VGPU []string `json:"vgpu,omitempty"`
VGPU []string `json:"vgpu,omitempty"` VINS []string `json:"vins,omitempty"`
VINS []string `json:"vins,omitempty"` Zone []string `json:"zone,omitempty"`
All bool `json:"ALL,omitempty"` All bool `json:"ALL,omitempty"`
} }
type CloudBrokerEndpoints struct { type CloudBrokerEndpoints struct {
Account []string `json:"account,omitempty"` Account []string `json:"account,omitempty"`
APIAccess []string `json:"apiaccess,omitempty"` APIAccess []string `json:"apiaccess,omitempty"`
Audit interface{} `json:"audit,omitempty"` Audit interface{} `json:"audit,omitempty"`
AuditBeat []string `json:"auditbeat,omitempty"` AuditBeat []string `json:"auditbeat,omitempty"`
AuditCollector []string `json:"auditcollector,omitempty"` AuditCollector []string `json:"auditcollector,omitempty"`
BackupCreator []string `json:"backupcreator,omitempty"` Backup []string `json:"backup,omitempty"`
BService []string `json:"bservice,omitempty"` BackupCreator []string `json:"backupcreator,omitempty"`
CloudSpace []string `json:"cloudspace,omitempty"` BService []string `json:"bservice,omitempty"`
Compute []string `json:"compute,omitempty"` Compute []string `json:"compute,omitempty"`
ComputeCI []string `json:"computeci,omitempty"` Disks []string `json:"disks,omitempty"`
Desnode []string `json:"desnode,omitempty"` DPDKNet []string `json:"dpdknet,omitempty"`
Diagnostics []string `json:"diagnostics,omitempty"` Eco []string `json:"eco,omitempty"`
Disks []string `json:"disks,omitempty"` ExtNet []string `json:"extnet,omitempty"`
DPDK []string `json:"dpdk,omitempty"` FlIPgroup []string `json:"flipgroup,omitempty"`
Eco []string `json:"eco,omitempty"` Grid []string `json:"grid,omitempty"`
ExtNet []string `json:"extnet,omitempty"` Group []string `json:"group,omitempty"`
FlIPgroup []string `json:"flipgroup,omitempty"` Health []string `json:"health,omitempty"`
Grid []string `json:"grid,omitempty"` Image []string `json:"image,omitempty"`
Group []string `json:"group,omitempty"` Job interface{} `json:"job,omitempty"`
Health []string `json:"health,omitempty"` K8CI []string `json:"k8ci,omitempty"`
IaaS []string `json:"iaas,omitempty"` K8S []string `json:"k8s,omitempty"`
Image []string `json:"image,omitempty"` KVMX86 []string `json:"kvmx86,omitempty"`
Job interface{} `json:"job,omitempty"` LB []string `json:"lb,omitempty"`
K8CI []string `json:"k8ci,omitempty"` Metering []string `json:"metering,omitempty"`
K8S []string `json:"k8s,omitempty"` Milestones []string `json:"milestones,omitempty"`
KVMX86 []string `json:"kvmx86,omitempty"` Node []string `json:"node,omitempty"`
LB []string `json:"lb,omitempty"` PCIDevice []string `json:"pcidevice,omitempty"`
Machine []string `json:"machine,omitempty"` PGPU []string `json:"pgpu,omitempty"`
Metering []string `json:"metering,omitempty"` Prometheus []string `json:"prometheus,omitempty"`
Milestones []string `json:"milestones,omitempty"` Resmon interface{} `json:"resmon,omitempty"`
Openshift []string `json:"openshift,omitempty"` ResourceOptimizer []string `json:"resource_optimizer,omitempty"`
OpenshiftCI []string `json:"openshiftci,omitempty"` RG []string `json:"rg,omitempty"`
Ovsnode []string `json:"ovsnode,omitempty"` SecurityGroup []string `json:"security_group,omitempty"`
PCIDevice []string `json:"pcidevice,omitempty"` Sep []string `json:"sep,omitempty"`
PGPU []string `json:"pgpu,omitempty"` StoragePolicy []string `json:"storage_policy,omitempty"`
Prometheus []string `json:"prometheus,omitempty"` Tasks []string `json:"tasks,omitempty"`
QOS []string `json:"qos,omitempty"` TLock []string `json:"tlock,omitempty"`
Resmon interface{} `json:"resmon,omitempty"` Trunk []string `json:"trunk,omitempty"`
RG []string `json:"rg,omitempty"` User []string `json:"user,omitempty"`
Sep []string `json:"sep,omitempty"` VFPool []string `json:"vfpool,omitempty"`
Node []string `json:"node,omitempty"` VGPU []string `json:"vgpu,omitempty"`
Tasks []string `json:"tasks,omitempty"` VINS []string `json:"vins,omitempty"`
TLock []string `json:"tlock,omitempty"` VNFDev []string `json:"vnfdev,omitempty"`
User []string `json:"user,omitempty"` ZeroAccess []string `json:"zeroaccess,omitempty"`
VGPU []string `json:"vgpu,omitempty"` Zone []string `json:"zone,omitempty"`
VINS []string `json:"vins,omitempty"` All bool `json:"ALL,omitempty"`
VNFDev []string `json:"vnfdev,omitempty"`
ZeroAccess []string `json:"zeroaccess,omitempty"`
All bool `json:"ALL,omitempty"`
} }
type LibCloudEndpoints struct { type SDNEndpoints struct {
Libvirt []string `json:"libvirt,omitempty"` AccessGroup []string `json:"access_group,omitempty"`
All bool `json:"ALL,omitempty"` AddressPool []string `json:"address_pool,omitempty"`
DefaultSecurityPolicy []string `json:"default_security_policy,omitempty"`
ExternalNetwork []string `json:"external_network,omitempty"`
FloatingIP []string `json:"floating_ip,omitempty"`
Hypervisor []string `json:"hypervisor,omitempty"`
L2ExternalNetwork []string `json:"l2_external_network,omitempty"`
LogicalPort []string `json:"logical_port,omitempty"`
NetworkObjectGroup []string `json:"network_object_group,omitempty"`
Router []string `json:"router,omitempty"`
RouterGatewayPort []string `json:"router/gateway_port,omitempty"`
RouterPolicies []string `json:"router/policies,omitempty"`
RouterRouterPort []string `json:"router/router_port,omitempty"`
RouterStaticRoute []string `json:"router/static_route,omitempty"`
SecurityPolicy []string `json:"security_policy,omitempty"`
SecurityPolicyRule []string `json:"security_policy/rule,omitempty"`
SecurityRule []string `json:"security_rule,omitempty"`
Segment []string `json:"segment,omitempty"`
Version []string `json:"version,omitempty"`
All bool `json:"ALL,omitempty"`
} }
type SystemEndpoints struct { type SystemEndpoints struct {
AgentController []string `json:"agentcontroller,omitempty"` Audits []string `json:"audits,omitempty"`
Alerts []string `json:"alerts,omitempty"` Cache []string `json:"cache,omitempty"`
Audits []string `json:"audits,omitempty"` ContentManager []string `json:"contentmanager,omitempty"`
ContentManager []string `json:"contentmanager,omitempty"` DocGenerator []string `json:"docgenerator,omitempty"`
DocGenerator []string `json:"docgenerator,omitempty"` EmailSender []string `json:"emailsender,omitempty"`
EmailSender []string `json:"emailsender,omitempty"` GridManager []string `json:"gridmanager,omitempty"`
ErrorConditionHandler []string `json:"errorconditionhandler,omitempty"` Health []string `json:"health,omitempty"`
GridManager []string `json:"gridmanager,omitempty"` Info []string `json:"info,omitempty"`
Health []string `json:"health,omitempty"` InfoWellknown []string `json:"info/wellknown,omitempty"`
Info []string `json:"info,omitempty"` InfoMGR []string `json:"infomgr,omitempty"`
InfoMGR []string `json:"infomgr,omitempty"` Oauth []string `json:"oauth,omitempty"`
Job []string `json:"job,omitempty"` Task []string `json:"task,omitempty"`
Log []string `json:"log,omitempty"` UserManager []string `json:"usermanager,omitempty"`
Logo []string `json:"logo,omitempty"` All bool `json:"ALL,omitempty"`
Oauth []string `json:"oauth,omitempty"`
Task []string `json:"task,omitempty"`
UserManager []string `json:"usermanager,omitempty"`
All bool `json:"ALL,omitempty"`
} }
+9 -8
View File
@@ -4,7 +4,6 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"net/http" "net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
@@ -27,10 +26,10 @@ type wrapperUpdateRequest struct {
} }
// Update updates apis of apiaccess group. // Update updates apis of apiaccess group.
func (a APIAccess) Update(ctx context.Context, req UpdateRequest) (bool, error) { func (a APIAccess) Update(ctx context.Context, req UpdateRequest) (*ItemAPIAccess, error) {
err := validators.ValidateRequest(req) err := validators.ValidateRequest(req)
if err != nil { if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err)) return nil, validators.ValidationErrors(validators.GetErrors(err))
} }
url := "/cloudbroker/apiaccess/update" url := "/cloudbroker/apiaccess/update"
@@ -41,20 +40,22 @@ func (a APIAccess) Update(ctx context.Context, req UpdateRequest) (bool, error)
apiJSON, err := json.Marshal(&req.APIs) apiJSON, err := json.Marshal(&req.APIs)
if err != nil { if err != nil {
return false, err return nil, err
} }
reqWrapped.APIString = string(apiJSON) reqWrapped.APIString = string(apiJSON)
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped) res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil { if err != nil {
return false, err return nil, err
} }
result, err := strconv.ParseBool(string(res)) info := ItemAPIAccess{}
err = json.Unmarshal(res, &info)
if err != nil { if err != nil {
return false, err return nil, err
} }
return result, nil return &info, nil
} }
@@ -3,7 +3,6 @@ package compute
import ( import (
"context" "context"
"net/http" "net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
@@ -20,23 +19,18 @@ type AbortSharedSnapshotMergeRequest struct {
} }
// AbortSharedSnapshotMerge shared snapshots merge abort // AbortSharedSnapshotMerge shared snapshots merge abort
func (c Compute) AbortSharedSnapshotMerge(ctx context.Context, req AbortSharedSnapshotMergeRequest) (bool, error) { func (c Compute) AbortSharedSnapshotMerge(ctx context.Context, req AbortSharedSnapshotMergeRequest) (string, error) {
err := validators.ValidateRequest(req) err := validators.ValidateRequest(req)
if err != nil { if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err)) return "", validators.ValidationErrors(validators.GetErrors(err))
} }
url := "/cloudbroker/compute/abort_shared_snapshot_merge" url := "/cloudbroker/compute/abort_shared_snapshot_merge"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req) res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil { if err != nil {
return false, err return "", err
} }
result, err := strconv.ParseBool(string(res)) return string(res), nil
if err != nil {
return false, err
}
return result, nil
} }
+2 -1
View File
@@ -3,8 +3,9 @@ package compute
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// ChangeLinkStateRequest struct for changing link state // ChangeLinkStateRequest struct for changing link state
+8
View File
@@ -75,6 +75,14 @@ type ListRequest struct {
// Required: false // Required: false
ZoneID uint64 `url:"zone_id,omitempty" json:"zone_id,omitempty"` ZoneID uint64 `url:"zone_id,omitempty" json:"zone_id,omitempty"`
// Find by VM folder ID
// Required: false
FolderID uint64 `url:"folder_id,omitempty" json:"folder_id,omitempty"`
// Include computes from descendant folders.
// Required: false
IncludeDescendants interface{} `url:"include_descendants,omitempty" json:"include_descendants,omitempty" validate:"omitempty,isBool"`
// Page number // Page number
// Required: false // Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"` Page uint64 `url:"page,omitempty" json:"page,omitempty"`
+18 -3
View File
@@ -442,6 +442,9 @@ type ItemDisk struct {
// Image ID // Image ID
ImageID uint64 `json:"imageId"` ImageID uint64 `json:"imageId"`
// Independent
Independent bool `json:"independent"`
// List image IDs // List image IDs
Images []uint64 `json:"images"` Images []uint64 `json:"images"`
@@ -478,6 +481,9 @@ type ItemDisk struct {
// Present to // Present to
PresentTo map[string]uint64 `json:"presentTo"` PresentTo map[string]uint64 `json:"presentTo"`
// Provision
Provision string `json:"provision"`
// Purge attempts // Purge attempts
PurgeAttempts uint64 `json:"purgeAttempts"` PurgeAttempts uint64 `json:"purgeAttempts"`
@@ -896,6 +902,9 @@ type InfoCompute struct {
// Zone ID // Zone ID
ZoneID uint64 `json:"zoneId"` ZoneID uint64 `json:"zoneId"`
// Folder ID
FolderID uint64 `json:"folder_id"`
} }
type QemuQuest struct { type QemuQuest struct {
@@ -1189,6 +1198,9 @@ type RecordCompute struct {
//todo //todo
_ uint64 `json:"nodeId"` _ uint64 `json:"nodeId"`
// Folder ID
FolderID uint64 `json:"folder_id"`
} }
type LoaderMetaIso struct { type LoaderMetaIso struct {
@@ -1479,8 +1491,11 @@ type RecordCloneAbort struct {
// Disk ID // Disk ID
DiskID uint64 `json:"disk_id"` DiskID uint64 `json:"disk_id"`
// Abort status // Aborted
Status bool `json:"status"` Aborted bool `json:"aborted"`
// Blockcopy abort job ID
BlockcopyAbortJobID string `json:"blockcopy_abort_job_id"`
} }
type RecordCloneStatus struct { type RecordCloneStatus struct {
@@ -1526,4 +1541,4 @@ type CheckComputePlacementItem struct {
Error CheckComputePlacementError `json:"error,omitempty"` Error CheckComputePlacementError `json:"error,omitempty"`
} }
type CheckComputePlacementResult map[string]CheckComputePlacementItem type CheckComputePlacementResult map[uint64]CheckComputePlacementItem
+3 -3
View File
@@ -39,9 +39,8 @@ type NetAttachRequest struct {
// Required: false // Required: false
MACAddr string `url:"mac_addr,omitempty" json:"mac_addr,omitempty"` MACAddr string `url:"mac_addr,omitempty" json:"mac_addr,omitempty"`
// Used only for EXTNET and DPDK // Used for EXTNET, TRUNK and DPDK
// For DPDK must be 1-9216 // Must be 1500-9216
// For EXTNET must be 1500-9216
// Required: false // Required: false
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"` MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`
@@ -75,6 +74,7 @@ type NetAttachRequest struct {
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"` SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
// Flag indicating whether security groups are enabled for this interface // Flag indicating whether security groups are enabled for this interface
// Not applicable to netType VFNIC, TRUNK, or SDN
// Required: false // Required: false
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"` EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
+1 -1
View File
@@ -23,7 +23,7 @@ type RedeployRequest struct {
OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"` OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"`
// Storage policy id of compute. The rules of the specified storage policy will be used. // Storage policy id of compute. The rules of the specified storage policy will be used.
// Required: true // Required: false
StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"` StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"`
// New size for the boot disk in GB, if boot disk size change is required // New size for the boot disk in GB, if boot disk size change is required
+3 -1
View File
@@ -16,8 +16,10 @@ type SnapshotCreateRequest struct {
// Text label for snapshot. // Text label for snapshot.
// Must be unique among this compute snapshots // Must be unique among this compute snapshots
// Allowed characters: a-z, 0-9, spaces, punctuation except '<' and '>'
// Maximum length: 36 characters
// Required: true // Required: true
Label string `url:"label" json:"label" validate:"required"` Label string `url:"label" json:"label" validate:"required,max=36,excludesall=<>"`
} }
// SnapshotCreate creates compute snapshot // SnapshotCreate creates compute snapshot
+2 -1
View File
@@ -3,8 +3,9 @@ package disks
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// DepresentRequest struct to depresent disk from node // DepresentRequest struct to depresent disk from node
+6
View File
@@ -131,6 +131,9 @@ type InfoDisk struct {
// Present to // Present to
PresentTo map[string]uint64 `json:"presentTo"` PresentTo map[string]uint64 `json:"presentTo"`
// Provision
Provision string `json:"provision"`
// Purge attempts // Purge attempts
PurgeAttempts uint64 `json:"purgeAttempts"` PurgeAttempts uint64 `json:"purgeAttempts"`
@@ -242,6 +245,9 @@ type RecordDisk struct {
// Main information about disk // Main information about disk
InfoDisk InfoDisk
// Independent
Independent bool `json:"independent"`
//Updated by //Updated by
UpdatedBy string `json:"updatedBy"` UpdatedBy string `json:"updatedBy"`
+2 -1
View File
@@ -3,8 +3,9 @@ package disks
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// PresentRequest struct to present disk to node // PresentRequest struct to present disk to node
+5
View File
@@ -37,6 +37,11 @@ type CreateRequest struct {
// List of resource groups IDs to which DPDK network will be available. Empty field means all resource groups in the system. // List of resource groups IDs to which DPDK network will be available. Empty field means all resource groups in the system.
// Required: false // Required: false
RGAccess []uint64 `url:"rgAccess,omitempty" json:"rgAccess,omitempty"` RGAccess []uint64 `url:"rgAccess,omitempty" json:"rgAccess,omitempty"`
// Enable security groups for DPDK network
// Required: false
// Default: false
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
} }
// Create creates a DPDK networks // Create creates a DPDK networks
+5
View File
@@ -104,6 +104,11 @@ type CreateRequest struct {
// Required: false // Required: false
// Default: false // Default: false
HAMode bool `url:"highlyAvailable,omitempty" json:"highlyAvailable,omitempty"` HAMode bool `url:"highlyAvailable,omitempty" json:"highlyAvailable,omitempty"`
// Enable security groups for external network
// Required: false
// Default: false
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
} }
type wrapperCreateRequest struct { type wrapperCreateRequest struct {
-46
View File
@@ -1,46 +0,0 @@
package grid
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// AddRequest struct for location code
type AddRequest struct {
// Grid (platform) ID
// Required: true
GID uint64 `url:"gid" json:"gid" validate:"required"`
// Name of the location
// Required: true
Name string `url:"name" json:"name" validate:"required"`
// Location code typicly used in dns names
// Required: true
LocationCode string `url:"locationcode" json:"locationcode" validate:"required"`
}
// Add location code (e.g. DNS name of this grid)
func (g Grid) Add(ctx context.Context, req AddRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/grid/add"
res, err := g.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
View File
@@ -96,6 +96,12 @@ type RecordGrid struct {
// SDN support // SDN support
SDNSupport bool `json:"sdn_support"` SDNSupport bool `json:"sdn_support"`
// Is BRO enabled
BROEnabled bool `json:"bro_enabled"`
// Whether VM folders are enabled
VMFoldersEnabled bool `json:"vm_folders_enabled"`
} }
// Information about grid // Information about grid
@@ -129,6 +135,15 @@ type ItemGridList struct {
// SDN support // SDN support
SDNSupport bool `json:"sdn_support"` SDNSupport bool `json:"sdn_support"`
// Is Zero Access enabled
ZeroAccessEnabled bool `json:"zeroaccess_enabled"`
// Is BRO enabled
BROEnabled bool `json:"bro_enabled"`
// Whether VM folders are enabled
VMFoldersEnabled bool `json:"vm_folders_enabled"`
} }
// List Grids // List Grids
@@ -3,8 +3,9 @@ package grid
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// SetCPUAllocationParameterRequest for setting CPU allocation parameter // SetCPUAllocationParameterRequest for setting CPU allocation parameter
@@ -3,8 +3,9 @@ package grid
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// SetCPUAllocationRatioForVMRequest for setting CPU allocation ratio for computes // SetCPUAllocationRatioForVMRequest for setting CPU allocation ratio for computes
@@ -0,0 +1,47 @@
package image
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// CreateMultiImageRequest struct to create multi image
type CreateMultiImageRequest struct {
// Name of the multi image
// Required: true
Name string `url:"name" json:"name" validate:"required"`
// IDs of real images
// Required: true
TargetIDs []uint64 `url:"target_ids" json:"target_ids" validate:"required"`
// Account ID
// Required: false
AccountID uint64 `url:"account_id,omitempty" json:"account_id,omitempty"`
}
// CreateMultiImage creates multi image
func (i Image) CreateMultiImage(ctx context.Context, req CreateMultiImageRequest) (uint64, error) {
err := validators.ValidateRequest(req)
if err != nil {
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/image/create_multi_image"
res, err := i.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return 0, err
}
result, err := strconv.ParseUint(string(res), 10, 64)
if err != nil {
return 0, err
}
return result, nil
}
+2 -2
View File
@@ -39,11 +39,11 @@ type EditRequest struct {
// Does this machine supports hot resize // Does this machine supports hot resize
// Required: false // Required: false
HotResize bool `url:"hotresize,omitempty" json:"hotresize,omitempty"` HotResize interface{} `url:"hotresize,omitempty" json:"hotresize,omitempty" validate:"omitempty,isBool"`
// Does this image boot OS // Does this image boot OS
// Required: false // Required: false
Bootable bool `url:"bootable,omitempty" json:"bootable,omitempty"` Bootable interface{} `url:"bootable,omitempty" json:"bootable,omitempty" validate:"omitempty,isBool"`
} }
// Edit edits an existing image // Edit edits an existing image
+12
View File
@@ -53,12 +53,18 @@ type RecordImage struct {
// ID // ID
ID uint64 `json:"id"` ID uint64 `json:"id"`
// Independent
Independent bool `json:"independent"`
// Last modified // Last modified
LastModified uint64 `json:"lastModified"` LastModified uint64 `json:"lastModified"`
// Link to // Link to
LinkTo uint64 `json:"linkTo"` LinkTo uint64 `json:"linkTo"`
// Links to
LinksTo []uint64 `json:"linksTo"`
// Milestones // Milestones
Milestones uint64 `json:"milestones"` Milestones uint64 `json:"milestones"`
@@ -185,12 +191,18 @@ type ItemImage struct {
// ID // ID
ID uint64 `json:"id"` ID uint64 `json:"id"`
// Independent
Independent bool `json:"independent"`
// Last modified // Last modified
LastModified uint64 `json:"lastModified"` LastModified uint64 `json:"lastModified"`
// Link to // Link to
LinkTo uint64 `json:"linkTo"` LinkTo uint64 `json:"linkTo"`
// Links to
LinksTo []uint64 `json:"linksTo"`
// Milestones // Milestones
Milestones uint64 `json:"milestones"` Milestones uint64 `json:"milestones"`
@@ -0,0 +1,43 @@
package image
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// MultiImageAddLinksRequest struct to add links to multi image
type MultiImageAddLinksRequest struct {
// ID of the multi image
// Required: true
ImageID uint64 `url:"image_id" json:"image_id" validate:"required"`
// IDs of real images
// Required: true
TargetIDs []uint64 `url:"target_ids" json:"target_ids" validate:"required"`
}
// MultiImageAddLinks adds image links to multi image
func (i Image) MultiImageAddLinks(ctx context.Context, req MultiImageAddLinksRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/image/multi_image_add_links"
res, err := i.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
@@ -0,0 +1,43 @@
package image
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// MultiImageDelLinksRequest struct to delete links from multi image
type MultiImageDelLinksRequest struct {
// ID of the multi image
// Required: true
ImageID uint64 `url:"image_id" json:"image_id" validate:"required"`
// IDs of real images
// Required: true
TargetIDs []uint64 `url:"target_ids" json:"target_ids" validate:"required"`
}
// MultiImageDelLinks removes image links from multi image
func (i Image) MultiImageDelLinks(ctx context.Context, req MultiImageDelLinksRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/image/multi_image_del_links"
res, err := i.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
@@ -0,0 +1,46 @@
package image
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// MultiImageExportRequest struct to export multi image to a pool
type MultiImageExportRequest struct {
// ID of the multi image
// Required: true
MultiImageID uint64 `url:"multi_image_id" json:"multi_image_id" validate:"required"`
// Name of the target pool
// Required: true
PoolName string `url:"pool_name" json:"pool_name" validate:"required"`
// Target SEP ID
// Required: true
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
}
// MultiImageExport copies a physical image from multi image to the specified pool
func (i Image) MultiImageExport(ctx context.Context, req MultiImageExportRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/image/multi_image_export"
res, err := i.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
}
+3 -2
View File
@@ -28,8 +28,8 @@ type Interface struct {
// Required: false // Required: false
IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"` IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"`
// Maximum transmission unit, must be 1-9216 // Used for EXTNET, TRUNK and DPDK
// Used only to DPDK net type // Must be 1500-9216
// Required: false // Required: false
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"` MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`
@@ -51,6 +51,7 @@ type Interface struct {
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"` SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
// Flag indicating whether security groups are enabled for this interface // Flag indicating whether security groups are enabled for this interface
// Not applicable to netType VFNIC, TRUNK, or SDN
// Required: false // Required: false
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"` EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
+3 -2
View File
@@ -27,8 +27,8 @@ type InterfaceMassCreate struct {
// Required: false // Required: false
IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"` IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"`
// Maximum transmission unit, must be 1-9216 // Used for EXTNET, TRUNK and DPDK
// Used only to DPDK net type // Must be 1500-9216
// Required: false // Required: false
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"` MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`
@@ -45,6 +45,7 @@ type InterfaceMassCreate struct {
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"` SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
// Flag indicating whether security groups are enabled for this interface // Flag indicating whether security groups are enabled for this interface
// Not applicable to netType VFNIC, TRUNK, or SDN
// Required: false // Required: false
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"` EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
+4 -4
View File
@@ -18,9 +18,9 @@ type EnableRequest struct {
Message string `url:"message,omitempty" json:"message,omitempty"` Message string `url:"message,omitempty" json:"message,omitempty"`
// Do not check locks, iscsi-sessions or disk-present // Do not check locks, iscsi-sessions or disk-present
// Default: true // Default: false
// Required: false // Required: false
Force interface{} `url:"force" json:"force" validate:"isBool" ` Force interface{} `url:"force" json:"force" validate:"isBool"`
// Reason // Reason
// Required: false // Required: false
@@ -41,7 +41,7 @@ func (n Node) Enable(ctx context.Context, req EnableRequest) (string, error) {
} }
if req.Force == nil { if req.Force == nil {
req.Force = true req.Force = false
} }
reqWrapped := wrapperEnableRequest{ reqWrapped := wrapperEnableRequest{
@@ -67,7 +67,7 @@ func (n Node) EnableAsync(ctx context.Context, req EnableRequest) (string, error
} }
if req.Force == nil { if req.Force == nil {
req.Force = true req.Force = false
} }
reqWrapped := wrapperEnableRequest{ reqWrapped := wrapperEnableRequest{
@@ -13,6 +13,10 @@ type GetLogicalCoresCountRequest struct {
// Node ID // Node ID
// Required: true // Required: true
NodeId uint64 `url:"node_id" json:"node_id" validate:"required"` NodeId uint64 `url:"node_id" json:"node_id" validate:"required"`
// Target
// Required: false
Target string `url:"target,omitempty" json:"target,omitempty" validate:"omitempty,oneof=core node"`
} }
// GetLogicalCoresCount get logical cores count by node // GetLogicalCoresCount get logical cores count by node
@@ -24,7 +28,7 @@ func (i Node) GetLogicalCoresCount(ctx context.Context, req GetLogicalCoresCount
url := "/cloudbroker/node/get_logical_cores_count" url := "/cloudbroker/node/get_logical_cores_count"
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req) res, err := i.client.DecortApiCall(ctx, http.MethodGet, url, req)
if err != nil { if err != nil {
return 0, err return 0, err
} }
+4 -1
View File
@@ -120,7 +120,7 @@ type FreeResourcesInfo struct {
RAM float64 `json:"RAM"` RAM float64 `json:"RAM"`
// VCPU // VCPU
VCPU uint64 `json:"vCPUs"` VCPU float64 `json:"vCPUs"`
} }
// Resources Info // Resources Info
@@ -155,6 +155,9 @@ type CpuInfo struct {
// PhysCount // PhysCount
PhysCount uint64 `json:"physCount"` PhysCount uint64 `json:"physCount"`
// Thread count
ThreadCount uint64 `json:"threadCount"`
// Flags // Flags
Flags []string `json:"flags"` Flags []string `json:"flags"`
+2 -1
View File
@@ -3,8 +3,9 @@ package pcidevice
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// DeleteRequest struct to deleting PCI device // DeleteRequest struct to deleting PCI device
+2 -1
View File
@@ -3,8 +3,9 @@ package pcidevice
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// DisableRequest struct for disabling PCI device // DisableRequest struct for disabling PCI device
+2 -1
View File
@@ -3,8 +3,9 @@ package pcidevice
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// EnableRequest struct for enabling PCI device // EnableRequest struct for enabling PCI device
+1
View File
@@ -2,6 +2,7 @@ package pcidevice
import ( import (
"encoding/json" "encoding/json"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/serialization" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/serialization"
) )
+1 -1
View File
@@ -66,7 +66,7 @@ type ItemResourceConsumption struct {
ResourceLimits ResourceLimits `json:"resourceLimits"` ResourceLimits ResourceLimits `json:"resourceLimits"`
// Resource group ID // Resource group ID
RGID uint64 `json:"rgid"` RGID uint64 `json:"id"`
} }
type ListResourceConsumption struct { type ListResourceConsumption struct {
@@ -3,8 +3,9 @@ package rg
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter // SetCPUAllocationParameterRequest struct for setting CPU allocation parameter
@@ -3,8 +3,9 @@ package rg
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// SetCPUAllocationRatioRequest struct for setting CPU allocation ratio // SetCPUAllocationRatioRequest struct for setting CPU allocation ratio
+4
View File
@@ -51,6 +51,10 @@ type UpdateRequest struct {
// Storage policies // Storage policies
// Required: false // Required: false
StoragePolicies []StoragePolicy `url:"-" json:"storage_policies,omitempty"` StoragePolicies []StoragePolicy `url:"-" json:"storage_policies,omitempty"`
// CPU allocation parameter
// Required: false
CPUAllocationParameter string `url:"cpu_allocation_parameter,omitempty" json:"cpu_allocation_parameter,omitempty"`
} }
// Update updates resource group // Update updates resource group
+8 -7
View File
@@ -2,8 +2,8 @@ package sep
import ( import (
"context" "context"
"encoding/json"
"net/http" "net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
@@ -20,23 +20,24 @@ 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) (uint64, error) { func (s SEP) AddConsumerNodes(ctx context.Context, req AddConsumerNodesRequest) ([]uint64, error) {
err := validators.ValidateRequest(req) err := validators.ValidateRequest(req)
list := []uint64{}
if err != nil { if err != nil {
return 0, validators.ValidationErrors(validators.GetErrors(err)) return list, 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 0, err return list, err
} }
result, err := strconv.ParseUint(string(res), 10, 64) err = json.Unmarshal(res, &list)
if err != nil { if err != nil {
return 0, err return nil, err
} }
return result, nil return list, nil
} }
+45 -9
View File
@@ -3,6 +3,8 @@ package sep
import ( import (
"context" "context"
"net/http" "net/http"
"strconv"
"strings"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
@@ -13,32 +15,66 @@ type AddPoolRequest struct {
// Required: true // Required: true
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"` SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
// Method Async/Sync
// Default: true
// Required: false
Sync bool `url:"sync" json:"sync"`
// Pool structure which contains fields such as "name", "usage_limit", "types", "system", "accessAccountIds", "accessResGroupIds". Added fields for other pool types: Des, Ovs - "uris" list of "ip, port". // Pool structure which contains fields such as "name", "usage_limit", "types", "system", "accessAccountIds", "accessResGroupIds". Added fields for other pool types: Des, Ovs - "uris" list of "ip, port".
// Dorado, Tatlin no additional fields required. Hitachi - "id", "snapshotable", "snapshot_pool_id", "minLdevId", "maxLdevId", "clone_technology". Shared - "description", "wwns", "allocate_type", "stripes", "metadata_size", "metadatatalun". Local - "description", "node_consumer", "block_disk". // Dorado, Tatlin no additional fields required. Hitachi - "id", "snapshotable", "snapshot_pool_id", "minLdevId", "maxLdevId", "clone_technology". Shared - "description", "wwns", "allocate_type", "stripes", "metadata_size", "metadatatalun". Local - "description", "node_consumer", "block_disk".
// Required: true // Required: true
Pool string `url:"pool" json:"pool" validate:"required"` Pool string `url:"pool" json:"pool" validate:"required"`
} }
// AddPool adds pool to SEP type wrapperAddPoolRequest struct {
func (s SEP) AddPool(ctx context.Context, req AddPoolRequest) (string, error) { AddPoolRequest
AsyncMode bool `url:"asyncMode"`
}
// AddPool adds pool to SEP in sync mode.
// It returns result of operation and error.
func (s SEP) AddPool(ctx context.Context, req AddPoolRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
reqWrapped := wrapperAddPoolRequest{
AddPoolRequest: req,
AsyncMode: false,
}
url := "/cloudbroker/sep/addPool"
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
// AddPoolAsync adds pool to SEP in async mode.
// It returns guid of task and error.
func (s SEP) AddPoolAsync(ctx context.Context, req AddPoolRequest) (string, error) {
err := validators.ValidateRequest(req) err := validators.ValidateRequest(req)
if err != nil { if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err)) return "", validators.ValidationErrors(validators.GetErrors(err))
} }
reqWrapped := wrapperAddPoolRequest{
AddPoolRequest: req,
AsyncMode: true,
}
url := "/cloudbroker/sep/addPool" url := "/cloudbroker/sep/addPool"
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req) res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil { if err != nil {
return "", err return "", err
} }
result := string(res) result := strings.ReplaceAll(string(res), "\"", "")
return result, nil return result, nil
} }
+9 -7
View File
@@ -2,8 +2,8 @@ package sep
import ( import (
"context" "context"
"encoding/json"
"net/http" "net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
@@ -34,23 +34,25 @@ type ConfigFieldEditRequest struct {
} }
// ConfigFieldEdit edits SEP config field value // ConfigFieldEdit edits SEP config field value
func (s SEP) ConfigFieldEdit(ctx context.Context, req ConfigFieldEditRequest) (bool, error) { func (s SEP) ConfigFieldEdit(ctx context.Context, req ConfigFieldEditRequest) (*RecordConfigFieldEdit, error) {
err := validators.ValidateRequest(req) err := validators.ValidateRequest(req)
if err != nil { if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err)) return nil, validators.ValidationErrors(validators.GetErrors(err))
} }
url := "/cloudbroker/sep/configFieldEdit" url := "/cloudbroker/sep/configFieldEdit"
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 nil, err
} }
result, err := strconv.ParseBool(string(res)) info := RecordConfigFieldEdit{}
err = json.Unmarshal(res, &info)
if err != nil { if err != nil {
return false, err return nil, err
} }
return result, nil return &info, nil
} }
+8 -6
View File
@@ -2,8 +2,8 @@ package sep
import ( import (
"context" "context"
"encoding/json"
"net/http" "net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
@@ -25,22 +25,24 @@ type DelConsumerNodesRequest struct {
} }
// DelConsumerNodes excludes consumer nodes from SEP parameters // DelConsumerNodes excludes consumer nodes from SEP parameters
func (s SEP) DelConsumerNodes(ctx context.Context, req DelConsumerNodesRequest) (bool, error) { func (s SEP) DelConsumerNodes(ctx context.Context, req DelConsumerNodesRequest) (interface{}, error) {
err := validators.ValidateRequest(req) err := validators.ValidateRequest(req)
if err != nil { if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err)) return nil, validators.ValidationErrors(validators.GetErrors(err))
} }
url := "/cloudbroker/sep/delConsumerNodes" url := "/cloudbroker/sep/delConsumerNodes"
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 nil, err
} }
result, err := strconv.ParseBool(string(res)) var result interface{}
err = json.Unmarshal(res, &result)
if err != nil { if err != nil {
return false, err return nil, err
} }
return result, nil return result, nil
+92
View File
@@ -1,5 +1,7 @@
package sep package sep
import "encoding/json"
// Total resource information // Total resource information
type Total struct { type Total struct {
// Capacity limit // Capacity limit
@@ -185,3 +187,93 @@ type ListAvailableSEP struct {
// Data // Data
Data []SEPData `json:"data"` Data []SEPData `json:"data"`
} }
// Disk clean settings
type DiskCleanSettings struct {
// Block size
BlockSize string `json:"blocksize"`
// Write bytes per second
WBPS uint64 `json:"wbps"`
// Write I/O operations per second
WIOPS uint64 `json:"wiops"`
}
// Pool configuration
type PoolConfig struct {
// Disk clean
DiskClean *string `json:"disk_clean"`
// Disk clean settings
DiskCleanSettings DiskCleanSettings `json:"disk_clean_settings"`
// Pool name
Name string `json:"name"`
// Usage limit
UsageLimit uint64 `json:"usage_limit"`
// Additional properties
AdditionalProperties map[string]interface{} `json:"-"`
}
func (p *PoolConfig) UnmarshalJSON(data []byte) error {
type tmpAlias PoolConfig
if err := json.Unmarshal(data, (*tmpAlias)(p)); err != nil {
return err
}
all := make(map[string]interface{})
if err := json.Unmarshal(data, &all); err != nil {
return err
}
delete(all, "disk_clean")
delete(all, "disk_clean_settings")
delete(all, "name")
delete(all, "usage_limit")
if len(all) > 0 {
p.AdditionalProperties = all
}
return nil
}
// Sep configuration information
type RecordConfigFieldEdit struct {
// Format
Format string `json:"format"`
// Pools
Pools []PoolConfig `json:"pools"`
// Protocol
Protocol string `json:"protocol"`
// Additional properties
AdditionalProperties map[string]interface{} `json:"-"`
}
func (r *RecordConfigFieldEdit) UnmarshalJSON(data []byte) error {
type tmpAlias RecordConfigFieldEdit
if err := json.Unmarshal(data, (*tmpAlias)(r)); err != nil {
return err
}
all := make(map[string]interface{})
if err := json.Unmarshal(data, &all); err != nil {
return err
}
delete(all, "format")
delete(all, "pools")
delete(all, "protocol")
if len(all) > 0 {
r.AdditionalProperties = all
}
return nil
}
+7 -13
View File
@@ -38,7 +38,7 @@ type UpdateRequest struct {
type wrapperUpdateRequest struct { type wrapperUpdateRequest struct {
UpdateRequest UpdateRequest
Config []string `url:"config,omitempty"` Config string `url:"config,omitempty"`
} }
// Update updates vfpool device // Update updates vfpool device
@@ -48,21 +48,15 @@ func (v VFPool) Update(ctx context.Context, req UpdateRequest) (bool, error) {
return false, validators.ValidationErrors(validators.GetErrors(err)) return false, validators.ValidationErrors(validators.GetErrors(err))
} }
var config []string var config string
if len(req.Config) != 0 { if len(req.Config) != 0 {
config = make([]string, 0, len(req.Config)) b, err := json.Marshal(req.Config)
if err != nil {
for c := range req.Config { return false, err
b, err := json.Marshal(req.Config[c])
if err != nil {
return false, err
}
config = append(config, string(b))
} }
} else {
config = []string{} config = string(b)
} }
reqWrapped := wrapperUpdateRequest{ reqWrapped := wrapperUpdateRequest{
+2 -1
View File
@@ -3,8 +3,9 @@ package vgpu
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// AllocateRequest struct for allocating VGPU // AllocateRequest struct for allocating VGPU
+2 -1
View File
@@ -3,8 +3,9 @@ package vgpu
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// CreateRequest struct for creating VGPU // CreateRequest struct for creating VGPU
+2 -1
View File
@@ -3,8 +3,9 @@ package vgpu
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// DeallocateRequest struct for deallocating VGPU // DeallocateRequest struct for deallocating VGPU
+2 -1
View File
@@ -3,8 +3,9 @@ package vgpu
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// DestroyRequest struct for destroying VGPU // DestroyRequest struct for destroying VGPU
@@ -57,6 +57,11 @@ type CreateInAccountRequest 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"`
// Enable security groups for VINS
// Required: false
// Default: false
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
} }
type wrapperCreateRequestInAcc struct { type wrapperCreateRequestInAcc struct {
+5
View File
@@ -51,6 +51,11 @@ type CreateInRGRequest 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"`
// Enable security groups for VINS
// Required: false
// Default: false
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
} }
type wrapperCreateRequestInRG struct { type wrapperCreateRequestInRG struct {
Loaded 100 of 153 files, more files were not shown because too many files have changed in this diff. Show more