Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf93cd2d6d | ||
|
|
f34fa6055c | ||
|
|
1bf30e8778 |
No files matched your search
+29
-42
@@ -1,4 +1,4 @@
|
|||||||
## Version 15.5.0
|
## Version 15.8.0
|
||||||
|
|
||||||
Методы `Audits` в cloudapi/compute, cloudbroker/compute, cloudapi/account, cloudbroker/account, cloudapi/vins, cloudbroker/vins, cloudapi/rg и cloudbroker/rg стали deprecated и будут удалены в версии 16.0, вместо них необходимо использовать метод `List` в cloudapi/audit и cloudbroker/audit с соответствующими фильтрами
|
Методы `Audits` в cloudapi/compute, cloudbroker/compute, cloudapi/account, cloudbroker/account, cloudapi/vins, cloudbroker/vins, cloudapi/rg и cloudbroker/rg стали deprecated и будут удалены в версии 16.0, вместо них необходимо использовать метод `List` в cloudapi/audit и cloudbroker/audit с соответствующими фильтрами
|
||||||
Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke`, `AccessRevokeToPool` в cloudbroker/sep стали deprecated и будут удалены в версии 16.0
|
Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke`, `AccessRevokeToPool` в cloudbroker/sep стали deprecated и будут удалены в версии 16.0
|
||||||
@@ -11,69 +11,56 @@
|
|||||||
Методы `ExecuteMaintenanceScript`, `ListEmails`, `ServicesRestart` в cloudbroker/grid стали deprecated и будут удалены в версии 16.0
|
Методы `ExecuteMaintenanceScript`, `ListEmails`, `ServicesRestart` в cloudbroker/grid стали deprecated и будут удалены в версии 16.0
|
||||||
Метод `Get` в cloudbroker/group стал deprecated и будет удален в версии 16.0
|
Метод `Get` в cloudbroker/group стал deprecated и будет удален в версии 16.0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Добавлено
|
### Добавлено
|
||||||
|
|
||||||
#### compute
|
#### apiaccess
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-954 | Вычисляемое поле `ResizedOnline` в структуры ответа `RecordCompute` и `ItemCompute` в cloudapi/compute и cloudbroker/compute |
|
| BGOS-1056 | Опциональное поле `SDN` в структуру `APIsEndpoints` в cloudbroker/apiaccess |
|
||||||
|
| BGOS-1056 | Опциональные поля `Audit`, `DPDKNet`, `SecurityGroup`, `SEP`, `StoragePolicy`, `Trunk`, `VFPool` и `Zone` в структуру `CloudAPIEndpoints` в cloudbroker/apiaccess |
|
||||||
#### resmon
|
| BGOS-1056 | Опциональные поля `Backup`, `DPDKNet`, `ResourceOptimizer`, `SecurityGroup`, `StoragePolicy`, `Trunk`, `VFPool` и `Zone` в структуру `CloudBrokerEndpoints` в cloudbroker/apiaccess |
|
||||||
| Идентификатор задачи | Описание |
|
| BGOS-1056 | Опциональные поля `Cache` и `InfoWellknown` в структуру `SystemEndpoints` в cloudbroker/apiaccess |
|
||||||
| --- | --- |
|
|
||||||
| BGOS-947 | Вычисляемое поле `UID` в структуру ответа `GetByNodePoint` в cloudbroker/resmon |
|
|
||||||
| BGOS-947 | Вычисляемые поля `ThreadCount`, `ModelName`, `Flags` и `MaxSupportedGeneration` в структуру ответа `CPUinfoByNode` в cloudbroker/resmon |
|
|
||||||
| BGOS-947 | Вычисляемые поля `UsedGiB` и `TotalGiB` в структуру ответа `ItemStorage` в cloudbroker/resmon |
|
|
||||||
|
|
||||||
#### SDN logicalports
|
|
||||||
| Идентификатор задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| BGOS-951 | Вычисляемое поле `ExcludeFirewall` в структуру ответа `LogicalPort` в sdn/logicalports |
|
|
||||||
|
|
||||||
### Изменено
|
|
||||||
|
|
||||||
#### compute
|
#### compute
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-958 | Тип возвращаемого значения с `string` на `RecordMigrateStorageInfo` в методе `MigrateStorageInfo` в cloudbroker/compute |
|
| BGOS-1037 | Опциональные поля `FolderID` и `IncludeDescendants` в структуру запроса `ListRequest` в cloudapi/compute |
|
||||||
|
| BGOS-1037 | Опциональные поля `FolderID` и `IncludeDescendants` в структуру запроса `ListRequest` в cloudbroker/compute |
|
||||||
|
| BGOS-1070 | Вычисляемое поле `FolderID` в структуры ответа `RecordCompute` и `ItemCompute` в cloudapi/compute |
|
||||||
|
| BGOS-1070 | Вычисляемое поле `FolderID` в структуры ответа `RecordCompute` и `InfoCompute` в cloudapi/compute |
|
||||||
|
|
||||||
#### resmon
|
#### grid
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-947 | Тип вычисляемых полей `CPUTime` и `RAMConsumedReal` с `uint64` на `float64` в структуре ответа `ComputeUsage` в cloudbroker/resmon |
|
| BGOS-1075 | Вычисляемое поле `VMFoldersEnabled` в структуры ответа `RecordGrid` и `ItemGridList` в cloudbroker/grid |
|
||||||
| BGOS-947 | Тип вычисляемого поля `IsUp` с `uint64` на `bool` в структуре ответа `ComputeUsage` в cloudbroker/resmon |
|
|
||||||
| BGOS-947 | Тип вычисляемого поля `SizeMax` с `float64` на `uint64` в структуре ответа `ItemDisk` в cloudbroker/resmon |
|
|
||||||
| BGOS-947 | Тип вычисляемых полей `CPUPower`, `CPUUtil`, `TotalMem`, `ReservedMem`, `UsedMem` и `FreeMem` с `uint64` на `float64` в структуре ответа `ItemTotalByGRID` в cloudbroker/resmon |
|
|
||||||
| BGOS-947 | Тип вычисляемых полей `PCPU` и `CPUUtil` с `uint64` на `float64` в структуре ответа `NodeUsage` в cloudbroker/resmon |
|
|
||||||
|
|
||||||
#### SDN hypervisors
|
#### locations
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-956 | Тип возвращаемого значения в методе `Delete` c `bool` на `RecordVersion` в sdn/hypervisors |
|
| BGOS-1035 | Вычисляемое поле `VMFoldersEnabled` в структуру ответа `ItemLocation` в cloudapi/locations |
|
||||||
|
|
||||||
#### SDN logicalports
|
#### vmfolder
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-951 | Тип опционального поля `LogicalPortAddresses` в структуре запроса `CreateRequest` с `[]LogicalPortAddress` на `[]LogicalPortAddressRequest` в sdn/logicalports |
|
| BGOS-1050 | Группа api методов vmfolder в cloudapi и cloudbroker |
|
||||||
| BGOS-951 | Тип обязательного поля `IP` в структуре запроса `LogicalPortAddressRequest` с `string` на `interface{}` в sdn/logicalports |
|
|
||||||
| BGOS-951 | Тип обязательного поля `IsDiscovered` в структуре запроса `UpdateAddress` и `AddAddress` с `bool` на `interface{}` в sdn/logicalports |
|
|
||||||
| BGOS-951 | Тип опционального поля `Labels` в структуре запроса `CreateRequest` с `CreateLabels` на `*CreateLabels` в sdn/logicalports |
|
|
||||||
| BGOS-951 | Тип опционального поля `Labels` в структуре запроса `UpdateRequest` с `UpdateLabels` на `*UpdateLabels` в sdn/logicalports |
|
|
||||||
|
|
||||||
#### SDN netobjgroups
|
|
||||||
| Идентификатор задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| BGOS-957 | Тип вычисляемого поля `ExternalNetworkPorts` с массива на объект в sdn/netobjgroups |
|
|
||||||
|
|
||||||
### Удалено
|
### Удалено
|
||||||
|
|
||||||
#### resmon
|
#### apiaccess
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-947 | Вычисляемые поля `NodesCPU`, `StorageCapacity` и `VCPUConsumed` из структуры ответа `ItemTotalByGRID` в cloudbroker/resmon |
|
| BGOS-1056 | Опциональное поле `LibCloud` из структуры `APIsEndpoints` в cloudbroker/apiaccess |
|
||||||
| BGOS-947 | Вычисляемые поля `CapacityLimit`, `Consumed`, `Type` и `UID` из структуры ответа `ItemStorage` в cloudbroker/resmon |
|
| BGOS-1056 | Опциональные поля `CloudSpace`, `ComputeCI`, `DPDK`, `Machine`, `Openshift`, `OpenshiftCI`, `PortForwarding` и `Sizes` из структуры `CloudAPIEndpoints` в cloudbroker/apiaccess |
|
||||||
|
| BGOS-1056 | Опциональные поля `CloudSpace`, `ComputeCI`, `Desnode`, `Diagnostics`, `DPDK`, `IaaS`, `Machine`, `Openshift`, `OpenshiftCI`, `Ovsnode` и `QOS` из структуры `CloudBrokerEndpoints` в cloudbroker/apiaccess |
|
||||||
|
| BGOS-1056 | Опциональные поля `AgentController`, `Alerts`, `ErrorConditionHandler`, `Job`, `Log` и `Logo` из структуры `SystemEndpoints` в cloudbroker/apiaccess |
|
||||||
|
|
||||||
#### SDN netobjgroups
|
### Исправлено
|
||||||
|
|
||||||
|
#### apiaccess
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-957 | Вычисляемые поля `Comment`, `Enabled`, `IPv4` и `MAC` в структуре `ExternalNetworkPorts` в структуре ответа `RecordNetObjGroup` в sdn/netobjgroups |
|
| BGOS-1056 | Ошибка при вызове метода `Update` в cloudbroker/apiaccess |
|
||||||
|
| BGOS-1056 | Исправлен тип ответа методов `Update` и `DescUpdate` в cloudbroker/apiaccess |
|
||||||
|
|
||||||
@@ -124,6 +124,7 @@ go get -u repository.basistech.ru/BASIS/dynamix-golang-sdk/v15
|
|||||||
- `Trunk` - получение информации о транковых портах;
|
- `Trunk` - получение информации о транковых портах;
|
||||||
- `VFPool` - управление пулом виртуальных сетевых функций;
|
- `VFPool` - управление пулом виртуальных сетевых функций;
|
||||||
- `VINS` - управление виртуальными изолированными сетями;
|
- `VINS` - управление виртуальными изолированными сетями;
|
||||||
|
- `VMFolder` – управление директориями ВМ;
|
||||||
- `VGPU` - управление виртуальными графическими процессорами;
|
- `VGPU` - управление виртуальными графическими процессорами;
|
||||||
- `Zone` - управление зонами.
|
- `Zone` - управление зонами.
|
||||||
|
|
||||||
@@ -162,7 +163,8 @@ go get -u repository.basistech.ru/BASIS/dynamix-golang-sdk/v15
|
|||||||
- `User` - управление пользователями (индивидуально);
|
- `User` - управление пользователями (индивидуально);
|
||||||
- `VGPU` - управление виртуальными графическими процессорами;
|
- `VGPU` - управление виртуальными графическими процессорами;
|
||||||
- `VFPool` - управление пулом виртуальных сетевых функций;
|
- `VFPool` - управление пулом виртуальных сетевых функций;
|
||||||
- `VINS` - управление виртуальными изолированными сетями.
|
- `VINS` - управление виртуальными изолированными сетями;
|
||||||
|
- `VMFolder` – управление директориями ВМ;
|
||||||
- `Zone` - управление зонами.
|
- `Zone` - управление зонами.
|
||||||
|
|
||||||
### SDN
|
### SDN
|
||||||
@@ -338,6 +340,7 @@ func main() {
|
|||||||
- `pkg/cloudapi/vfpool` - для `VFPool`
|
- `pkg/cloudapi/vfpool` - для `VFPool`
|
||||||
- `pkg/cloudapi/vins` - для `VINS`
|
- `pkg/cloudapi/vins` - для `VINS`
|
||||||
- `pkg/cloudapi/vgpu` - для `VGPU`
|
- `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`
|
||||||
@@ -371,8 +374,9 @@ 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`
|
||||||
@@ -537,6 +541,7 @@ func main() {
|
|||||||
- `.VFPool()` - для работы с `VFPool`
|
- `.VFPool()` - для работы с `VFPool`
|
||||||
- `.VINS()` - для работы с `VINS`
|
- `.VINS()` - для работы с `VINS`
|
||||||
- `.VGPU()` - для работы с `VGPU`
|
- `.VGPU()` - для работы с `VGPU`
|
||||||
|
- `.VMFolder()` - для работы с `VMFolder`
|
||||||
- `.Zone()` - для работы с `Zone`
|
- `.Zone()` - для работы с `Zone`
|
||||||
|
|
||||||
Доступные методы для `.CloudBroker()`:
|
Доступные методы для `.CloudBroker()`:
|
||||||
@@ -572,9 +577,10 @@ 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`
|
||||||
@@ -947,7 +953,7 @@ func main() {
|
|||||||
- ToString(): строковое представление результата выполнения задачи
|
- ToString(): строковое представление результата выполнения задачи
|
||||||
- ID() и Name(): получение ID и имени созданного в результате выполнения задачи ресурса
|
- ID() и Name(): получение ID и имени созданного в результате выполнения задачи ресурса
|
||||||
- ToMaps(): получение списка карт, содержащих информацию о дисках, восстановленных в результате выполнения задачи.
|
- ToMaps(): получение списка карт, содержащих информацию о дисках, восстановленных в результате выполнения задачи.
|
||||||
Все методы оборудованы возвратом ошибок. Непустая ошибка означает, что из поля Result нельзя получить информацию, которую предоставляет метод.
|
Все методы оборудованы возвратом ошибок. Непустая ошибка означает, что из поля Result нельзя получить информацию, которую предоставляет метод.
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package main
|
package main
|
||||||
@@ -1625,46 +1631,46 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/config"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/config"
|
||||||
decort "repository.basistech.ru/BASIS/dynamix-golang-sdk/v15"
|
decort "repository.basistech.ru/BASIS/dynamix-golang-sdk/v15"
|
||||||
)
|
)
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
cfg := config.UniversalConfig{
|
// Создание структуры запроса
|
||||||
LegacyConfig: &legacyCfg,
|
// CreateRequest - реквест на создание виртуальной машины
|
||||||
}
|
req := kvmx86.CreateRequest{
|
||||||
|
RGID: 123,
|
||||||
|
Name: "compute",
|
||||||
|
CPU: 4,
|
||||||
|
RAM: 4096,
|
||||||
|
ImageID: 321,
|
||||||
|
}
|
||||||
|
|
||||||
// Создание клиента
|
// Выполнение запроса
|
||||||
universalClient := decort.NewUniversal(cfg)
|
res, err := universalClient.CloudAPI().KVMX86().Create(context.Background(), req)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
// Создание структуры запроса
|
fmt.Println(res)
|
||||||
// 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)
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ type DecortClient struct {
|
|||||||
mutex *sync.Mutex
|
mutex *sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
// Сlient builder
|
// Client builder
|
||||||
func New(cfg config.Config) *DecortClient {
|
func New(cfg config.Config) *DecortClient {
|
||||||
if err := validators.ValidateConfig(cfg); err != nil {
|
if err := validators.ValidateConfig(cfg); err != nil {
|
||||||
panic(validators.ValidationErrors(validators.GetErrors(err)))
|
panic(validators.ValidationErrors(validators.GetErrors(err)))
|
||||||
|
|||||||
@@ -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"`
|
||||||
|
|||||||
@@ -482,9 +482,6 @@ type RecordCompute struct {
|
|||||||
// Natable VINS network name
|
// Natable VINS network name
|
||||||
NatableVINSNetworkName string `json:"natableVinsNetworkName"`
|
NatableVINSNetworkName string `json:"natableVinsNetworkName"`
|
||||||
|
|
||||||
// Node ID
|
|
||||||
NodeID uint64 `json:"node_id"`
|
|
||||||
|
|
||||||
// Name of OS
|
// Name of OS
|
||||||
OSVersion string `json:"os_version"`
|
OSVersion string `json:"os_version"`
|
||||||
|
|
||||||
@@ -572,6 +569,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 SnapRecordCompute struct {
|
type SnapRecordCompute struct {
|
||||||
@@ -722,6 +722,9 @@ type SnapRecordCompute struct {
|
|||||||
// Network interface naming
|
// Network interface naming
|
||||||
NetworkInterfaceNaming string `json:"networkInterfaceNaming"`
|
NetworkInterfaceNaming string `json:"networkInterfaceNaming"`
|
||||||
|
|
||||||
|
// Node ID
|
||||||
|
NodeID uint64 `json:"node_id"`
|
||||||
|
|
||||||
// Numa Affinity
|
// Numa Affinity
|
||||||
NumaAffinity string `json:"numaAffinity"`
|
NumaAffinity string `json:"numaAffinity"`
|
||||||
|
|
||||||
@@ -785,9 +788,6 @@ type SnapRecordCompute struct {
|
|||||||
// Resource group name
|
// Resource group name
|
||||||
RGName string `json:"rgName"`
|
RGName string `json:"rgName"`
|
||||||
|
|
||||||
// List snapsets
|
|
||||||
SnapSets ListSnapSets `json:"snapSets"`
|
|
||||||
|
|
||||||
// Stateless SepID
|
// Stateless SepID
|
||||||
StatelessSepID int64 `json:"statelessSepId"`
|
StatelessSepID int64 `json:"statelessSepId"`
|
||||||
|
|
||||||
@@ -1559,6 +1559,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
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ type ItemLocation struct {
|
|||||||
|
|
||||||
// Is BRO enabled
|
// Is BRO enabled
|
||||||
BROEnabled bool `json:"bro_enabled"`
|
BROEnabled bool `json:"bro_enabled"`
|
||||||
|
|
||||||
|
// Are VM Folders enabled
|
||||||
|
VMFoldersEnabled bool `json:"vm_folders_enabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of locations
|
// List of locations
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package cloudapi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/pkg/cloudapi/vmfolder"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Accessing the VMFolder method group
|
||||||
|
func (ca *CloudAPI) VMFolder() *vmfolder.VMFolder {
|
||||||
|
return vmfolder.New(ca.client)
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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
|
||||||
|
}
|
||||||
@@ -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"`
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,8 +2,8 @@ package apiaccess
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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
@@ -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"`
|
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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
|
||||||
}
|
}
|
||||||
@@ -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"`
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ type ListACL []ItemACL
|
|||||||
// Main information about snapshot
|
// Main information about snapshot
|
||||||
type ItemSnapshot struct {
|
type ItemSnapshot struct {
|
||||||
// Compute info
|
// Compute info
|
||||||
Compute RecordCompute `json:"compute"`
|
Compute SnapRecordCompute `json:"compute"`
|
||||||
|
|
||||||
// List of disk IDs
|
// List of disk IDs
|
||||||
Disks []uint64 `json:"disks"`
|
Disks []uint64 `json:"disks"`
|
||||||
@@ -929,6 +929,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 {
|
||||||
@@ -1237,6 +1240,273 @@ type RecordCompute struct {
|
|||||||
|
|
||||||
//todo
|
//todo
|
||||||
_ uint64 `json:"nodeId"`
|
_ uint64 `json:"nodeId"`
|
||||||
|
|
||||||
|
// Folder ID
|
||||||
|
FolderID uint64 `json:"folder_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SnapRecordCompute is RecordCompute but without the SnapSets field
|
||||||
|
type SnapRecordCompute struct {
|
||||||
|
// Account ID
|
||||||
|
AccountID uint64 `json:"accountId"`
|
||||||
|
|
||||||
|
// Account name
|
||||||
|
AccountName string `json:"accountName"`
|
||||||
|
|
||||||
|
// Access Control List
|
||||||
|
ACL []interface{} `json:"acl"`
|
||||||
|
|
||||||
|
// Affinity label
|
||||||
|
AffinityLabel string `json:"affinityLabel"`
|
||||||
|
|
||||||
|
// Affinity rules
|
||||||
|
AffinityRules ListRules `json:"affinityRules"`
|
||||||
|
|
||||||
|
// Affinity weight
|
||||||
|
AffinityWeight uint64 `json:"affinityWeight"`
|
||||||
|
|
||||||
|
// Anti affinity rules
|
||||||
|
AntiAffinityRules ListRules `json:"antiAffinityRules"`
|
||||||
|
|
||||||
|
// Auto start when node restarted
|
||||||
|
AutoStart bool `json:"autoStart"`
|
||||||
|
|
||||||
|
// Architecture
|
||||||
|
Arch string `json:"arch"`
|
||||||
|
|
||||||
|
// Boot image ID
|
||||||
|
BootImageID uint64 `json:"boot_image_id"`
|
||||||
|
|
||||||
|
// Boot order
|
||||||
|
BootOrder []string `json:"bootOrder"`
|
||||||
|
|
||||||
|
// Boot type
|
||||||
|
BootType string `json:"bootType"`
|
||||||
|
|
||||||
|
// Boot disk size
|
||||||
|
BootDiskSize uint64 `json:"bootdiskSize"`
|
||||||
|
|
||||||
|
// CD Image Id
|
||||||
|
CdImageId uint64 `json:"cdImageId"`
|
||||||
|
|
||||||
|
// Chipset
|
||||||
|
Chipset string `json:"chipset"`
|
||||||
|
|
||||||
|
// Clone reference
|
||||||
|
CloneReference uint64 `json:"cloneReference"`
|
||||||
|
|
||||||
|
// Clock
|
||||||
|
Clock string `json:"clock"`
|
||||||
|
|
||||||
|
// List clone IDs
|
||||||
|
Clones []uint64 `json:"clones"`
|
||||||
|
|
||||||
|
// Compute CI ID
|
||||||
|
ComputeCIID uint64 `json:"computeciId"`
|
||||||
|
|
||||||
|
// CPU Pin
|
||||||
|
CPUPin bool `json:"cpupin"`
|
||||||
|
|
||||||
|
// Number of CPU
|
||||||
|
CPUs uint64 `json:"cpus"`
|
||||||
|
|
||||||
|
// Created by
|
||||||
|
CreatedBy string `json:"createdBy"`
|
||||||
|
|
||||||
|
// Created time
|
||||||
|
CreatedTime uint64 `json:"createdTime"`
|
||||||
|
|
||||||
|
// Custom fields
|
||||||
|
CustomFields map[string]interface{} `json:"customFields"`
|
||||||
|
|
||||||
|
// Deleted by
|
||||||
|
DeletedBy string `json:"deletedBy"`
|
||||||
|
|
||||||
|
// Deleted time
|
||||||
|
DeletedTime uint64 `json:"deletedTime"`
|
||||||
|
|
||||||
|
// Description
|
||||||
|
Description string `json:"desc"`
|
||||||
|
|
||||||
|
// Devices
|
||||||
|
Devices interface{} `json:"devices"`
|
||||||
|
|
||||||
|
// List disks
|
||||||
|
Disks ListDisks `json:"disks"`
|
||||||
|
|
||||||
|
// Driver
|
||||||
|
Driver string `json:"driver"`
|
||||||
|
|
||||||
|
// Grid ID
|
||||||
|
GID uint64 `json:"gid"`
|
||||||
|
|
||||||
|
// GUID
|
||||||
|
GUID uint64 `json:"guid"`
|
||||||
|
|
||||||
|
// HPBacked
|
||||||
|
HPBacked bool `json:"hpBacked"`
|
||||||
|
|
||||||
|
// Hot resize
|
||||||
|
HotResize bool `json:"hotResize"`
|
||||||
|
|
||||||
|
// ID
|
||||||
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
|
// Image ID
|
||||||
|
ImageID uint64 `json:"imageId"`
|
||||||
|
|
||||||
|
// Image name
|
||||||
|
ImageName string `json:"imageName"`
|
||||||
|
|
||||||
|
// List interfaces
|
||||||
|
Interfaces ListInterfaces `json:"interfaces"`
|
||||||
|
|
||||||
|
// Loader meta iso information
|
||||||
|
LoaderMetaIso LoaderMetaIso `json:"loaderMetaIso"`
|
||||||
|
|
||||||
|
// Live migration job ID
|
||||||
|
LiveMigrationJobID uint64 `json:"live_migration_job_id"`
|
||||||
|
|
||||||
|
// Loader type
|
||||||
|
LoaderType string `json:"loaderType"`
|
||||||
|
|
||||||
|
// Lock status
|
||||||
|
LockStatus string `json:"lockStatus"`
|
||||||
|
|
||||||
|
// Manager ID
|
||||||
|
ManagerID uint64 `json:"managerId"`
|
||||||
|
|
||||||
|
// Manager type
|
||||||
|
ManagerType string `json:"managerType"`
|
||||||
|
|
||||||
|
// Migration job
|
||||||
|
MigrationJob uint64 `json:"migrationjob"`
|
||||||
|
|
||||||
|
// Milestones
|
||||||
|
Milestones uint64 `json:"milestones"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// Natable VINS ID
|
||||||
|
NatableVINSID uint64 `json:"natableVinsId"`
|
||||||
|
|
||||||
|
// Natable VINS IP
|
||||||
|
NatableVINSIP string `json:"natableVinsIp"`
|
||||||
|
|
||||||
|
// Natable VINS Name
|
||||||
|
NatableVINSName string `json:"natableVinsName"`
|
||||||
|
|
||||||
|
// Natable VINS network
|
||||||
|
NatableVINSNetwork string `json:"natableVinsNetwork"`
|
||||||
|
|
||||||
|
// Natable VINS network name
|
||||||
|
NatableVINSNetworkName string `json:"natableVinsNetworkName"`
|
||||||
|
|
||||||
|
// Need reboot
|
||||||
|
NeedReboot bool `json:"needReboot"`
|
||||||
|
|
||||||
|
// network interface naming
|
||||||
|
NetworkInterfaceNaming string `json:"networkInterfaceNaming"`
|
||||||
|
|
||||||
|
// NumaAffinity
|
||||||
|
NumaAffinity string `json:"numaAffinity"`
|
||||||
|
|
||||||
|
//NumaNodeId
|
||||||
|
NumaNodeId int64 `json:"numaNodeId"`
|
||||||
|
|
||||||
|
// List OS users
|
||||||
|
OSUsers ListOSUsers `json:"osUsers"`
|
||||||
|
|
||||||
|
// Name of OS
|
||||||
|
OSVersion string `json:"os_version"`
|
||||||
|
|
||||||
|
// Pinned to node
|
||||||
|
PinnedToNode int64 `json:"pinnedToNode"`
|
||||||
|
|
||||||
|
// PreferredCPU
|
||||||
|
PreferredCPU []int64 `json:"preferredCpu"`
|
||||||
|
|
||||||
|
// CPU alignment profile
|
||||||
|
CPUAlignmentProfile CPUAlignmentProfile `json:"cpu_alignment_profile"`
|
||||||
|
|
||||||
|
// Qemu_quest
|
||||||
|
QemuQuest QemuQuest `json:"qemu_guest"`
|
||||||
|
|
||||||
|
// ReadOnly indicates read-only mode state
|
||||||
|
ReadOnly bool `json:"read_only"`
|
||||||
|
|
||||||
|
// Number of RAM
|
||||||
|
RAM uint64 `json:"ram"`
|
||||||
|
|
||||||
|
// Reference ID
|
||||||
|
ReferenceID string `json:"referenceId"`
|
||||||
|
|
||||||
|
// Registered
|
||||||
|
Registered bool `json:"registered"`
|
||||||
|
|
||||||
|
// Whether a compute has been resized online
|
||||||
|
ResizedOnline bool `json:"resizedOnline"`
|
||||||
|
|
||||||
|
// Resource name
|
||||||
|
ResName string `json:"resName"`
|
||||||
|
|
||||||
|
// Reserved Node Cpus
|
||||||
|
ReservedNodeCpus []uint64 `json:"reservedNodeCpus"`
|
||||||
|
|
||||||
|
// Resource group ID
|
||||||
|
RGID uint64 `json:"rgId"`
|
||||||
|
|
||||||
|
// Resource group name
|
||||||
|
RGName string `json:"rgName"`
|
||||||
|
|
||||||
|
// Node ID
|
||||||
|
NodeID uint64 `json:"node_id"`
|
||||||
|
|
||||||
|
// Node name
|
||||||
|
NodeName string `json:"nodeName"`
|
||||||
|
|
||||||
|
// Stateless SEP ID
|
||||||
|
StatelessSEPID int64 `json:"statelessSepId"`
|
||||||
|
|
||||||
|
// Stateless SEP Type
|
||||||
|
StatelessSEPType string `json:"statelessSepType"`
|
||||||
|
|
||||||
|
// Status
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Tags
|
||||||
|
Tags map[string]interface{} `json:"tags"`
|
||||||
|
|
||||||
|
// Tech status
|
||||||
|
TechStatus string `json:"techStatus"`
|
||||||
|
|
||||||
|
// Total disk size
|
||||||
|
TotalDiskSize uint64 `json:"totalDisksSize"`
|
||||||
|
|
||||||
|
// Updated by
|
||||||
|
UpdatedBy string `json:"updatedBy"`
|
||||||
|
|
||||||
|
// Updated time
|
||||||
|
UpdatedTime uint64 `json:"updatedTime"`
|
||||||
|
|
||||||
|
// User managed
|
||||||
|
UserManaged bool `json:"userManaged"`
|
||||||
|
|
||||||
|
// Userdata
|
||||||
|
Userdata interface{} `json:"userdata"`
|
||||||
|
|
||||||
|
// List VGPU
|
||||||
|
VGPUs []VGPUItem `json:"vgpus"`
|
||||||
|
|
||||||
|
// VNC password
|
||||||
|
VNCPassword string `json:"vncPasswd"`
|
||||||
|
|
||||||
|
// Weight
|
||||||
|
Weight uint64 `json:"weight"`
|
||||||
|
|
||||||
|
// Zone ID
|
||||||
|
ZoneID uint64 `json:"zoneId"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type LoaderMetaIso struct {
|
type LoaderMetaIso struct {
|
||||||
@@ -1531,6 +1801,9 @@ type RecordMigrateStorageInfo struct {
|
|||||||
// Migration completion status
|
// Migration completion status
|
||||||
Completed bool `json:"completed"`
|
Completed bool `json:"completed"`
|
||||||
|
|
||||||
|
// CPU set
|
||||||
|
CPUSet string `json:"cpu_set"`
|
||||||
|
|
||||||
// Daemon address
|
// Daemon address
|
||||||
DaemonAddr string `json:"daemonAddr"`
|
DaemonAddr string `json:"daemonAddr"`
|
||||||
|
|
||||||
@@ -1642,6 +1915,9 @@ type ShadowCompute struct {
|
|||||||
// Chipset
|
// Chipset
|
||||||
Chipset string `json:"chipset"`
|
Chipset string `json:"chipset"`
|
||||||
|
|
||||||
|
// Clock
|
||||||
|
Clock string `json:"clock"`
|
||||||
|
|
||||||
// Clone reference
|
// Clone reference
|
||||||
CloneReference uint64 `json:"cloneReference"`
|
CloneReference uint64 `json:"cloneReference"`
|
||||||
|
|
||||||
@@ -1651,6 +1927,9 @@ type ShadowCompute struct {
|
|||||||
// Compute CI ID
|
// Compute CI ID
|
||||||
ComputeCIID uint64 `json:"computeciId"`
|
ComputeCIID uint64 `json:"computeciId"`
|
||||||
|
|
||||||
|
// CPU alignment profile
|
||||||
|
CPUAlignmentProfile CPUAlignmentProfile `json:"cpu_alignment_profile"`
|
||||||
|
|
||||||
// CPU pin
|
// CPU pin
|
||||||
CPUPin bool `json:"cpupin"`
|
CPUPin bool `json:"cpupin"`
|
||||||
|
|
||||||
@@ -1795,6 +2074,9 @@ type ShadowCompute struct {
|
|||||||
// VNC password
|
// VNC password
|
||||||
VNCPassword string `json:"vncPasswd"`
|
VNCPassword string `json:"vncPasswd"`
|
||||||
|
|
||||||
|
// Weight
|
||||||
|
Weight uint64 `json:"weight"`
|
||||||
|
|
||||||
// Zone ID
|
// Zone ID
|
||||||
ZoneID uint64 `json:"zoneId"`
|
ZoneID uint64 `json:"zoneId"`
|
||||||
}
|
}
|
||||||
@@ -1909,6 +2191,9 @@ type ItemShadowComputeInterface struct {
|
|||||||
// Enabled
|
// Enabled
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
|
|
||||||
|
// Enable default gateway
|
||||||
|
EnableDefaultGateway bool `json:"enable_default_gateway"`
|
||||||
|
|
||||||
// Node ID
|
// Node ID
|
||||||
NodeID uint64 `json:"nodeId"`
|
NodeID uint64 `json:"nodeId"`
|
||||||
|
|
||||||
|
|||||||
@@ -114,6 +114,9 @@ type RecordGrid struct {
|
|||||||
|
|
||||||
// Is BRO enabled
|
// Is BRO enabled
|
||||||
BROEnabled bool `json:"bro_enabled"`
|
BROEnabled bool `json:"bro_enabled"`
|
||||||
|
|
||||||
|
// Whether VM folders are enabled
|
||||||
|
VMFoldersEnabled bool `json:"vm_folders_enabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Information about grid
|
// Information about grid
|
||||||
@@ -159,6 +162,9 @@ type ItemGridList struct {
|
|||||||
|
|
||||||
// Is BRO enabled
|
// Is BRO enabled
|
||||||
BROEnabled bool `json:"bro_enabled"`
|
BROEnabled bool `json:"bro_enabled"`
|
||||||
|
|
||||||
|
// Whether VM folders are enabled
|
||||||
|
VMFoldersEnabled bool `json:"vm_folders_enabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List Grids
|
// List Grids
|
||||||
|
|||||||
@@ -477,11 +477,11 @@ type DPDK struct {
|
|||||||
// Bridges
|
// Bridges
|
||||||
Bridges Bridges `json:"bridges"`
|
Bridges Bridges `json:"bridges"`
|
||||||
|
|
||||||
|
// ovs dpdk cores
|
||||||
|
OVSDPDKCores []uint64 `json:"ovs_dpdk_cores"`
|
||||||
|
|
||||||
// hp memory
|
// hp memory
|
||||||
HPMemory map[string]uint64 `json:"hp_memory"`
|
HPMemory map[string]uint64 `json:"hp_memory"`
|
||||||
|
|
||||||
// pmd cpu
|
|
||||||
PMDCPU []uint64 `json:"pmd_cpu"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bridges
|
// Bridges
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package sep
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package cloudbroker
|
||||||
|
|
||||||
|
import (
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/pkg/cloudbroker/vmfolder"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Accessing the VMFolder method group
|
||||||
|
func (cb *CloudBroker) VMFolder() *vmfolder.VMFolder {
|
||||||
|
return vmfolder.New(cb.client)
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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 := "/cloudbroker/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
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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 := "/cloudbroker/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
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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 := "/cloudbroker/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
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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"`
|
||||||
|
|
||||||
|
// User or group name to revoke access from
|
||||||
|
// Required: true
|
||||||
|
User string `url:"user" json:"user"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 := "/cloudbroker/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
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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 := "/cloudbroker/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
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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 := "/cloudbroker/vmfolder/get"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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 := "/cloudbroker/vmfolder/list"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
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"`
|
||||||
|
|
||||||
|
// Time of update
|
||||||
|
UpdatedTime uint64 `json:"updated_time"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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"`
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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 := "/cloudbroker/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
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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 := "/cloudbroker/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
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/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,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -181,55 +181,39 @@ type L2ExternalNetwork struct {
|
|||||||
VLANTag *int `json:"vlan_tag"`
|
VLANTag *int `json:"vlan_tag"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ExternalNetworkPorts []ExternalNetworkPort
|
||||||
|
|
||||||
// Info about an external network port
|
// Info about an external network port
|
||||||
type ExternalNetworkPorts struct {
|
type ExternalNetworkPort struct {
|
||||||
// Access group ID
|
// Access group ID
|
||||||
AccessGroupID string `json:"access_group_id"`
|
AccessGroupID string `json:"access_group_id"`
|
||||||
|
|
||||||
// Access group name
|
// Access group name
|
||||||
AccessGroupName string `json:"access_group_name"`
|
AccessGroupName string `json:"access_group_name"`
|
||||||
|
|
||||||
// Bridge network name
|
// Comment
|
||||||
BridgeNetworkName string `json:"bridge_network_name"`
|
Comment string `json:"comment"`
|
||||||
|
|
||||||
// Default gateway for IPv4
|
// The name displayed
|
||||||
DefaultGatewayIPv4 string `json:"default_gateway_ipv4"`
|
DisplayName string `json:"display_name"`
|
||||||
|
|
||||||
// Default gateway for IPv6
|
// Whether the port is enabled
|
||||||
DefaultGatewayIPv6 string `json:"default_gateway_ipv6"`
|
Enabled bool `json:"enabled"`
|
||||||
|
|
||||||
// Description
|
// The ID of the external network
|
||||||
Description string `json:"description"`
|
ExternalNetworkID string `json:"external_network_id"`
|
||||||
|
|
||||||
// Details of external network ports
|
|
||||||
ExternalNetworkPorts ExternalNetworkPortsField `json:"external_network_ports"`
|
|
||||||
|
|
||||||
// Hypervisors
|
|
||||||
Hypervisors []string `json:"hypervisors"`
|
|
||||||
|
|
||||||
// ID of an external network port
|
// ID of an external network port
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
|
|
||||||
// Status
|
// IP of version 4
|
||||||
Status Status `json:"status"`
|
IPv4 string `json:"ipv4"`
|
||||||
|
|
||||||
// Version ID
|
// Version ID
|
||||||
VersionID uint64 `json:"version_id"`
|
VersionID uint64 `json:"version_id"`
|
||||||
|
|
||||||
// Subnet for V4
|
// MAC
|
||||||
SubnetV4 string `json:"subnet_v4"`
|
MAC string `json:"mac"`
|
||||||
|
|
||||||
// Subnet for V6
|
|
||||||
SubnetV6 string `json:"subnet_v6"`
|
|
||||||
|
|
||||||
// Created at
|
|
||||||
CreatedAt string `json:"created_at"`
|
|
||||||
|
|
||||||
// Updated at
|
|
||||||
UpdatedAt string `json:"updated_at"`
|
|
||||||
|
|
||||||
// VLAN Tag
|
|
||||||
VLANTag int `json:"vlan_tag"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Info about a logical port
|
// Info about a logical port
|
||||||
|
|||||||
Reference in new issue
Block a user