Compare commits

..
3 Commits
Author SHA1 Message Date
dayterr 4c05d94552 v16.3.0
v16.3.0
2026-09-15 17:42:23 +03:00
arsvolkov dbd979b6f3 v16.2.0 2026-09-04 17:29:39 +04:00
dayterr fe3c7bf63a v16.1.0
v16.1.0
2026-08-28 16:47:26 +03:00
179 changed files with 4223 additions and 635 deletions

No files matched your search

+29 -190
View File
@@ -1,209 +1,48 @@
## Version 16.0.0
## Version 16.3.0
Метод `ConfigFieldEdit` в cloudbroker/sep стал deprecated и в следующих версиях будет удалён
### Deprecated
Перечисленные методы будут удалены в `v1.17`
| Метод | CloudAPI | CloudBroker |
| --- | --- | --- |
| `account/AddUser` | :heavy_check_mark: | :heavy_check_mark: |
| `account/DeleteUser` | :heavy_check_mark: | :heavy_check_mark: |
| `account/UpdateUser` | :heavy_check_mark: | :heavy_check_mark: |
| `compute/UserGrant` | :heavy_check_mark: | :heavy_check_mark: |
| `compute/UserList` | :heavy_check_mark: | :heavy_check_mark: |
| `compute/UserRevoke` | :heavy_check_mark: | :heavy_check_mark: |
| `compute/UserUpdate` | :heavy_check_mark: | :heavy_check_mark: |
| `rg/AccessGrant` | :heavy_check_mark: | :heavy_check_mark: |
| `rg/AccessRevoke` | :heavy_check_mark: | :heavy_check_mark: |
| `sep/ConfigFieldEdit` | :x: | :heavy_check_mark: |
### Добавлено
#### Общее
#### extnet
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-991 | Допустимые значения `vgpu` и `pcidevice` в валидатор возможностей гипервизора ComputeFeatures |
| BGOS-1034 | Методы `AsyncCreate`, `AsyncDeviceDeploy` и `AsyncSetHAMode` в cloudbroker/extnet |
#### account
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-986 | Вычисляемое поле `EnableDefaultGateway` в структуру ответа `ItemVINS` в cloudbroker/account и cloudapi/account |
| BGOS-989 | Вычисляемые поля `Starting`, `Stopping`, `Paused`, `Pausing`, `Merge`, `Migrating`, `MigratingIn`, `MigratingOut`, `Down`, `Scheduled`, `BackupStopped`, `BackupRunning`, `Snapcreate`, `Cloning` и `Rollback` в структуры ответа `Computes` и `RGComputes` в cloudapi/account |
| BGOS-989 | Вычисляемые поля `Starting`, `Stopping`, `Paused`, `Pausing`, `Merge`, `Migrating`, `MigratingIn`, `MigratingOut`, `Down`, `Scheduled`, `BackupStopped`, `BackupRunning`, `Snapcreate`, `Cloning` и `Rollback` в структуру ответа `Computes` в cloudbroker/account |
#### compute
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-977 | Вычисляемое поле `ImageID` в структуру ответа `InfoDisk` в cloudbroker/compute и cloudapi/compute |
| BGOS-978 | Вычисляемое поле `WatchdogAction` в структуры ответа `RecordCompute` и `ItemCompute` в cloudapi/compute |
| BGOS-978 | Вычисляемое поле `WatchdogAction` в структуры ответа `RecordCompute` и `InfoCompute` в cloudbroker/compute |
| BGOS-979 | Опциональное поле `WatchdogAction` в структуру запроса `UpdateRequest` в cloudapi/compute и cloudbroker/compute |
| BGOS-994 | Вычисляемое поле `QoSPolicies` в структуру ответа `ItemVNFInterface` в cloudapi/compute |
| BGOS-994 | Вычисляемое поле `QoSPolicies` в структуру ответа `ItemInterface` в cloudbroker/compute |
| BGOS-994 | Опциональное поле `QoSPolicies` в структуру запроса `NetAttachRequest` в cloudapi/compute и cloudbroker/compute |
| BGOS-994 | Методы `ChangeQoSPolicies` и `ChangeQoSPoliciesAsync` в cloudbroker/compute и cloudapi/compute |
| BGOS-995 | Вычисляемые поля `ComputeID`, `BusNumber`, `DeviceReference`, `MdevUUID`, `ParentPCIAddress`, `ProfileReference` и `SplitMode` в структуру ответа `ItemVGPU` в cloudbroker/compute и cloudapi/compute |
| BGOS-999 | Вычисляемое поле `AccountIDs` в структуру ответа `ItemPCIDevice` в cloudbroker/compute и cloudapi/compute |
#### disks
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-976 | Метод `CreateAsync` в cloudapi/disks |
| BGOS-976 | Методы `CreateAsync` и `MigrateAsync` в cloudbroker/disks |
#### grid
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1000 | Вычисляемые поля `ReservedCPU` и `ReservedRAM` в структуру ответа `RecordSettingsGrid` в cloudbroker/grid |
#### kvmx86
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-979 | Опциональное поле `WatchdogAction` в структуры запроса `CreateRequest` и `CreateBlankRequest` в cloudapi/kvmx86 |
| BGOS-979 | Опциональное поле `WatchdogAction` в структуры запроса `CreateRequest`, `CreateBlankRequest` и `MassCreateRequest` в cloudbroker/kvmx86 |
| BGOS-983 | Метод `CreateAsync` в cloudbroker/kvmx86 и cloudapi/kvmx86 |
| BGOS-984 | Опциональное поле `ReadOnly` в структуру запроса `DataDisk` в cloudbroker/kvmx86 и cloudapi/kvmx86 |
| BGOS-994 | Опциональное поле `QoSPolicies` в структуру запроса `Interface` в cloudbroker/kvmx86 и cloudapi/kvmx86 |
| BGOS-994 | Опциональное поле `QoSPolicies` в структуру запроса `InterfaceMassCreate` в cloudbroker/kvmx86 |
#### locations
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-992 | Вычисляемое поле `Budget` в структуру ответа `ItemLocation` в cloudapi/locations |
#### network qos policy
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-993 | Группа ручек `QoSPolicy` в cloudbroker/qospolicy и cloudapi/qospolicy |
#### resmon
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-981 | Вычисляемое поле `TotalVCPUs` в структуру ответа `GetByNodePoint` в cloudbroker/resmon |
#### rg
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-998 | Опциональное поле `IPCIDR` в структуру запроса `CreateRequest` в cloudbroker/rg |
#### tasks
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-996 | Опицональные поля `CreatedTimeAt` и `CreatedTimeTo` в структуру запроса `ListRequest` в cloudapi/tasks и cloudbroker/tasks |
| BGOS-996 | Вычисляемое поле `CreatedTime` в структуру ответа `RecordAsyncTask` в cloudapi/tasks |
| BGOS-996 | Вычисляемое поле `CreatedTime` в структуру ответа `ItemTask` в cloudbroker/tasks |
#### user
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-988 | Вычисляемые поля `Destroying`, `Confirmed` и `Deleted` в структуру ответа `Accounts` в cloudapi/user |
| BGOS-988 | Вычисляемые поля `Starting`, `Stopping`, `Paused`, `Pausing`, `Merge`, `Migrating`, `MigratingIn`, `MigratingOut`, `Down`, `Scheduled`, `BackupStopped`, `BackupRunning`, `Snapcreate`, `Cloning` и `Rollback` в структуру ответа `Computes` в cloudapi/user |
| BGOS-988 | Вычисляемые поля `Modeled`, `Created`, `Deleted`, `Deleting`, `Destroying`, `Disabling`, `Enabling` и `Restoring` в структуру ответа `RGs` в cloudapi/user |
| BGOS-1032 | Вычисляемое поле `VMFoldersEnabled` в структуру ответа `ItemLocation` в cloudapi/locations |
#### vins
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-986 | Вычисляемое поле `EnableDefaultGateway` в структуру ответа `ItemVINS` в cloudapi/vins |
| BGOS-1033 | Методы `AsyncCreateInAccount`, `AsyncCreateInRG`, `AsyncEnable`, `AsyncVNFDevRedeploy` и `AsyncVNFDevRestart` в cloudapi/vins |
| BGOS-1033 | Методы `AsyncCreateInAccount`, `AsyncCreateInRG`, `AsyncEnable`, `AsyncVNFDevRedeploy`, `AsyncVNFDevRestart` и `AsyncVNFDevStart` в cloudbroker/vins |
| BGOS-1033 | Структура запроса `DisableRequest` и метод `Disable` в cloudapi/vins |
| BGOS-1033 | Структура запроса `EnableRequest` и метод `Enable` в cloudapi/vins |
#### vgpu
### Исправлено
#### kvmx86
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-980 | Опциональные поля `AccountIDs`, `MDEVType` и `PCIAddress` в структуру запроса `CreateRequest` в cloudbroker/vgpu |
| BGOS-980 | Опциональное поле `SplitMode` в структуру запроса `ListRequest` в cloudbroker/vgpu и cloudapi/vgpu |
| BGOS-980 | Вычисляемые поля `ComputeID`, `DeviceReference`, `MdevUUID`, `ParentPCIAddress`, `ProfileReference` и `SplitMode` в структуру ответа `ItemVGPU` в cloudbroker/vgpu и cloudapi/vgpu |
| BGOS-980 | Вычисляемое поле `BusNumber` в структуру ответа `ItemVGPU` в cloudbroker/vgpu |
#### zone
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-997 | Вычисляемые поля `SDRS`, `SDRSMode` и `LoggingLevel` в структуры ответа `RecordZone` и `ItemZone` в cloudapi/zone и cloudbroker/zone |
### Изменено
#### bservice
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1003 | Тип опционального поля `UserData` в структуре запроса `GroupAddRequest` сo `string` на `interface{}` в cloudbroker/bservice и cloudapi/bservice |
#### compute
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-995 | Название вычисляемого поля `AccountID` на `AccountIDs` и тип с `uint64` на `[]uint64` в структуре ответа `ItemVGPU` в cloudbroker/compute и cloudapi/compute |
| BGOS-995 | Тип вычисляемого поля `VGPUs` с `[]VGPUItem` на `[]ItemVGPU` в структурах ответов `RecordCompute` и `SnapRecordCompute` в cloudbroker/compute и cloudapi/compute |
#### disks
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-987 | Тип опционального поля `Status` в структуре запроса `ListRequest` с `string` на `[]string` в cloudbroker/disks и cloudapi/disks |
#### k8s
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1002 | Тип опционального поля `UserData` в структурах запросов `CreateRequest` и `UpdateWorkerNodesMetaDataRequest` со `string` на `interface{}` в cloudbroker/k8s и cloudapi/k8s |
#### node
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-982 | Тип вычисляемого поля `Total` с `ResourcesInfo` на `FreeResourcesInfo` в структуре ответа `ConsumptionInfo` в cloudbroker/node |
#### vgpu
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-980 | Тип опционального поля `ProfileID` в структуре запроса `CreateRequest` с `uint64` на `string` в cloudbroker/vgpu |
| BGOS-980 | Название вычисляемого поля `AccountID` на `AccountIDs` и тип с `uint64` на `[]uint64` в структуре ответа `ItemVGPU` в cloudbroker/vgpu и cloudapi/vgpu |
| BGOS-980 | Название опционального поля `NID` на `NodeID` в структуре запроса `ListRequest` в cloudbroker/vgpu и cloudapi/vgpu |
### Удалено
#### account
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-975 | Метод `Audits` из cloudapi/account и cloudbroker/account |
| BGOS-975 | Методы `Delete`, `Disable`, `Enable`, `GetConsumedCloudUnitsByType` и `GetReservedAccountUnits` из cloudapi/account |
| BGOS-975 | Методы `Disable` и `Enable` из cloudbroker/account |
#### compute
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-975 | Метод `Audits` из cloudapi/compute и cloudbroker/compute |
| BGOS-975 | Методы `ComputeCISet`, `ComputeCIUnset`, `GetLog` и `GetAudits` из cloudbroker/compute |
| BGOS-975 | Метод `GetAudits` из cloudapi/compute |
| BGOS-995 | Вычисляемые поля `LastClaimedBy`, `Mode`, `ProfileID`, `RAM`, `ReferenceID`, `RGID`, `Type` и `VMID` из структуры `ItemVGPU` в cloudbroker/compute и cloudapi/compute |
| BGOS-995 | Cтруктура `VGPUItem` в cloudbroker/compute и cloudapi/compute |
| BGOS-999 | Вычисляемое поле `RGID` из структуры ответа `ItemPCIDevice` в cloudbroker/compute и cloudapi/compute |
| BGOS-999 | Опциональное поле `RGID` из структуры запроса `ListPCIDeviceRequest` в cloudbroker/compute и cloudapi/compute |
#### grid
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-975 | Методы `ExecuteMaintenanceScript`, `ListEmails` и `ServicesRestart` из cloudbroker/grid |
#### group
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-975 | Метод `Get` из cloudbroker/group |
#### image
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-975 | Методы `ComputeCISet` и `ComputeCIUnset` из cloudbroker/image |
#### rg
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-975 | Метод `Audits` из cloudapi/rg и cloudbroker/rg |
#### sep
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-975 | Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke` и `AccessRevokeToPool` из cloudbroker/sep |
#### user
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-975 | Метод `IsValidInviteUserToken` из cloudapi/user |
| BGOS-975 | Метод `GetAudit` из cloudapi/user и cloudbroker/user |
| BGOS-988 | Структуры `CSs` и `VMs` из структуры ответа `BriefResources` из cloudapi/user |
| BGOS-988 | Вычисляемое поле `Enabled` из структур ответов `Accounts` и `RGs` из cloudapi/user |
#### vins
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-975 | Метод `Audits` из cloudapi/vins и cloudbroker/vins |
#### vgpu
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-980 | Опциональные поля `RGID` и `Allocate` из структуры запроса `CreateRequest` в cloudbroker/vgpu |
| BGOS-980 | Опциональные поле `Force` из структуры запроса `DestroyRequest` в cloudbroker/vgpu |
| BGOS-980 | Опциональные поля `Type`, `Mode` и `RGID` из структуры запроса `ListRequest` в cloudbroker/vgpu и cloudapi/vgpu |
| BGOS-980 | Вычисляемые поля `LastClaimedBy`, `Mode`, `ProfileID`, `RAM`, `ReferenceID`, `RGID`, `Type` и `VMID` из структуры ответа `ItemVGPU` в cloudbroker/vgpu и cloudapi/vgpu |
| BGOS-980 | Методы `Allocate` и `Deallocate` из cloudbroker/vgpu |
| BGOS-1040 | JSON-тэг опционального поля `AsyncMode` с `asyncMode` на `async_mode` в структуре запроса `CreateRequest` в cloudapi/kvmx86 и cloudbroker/kvmx86 |
+41 -38
View File
@@ -159,6 +159,7 @@ go get -u repository.basistech.ru/BASIS/dynamix-golang-sdk/v16
- `RG` - управление ресурсными группами аккаунта;
- `Security group` – управление группами безопасности;
- `SEP` - управление storage endpoint (sep);
- `Session` - получение информации о сессиях;
- `Storage policy` – управление политиками хранения;
- `Tasks` - получение информации о ходе выполнения асинхронных задач (например, создание кластера);
- `Trunk` - управление транковыми портами;
@@ -369,6 +370,7 @@ func main() {
- `pkg/cloudbroker/rg` - для `RG`
- `pkg/cloudbroker/secgroup` - для `Security group`
- `pkg/cloudbroker/sep` - для `SEP`
- `pkg/cloudbroker/session` - для `Session`
- `pkg/cloudbroker/stpolicy` - для `Storage policy`
- `pkg/cloudbroker/tasks` - для `Tasks`
- `pkg/cloudbroker/trunk` - для `Trunk`
@@ -377,7 +379,7 @@ func main() {
- `pkg/cloudbroker/vfpool` - для `VFPool`
- `pkg/cloudbroker/vins` - для `VINS`
- `pkg/cloudbroker/zone` - для `Zone`
- **sdn**:
- **sdn**:
- `pkg/sdn/acsgroups` - для `Access groups`
- `pkg/sdn/adrspools` - для `Address pool`
- `pkg/sdn/defsecpolicies` - для `DefaultSecurityPolicies`
@@ -469,7 +471,7 @@ type CreateRequest struct {
// Node ID
// Required: false
NodeID uint64 `url:"nodeId,omitempty" json:"nodeId,omitempty"`
NodeID uint64 `url:"nodeId,omitempty" json:"nodeId,omitempty"`
}
```
@@ -572,6 +574,7 @@ func main() {
- `.RG()` - для работы с `RG`
- `.SecurityGroup()` - для работы с `Security Group`
- `.SEP()` - для работы с `SEP`
- `.Session()` - для работы с `Session`
- `.StPolicy()` - для работы с `Storage Policy`
- `.Tasks()` - для работы с `Tasks`
- `.Trunk()` - для работы с `Trunk`
@@ -581,7 +584,7 @@ func main() {
- `.VINS()` - для работы с `VINS`
- `.Zone()` - для работы с `Zone`
Доступные методы для `.SDN()`:
Доступные методы для `.SDN()`:
- `.AccessGroup()` - для работы с `Access group`
- `.AddressPool()` - для работы с `Addres pool`
@@ -954,7 +957,7 @@ func main() {
- ToString(): строковое представление результата выполнения задачи
- ID() и Name(): получение ID и имени созданного в результате выполнения задачи ресурса
- ToMaps(): получение списка карт, содержащих информацию о дисках, восстановленных в результате выполнения задачи.
Все методы оборудованы возвратом ошибок. Непустая ошибка означает, что из поля Result нельзя получить информацию, которую предоставляет метод.
Все методы оборудованы возвратом ошибок. Непустая ошибка означает, что из поля Result нельзя получить информацию, которую предоставляет метод.
```go
package main
@@ -1561,7 +1564,7 @@ func main() {
| BVSConfig | *BVSConfig | Нет | Конфигурация BVS |
| LegacyConfig | string | Нет | Конфигурация Legacy |
В универсальном клиенте можно использовать только один тип конфигурации одновременно.
В универсальном клиенте можно использовать только один тип конфигурации одновременно.
#### Пример конфигурации универсального клиента
@@ -1632,46 +1635,46 @@ package main
import (
"fmt"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/config"
decort "repository.basistech.ru/BASIS/dynamix-golang-sdk/v16"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/config"
decort "repository.basistech.ru/BASIS/dynamix-golang-sdk/v16"
)
func main() {
// Настройка конфигурации
legacyCfg := config.LegacyConfig{
Username: "<USERNAME>",
Password: "<PASSWORD>",
Domain: "dynamix",
DecortURL: "https://mr4.digitalenergy.online",
Retries: 5,
// Настройка конфигурации
legacyCfg := config.LegacyConfig{
Username: "<USERNAME>",
Password: "<PASSWORD>",
Domain: "dynamix",
DecortURL: "https://mr4.digitalenergy.online",
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)
}
// Создание клиента
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)
fmt.Println(res)
}
```
+7 -1
View File
@@ -492,5 +492,11 @@ func sepDescriptionValidator(fe validator.FieldLevel) bool {
func watchdogActionValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().String()
return IsInSlice(fieldValue, watchdogActionVaues)
return IsInSlice(fieldValue, watchdogActionValues)
}
func memoryBalloonModeValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().String()
return IsInSlice(fieldValue, memoryBalloonModeValues)
}
-1
View File
@@ -2,7 +2,6 @@ package validators
import (
"errors"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/multierror"
"github.com/go-playground/validator/v10"
+5
View File
@@ -331,5 +331,10 @@ func registerAllValidators(validate *validator.Validate) error {
return err
}
err = validate.RegisterValidation("memoryBalloonMode", memoryBalloonModeValidator)
if err != nil {
return err
}
return nil
}
+3 -1
View File
@@ -81,7 +81,9 @@ var (
sepTechStatusValues = []string{"ENABLED", "DISABLED"}
watchdogActionVaues = []string{"reset", "shutdown", "poweroff", "pause", "none"}
watchdogActionValues = []string{"reset", "shutdown", "poweroff", "pause", "none"}
memoryBalloonModeValues = []string{"auto", "legacy", "none"}
)
const (
+40
View File
@@ -0,0 +1,40 @@
package account
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// AddACLAccessRequest adds ACL access to an account
type AddACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
AccessType string `url:"accesstype" json:"accesstype" validate:"required"`
Usernames []string `url:"usernames,omitempty" json:"usernames,omitempty"`
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
// AddACLAccess adds ACL access to an account.
func (a Account) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/account/add_acl_access"
res, err := a.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
}
+2
View File
@@ -27,6 +27,8 @@ type AddUserRequest struct {
}
// AddUser gives a user access rights.
//
// Deprecated: will be removed in SDK v1.17
func (a Account) AddUser(ctx context.Context, req AddUserRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
+39
View File
@@ -0,0 +1,39 @@
package account
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// DelACLAccessRequest deletes ACL access from an account
type DelACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
Usernames []string `url:"usernames,omitempty" json:"usernames,omitempty"`
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
// DelACLAccess deletes ACL access from an account.
func (a Account) DeleteACLAccess(ctx context.Context, req DelACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/account/del_acl_access"
res, err := a.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
}
+2
View File
@@ -20,6 +20,8 @@ type DeleteUserRequest struct {
}
// DeleteUser revokes user access from the account
//
// Deprecated: will be removed in SDK v1.17
func (a Account) DeleteUser(ctx context.Context, req DeleteUserRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
-3
View File
@@ -19,9 +19,6 @@ type ListRecordACL struct {
// Account owner ID
UgroupID string `json:"userGroupId"`
// Is it possible to remove
CanBeDeleted bool `json:"canBeDeleted"`
}
// Access Control List
+40
View File
@@ -0,0 +1,40 @@
package account
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// UpdateACLAccessRequest updates ACL access in an account
type UpdateACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
AccessType string `url:"accesstype" json:"accesstype" validate:"required"`
Usernames []string `url:"usernames,omitempty" json:"usernames,omitempty"`
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
// UpdateACLAccess updates ACL access in an account.
func (a Account) UpdateACLAccess(ctx context.Context, req UpdateACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/account/update_acl_access"
res, err := a.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
}
+2
View File
@@ -27,6 +27,8 @@ type UpdateUserRequest struct {
}
// UpdateUser updates user access rights
//
// Deprecated: will be removed in SDK v1.17
func (a Account) UpdateUser(ctx context.Context, req UpdateUserRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
+3
View File
@@ -90,6 +90,9 @@ type ListRequest struct {
// Exclude audit lines from response
// Required: false
ExcludeAuditLines bool `url:"exclude_audit_lines,omitempty" json:"exclude_audit_lines,omitempty"`
// Public Session ID
PublicSessionID string `json:"public_session_id"`
}
// List gets audit records for the specified account object
+6 -1
View File
@@ -2,7 +2,6 @@ package audit
// Main info about audit
type RecordAudit struct {
// Arguments
Arguments string `json:"args"`
@@ -41,6 +40,9 @@ type RecordAudit struct {
// User
User string `json:"user"`
// Public Session ID
PublicSessionID string `json:"public_session_id"`
}
// Main info about audit
@@ -81,6 +83,9 @@ type ItemAudit struct {
// User
User string `json:"user"`
// Public Session ID
PublicSessionID string `json:"public_session_id"`
// TTL
TTL string `json:"_ttl"`
}
+40
View File
@@ -0,0 +1,40 @@
package compute
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// AddACLAccessRequest adds ACL access to a vm
type AddACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
AccessType string `url:"accesstype" json:"accesstype" validate:"required"`
Usernames []string `url:"usernames,omitempty" json:"usernames,omitempty"`
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
// AddACLAccess adds ACL access to a vm.
func (c Compute) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/compute/add_acl_access"
res, err := c.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
}
-1
View File
@@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
-1
View File
@@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
+39
View File
@@ -0,0 +1,39 @@
package compute
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// DeleteACLAccessRequest deletes ACL access from a vm
type DeleteACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
Usernames []string `url:"usernames,omitempty" json:"usernames,omitempty"`
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
// DeleteACLAccess deletes ACL access from a vm.
func (c Compute) DeleteACLAccess(ctx context.Context, req DeleteACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/compute/del_acl_access"
res, err := c.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
}
+44
View File
@@ -0,0 +1,44 @@
package compute
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// GetACLAccessRequest struct to get detailed information about ACL account in a vm
type GetACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
}
// Get gets current configuration of the ACL access in a vm as a RecordRGACLAccess struct
func (c Compute) GetACLAccess(ctx context.Context, req GetACLAccessRequest) (*RecordComputeACLAccess, error) {
res, err := c.GetACLAccessRaw(ctx, req)
if err != nil {
return nil, err
}
info := RecordComputeACLAccess{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}
// GetACLAccessRaw gets current configuration of the ACL access in a vm as an array of bytes
func (c Compute) GetACLAccessRaw(ctx context.Context, req GetACLAccessRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/compute/get_acl_access"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
return res, err
}
-4
View File
@@ -18,10 +18,6 @@ type ListVGPURequest struct {
// Required: false
GPUID uint64 `url:"gpuId,omitempty" json:"gpuId,omitempty"`
// Find by type
// Required: false
Type string `url:"type,omitempty" json:"type,omitempty"`
// Find by status
// Required: false
Status string `url:"status,omitempty" json:"status,omitempty"`
+61
View File
@@ -446,6 +446,9 @@ type RecordCompute struct {
// Manager type
ManagerType string `json:"managerType"`
// Memory balloon mode
MemoryBalloonMode string `json:"memory_balloon_mode"`
// Migration job
MigrationJob uint64 `json:"migrationjob"`
@@ -574,6 +577,58 @@ type RecordCompute struct {
ZoneID uint64 `json:"zoneId"`
}
// Detailed information about ACL Access in a compute
type RecordComputeACLAccess struct {
// Data
Data DataACL `json:"data"`
// Entry count
EntryCount uint64 `json:"entryCount"`
}
// Data ACL
type DataACL struct {
// RG ACL list
RGACLList []RGACL `json:"rgACL"`
// Account ACL list
AccountACLList []AccountACL `json:"accountACL"`
// Compute ACL list
ComputeACLList []ComputeACL `json:"computeACL"`
}
// RG ACL info
type RGACL struct {
Right string `json:"right"`
GUID string `json:"guid"`
UserGroupID string `json:"userGroupId"`
Status string `json:"status"`
Type string `json:"type"`
Explicit bool `json:"explicit"`
}
// Account ACL info
type AccountACL struct {
Right string `json:"right"`
GUID string `json:"guid"`
UserGroupID string `json:"userGroupId"`
Status string `json:"status"`
Type string `json:"type"`
Explicit bool `json:"explicit"`
}
// Compute ACL info
type ComputeACL struct {
Right string `json:"right"`
GUID string `json:"guid"`
UserGroupID string `json:"userGroupId"`
Status string `json:"status"`
Type string `json:"type"`
Explicit bool `json:"explicit"`
}
type SnapRecordCompute struct {
// Access Control List
ACL ListACL `json:"acl"`
@@ -1396,6 +1451,9 @@ type ItemCompute struct {
// Manager type
ManagerType string `json:"managerType"`
// Memory balloon mode
MemoryBalloonMode string `json:"memory_balloon_mode"`
// Migration job
MigrationJob uint64 `json:"migrationjob"`
@@ -1591,6 +1649,9 @@ type ItemVGPU struct {
// Profile Reference
ProfileReference string `json:"profile_reference"`
// Profile Name
ProfileName string `json:"profile_name"`
// Split Mode
SplitMode string `json:"split_mode"`
+4 -3
View File
@@ -5,6 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
@@ -95,7 +96,7 @@ type NetAttachRequest struct {
type wrapperNetAttachRequest struct {
NetAttachRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
}
// NetAttach attaches network to compute and gets info about network
@@ -112,7 +113,7 @@ func (c Compute) NetAttach(ctx context.Context, req NetAttachRequest) (*RecordNe
url := "/cloudapi/compute/netAttach"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return nil, err
}
@@ -141,7 +142,7 @@ func (c Compute) NetAttachAsync(ctx context.Context, req NetAttachRequest) (stri
url := "/cloudapi/compute/netAttach"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return "", err
}
+5
View File
@@ -79,6 +79,11 @@ type UpdateRequest struct {
// Required: false
// Default: reset
WatchdogAction string `url:"watchdog_action,omitempty" json:"watchdog_action,omitempty" validate:"omitempty,watchdogAction"`
// Memory balloon mode. One of ["auto","legacy","none"]
// Required: false
// Default: "auto"
MemoryBalloonMode string `url:"memory_balloon_mode,omitempty" json:"memory_balloon_mode,omitempty" validate:"omitempty,memoryBalloonMode"`
}
// Update updates some properties of the compute
+40
View File
@@ -0,0 +1,40 @@
package compute
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// UpdateACLAccessRequest updates ACL access in a vm
type UpdateACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
AccessType string `url:"accesstype" json:"accesstype" validate:"required"`
Usernames []string `url:"usernames,omitempty" json:"usernames,omitempty"`
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
// UpdateACLAccess updates ACL access in a vm.
func (c Compute) UpdateACLAccess(ctx context.Context, req UpdateACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/compute/update_acl_access"
res, err := c.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
}
+2
View File
@@ -28,6 +28,8 @@ type UserGrantRequest struct {
}
// UserGrant grants user access to the compute
//
// Deprecated: will be removed in SDK v1.17
func (c Compute) UserGrant(ctx context.Context, req UserGrantRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
+2
View File
@@ -16,6 +16,8 @@ type UserListRequest struct {
}
// UserList gets users list for compute
//
// Deprecated: will be removed in SDK v1.17
func (c Compute) UserList(ctx context.Context, req UserListRequest) (*ListUsers, error) {
err := validators.ValidateRequest(req)
if err != nil {
+2
View File
@@ -20,6 +20,8 @@ type UserRevokeRequest struct {
}
// UserRevoke revokes user access to the compute
//
// Deprecated: will be removed in SDK v1.17
func (c Compute) UserRevoke(ctx context.Context, req UserRevokeRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
+2
View File
@@ -28,6 +28,8 @@ type UserUpdateRequest struct {
}
// UserUpdate updates user access to the compute
//
// Deprecated: will be removed in SDK v1.17
func (c Compute) UserUpdate(ctx context.Context, req UserUpdateRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -2,6 +2,7 @@ package disks
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -19,6 +20,12 @@ type ChangeDiskStoragePolicyRequest struct {
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
}
type wrapperChangeDiskStoragePolicyRequest struct {
ChangeDiskStoragePolicyRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// ChangeDiskStoragePolicy changes storage policy for disk
func (d Disks) ChangeDiskStoragePolicy(ctx context.Context, req ChangeDiskStoragePolicyRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -28,7 +35,12 @@ func (d Disks) ChangeDiskStoragePolicy(ctx context.Context, req ChangeDiskStorag
url := "/cloudapi/disks/change_disk_storage_policy"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
wrappedReq := wrapperChangeDiskStoragePolicyRequest{
ChangeDiskStoragePolicyRequest: req,
AsyncMode: false,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return false, err
}
@@ -40,3 +52,30 @@ func (d Disks) ChangeDiskStoragePolicy(ctx context.Context, req ChangeDiskStorag
return result, nil
}
// ChangeDiskStoragePolicyAsync changes storage policy for disk in async mode
func (d Disks) ChangeDiskStoragePolicyAsync(ctx context.Context, req ChangeDiskStoragePolicyRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/disks/change_disk_storage_policy"
wrappedReq := wrapperChangeDiskStoragePolicyRequest{
ChangeDiskStoragePolicyRequest: req,
AsyncMode: true,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return "", err
}
var result string
if err := json.Unmarshal(res, &result); err != nil {
return "", err
}
return result, nil
}
+40 -1
View File
@@ -2,6 +2,7 @@ package disks
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -23,6 +24,12 @@ type DeleteRequest struct {
Permanently bool `url:"permanently,omitempty" json:"permanently,omitempty"`
}
type wrapperDeleteRequest struct {
DeleteRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// Delete deletes disk by ID
func (d Disks) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -32,7 +39,12 @@ func (d Disks) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
url := "/cloudapi/disks/delete"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
wrappedReq := wrapperDeleteRequest{
DeleteRequest: req,
AsyncMode: false,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return false, err
}
@@ -44,3 +56,30 @@ func (d Disks) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
return result, nil
}
// DeleteAsync deletes disk by ID in async mode
func (d Disks) DeleteAsync(ctx context.Context, req DeleteRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/disks/delete"
wrappedReq := wrapperDeleteRequest{
DeleteRequest: req,
AsyncMode: true,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return "", err
}
var result string
if err := json.Unmarshal(res, &result); err != nil {
return "", err
}
return result, nil
}
+40 -1
View File
@@ -2,6 +2,7 @@ package disks
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -19,6 +20,12 @@ type DisksDeleteRequest struct {
Permanently bool `url:"permanently,omitempty" json:"permanently,omitempty"`
}
type wrapperDisksDeleteRequest struct {
DisksDeleteRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// DeleteDisks deletes multiple disks permanently
func (d Disks) DeleteDisks(ctx context.Context, req DisksDeleteRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -28,7 +35,12 @@ func (d Disks) DeleteDisks(ctx context.Context, req DisksDeleteRequest) (bool, e
url := "/cloudapi/disks/deleteDisks"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
wrappedReq := wrapperDisksDeleteRequest{
DisksDeleteRequest: req,
AsyncMode: false,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return false, err
}
@@ -40,3 +52,30 @@ func (d Disks) DeleteDisks(ctx context.Context, req DisksDeleteRequest) (bool, e
return result, nil
}
// DeleteDisksAsync deletes multiple disks permanently in async mode
func (d Disks) DeleteDisksAsync(ctx context.Context, req DisksDeleteRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/disks/deleteDisks"
wrappedReq := wrapperDisksDeleteRequest{
DisksDeleteRequest: req,
AsyncMode: true,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return "", err
}
var result string
if err := json.Unmarshal(res, &result); err != nil {
return "", err
}
return result, nil
}
+1 -1
View File
@@ -25,4 +25,4 @@ func (lsd ListSearchDisks) IDs() []uint64 {
res = append(res, d.ID)
}
return res
}
}
+42 -1
View File
@@ -2,6 +2,7 @@ package disks
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -71,6 +72,12 @@ type LimitIORequest struct {
SizeIOPSSec uint64 `url:"size_iops_sec,omitempty" json:"size_iops_sec,omitempty"`
}
type wrapperLimitIORequest struct {
LimitIORequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// LimitIO limit IO for a certain disk
// total and read/write options are not allowed to be combined
// see http://libvirt.org/formatdomain.html#elementsDisks iotune section for more details
@@ -82,7 +89,12 @@ func (d Disks) LimitIO(ctx context.Context, req LimitIORequest) (bool, error) {
url := "/cloudapi/disks/limitIO"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
wrappedReq := wrapperLimitIORequest{
LimitIORequest: req,
AsyncMode: false,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return false, err
}
@@ -94,3 +106,32 @@ func (d Disks) LimitIO(ctx context.Context, req LimitIORequest) (bool, error) {
return result, nil
}
// LimitIOAsync limits IO for a certain disk in async mode
// total and read/write options are not allowed to be combined
// see http://libvirt.org/formatdomain.html#elementsDisks iotune section for more details
func (d Disks) LimitIOAsync(ctx context.Context, req LimitIORequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/disks/limitIO"
wrappedReq := wrapperLimitIORequest{
LimitIORequest: req,
AsyncMode: true,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return "", err
}
var result string
if err := json.Unmarshal(res, &result); err != nil {
return "", err
}
return result, nil
}
+40 -1
View File
@@ -2,6 +2,7 @@ package disks
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -19,6 +20,12 @@ type RenameRequest struct {
Name string `url:"name" json:"name" validate:"required"`
}
type wrapperRenameRequest struct {
RenameRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// Rename renames disk
func (d Disks) Rename(ctx context.Context, req RenameRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -28,7 +35,12 @@ func (d Disks) Rename(ctx context.Context, req RenameRequest) (bool, error) {
url := "/cloudapi/disks/rename"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
wrappedReq := wrapperRenameRequest{
RenameRequest: req,
AsyncMode: false,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return false, err
}
@@ -40,3 +52,30 @@ func (d Disks) Rename(ctx context.Context, req RenameRequest) (bool, error) {
return result, nil
}
// RenameAsync renames disk in async mode
func (d Disks) RenameAsync(ctx context.Context, req RenameRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/disks/rename"
wrappedReq := wrapperRenameRequest{
RenameRequest: req,
AsyncMode: true,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return "", err
}
var result string
if err := json.Unmarshal(res, &result); err != nil {
return "", err
}
return result, nil
}
+42 -1
View File
@@ -2,6 +2,7 @@ package disks
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -31,6 +32,12 @@ type ReplicateRequest struct {
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
}
type wrapperReplicateRequest struct {
ReplicateRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// Replicate create an empty disk in chosen SEP and pool combination.
// Starts replication between chosen disk and newly created disk
// Note: only TATLIN type SEP are supported for replications between
@@ -42,7 +49,12 @@ func (d Disks) Replicate(ctx context.Context, req ReplicateRequest) (uint64, err
url := "/cloudapi/disks/replicate"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
wrappedReq := wrapperReplicateRequest{
ReplicateRequest: req,
AsyncMode: false,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return 0, err
}
@@ -54,3 +66,32 @@ func (d Disks) Replicate(ctx context.Context, req ReplicateRequest) (uint64, err
return result, nil
}
// ReplicateAsync creates an empty disk in chosen SEP and pool combination in async mode.
// Starts replication between chosen disk and newly created disk
// Note: only TATLIN type SEP are supported for replications between
func (d Disks) ReplicateAsync(ctx context.Context, req ReplicateRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/disks/replicate"
wrappedReq := wrapperReplicateRequest{
ReplicateRequest: req,
AsyncMode: true,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return "", err
}
var result string
if err := json.Unmarshal(res, &result); err != nil {
return "", err
}
return result, nil
}
+40 -1
View File
@@ -2,6 +2,7 @@ package disks
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -15,6 +16,12 @@ type ReplicationResumeRequest struct {
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
}
type wrapperReplicationResumeRequest struct {
ReplicationResumeRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// ReplicationResume resume suspended replication
func (d Disks) ReplicationResume(ctx context.Context, req ReplicationResumeRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -24,7 +31,12 @@ func (d Disks) ReplicationResume(ctx context.Context, req ReplicationResumeReque
url := "/cloudapi/disks/replicationResume"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
wrappedReq := wrapperReplicationResumeRequest{
ReplicationResumeRequest: req,
AsyncMode: false,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return false, err
}
@@ -36,3 +48,30 @@ func (d Disks) ReplicationResume(ctx context.Context, req ReplicationResumeReque
return result, nil
}
// ReplicationResumeAsync resumes suspended replication in async mode
func (d Disks) ReplicationResumeAsync(ctx context.Context, req ReplicationResumeRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/disks/replicationResume"
wrappedReq := wrapperReplicationResumeRequest{
ReplicationResumeRequest: req,
AsyncMode: true,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return "", err
}
var result string
if err := json.Unmarshal(res, &result); err != nil {
return "", err
}
return result, nil
}
+40 -1
View File
@@ -2,6 +2,7 @@ package disks
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -15,6 +16,12 @@ type ReplicationReverseRequest struct {
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
}
type wrapperReplicationReverseRequest struct {
ReplicationReverseRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// ReplicationReverse change role between disks replications
func (d Disks) ReplicationReverse(ctx context.Context, req ReplicationReverseRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -24,7 +31,12 @@ func (d Disks) ReplicationReverse(ctx context.Context, req ReplicationReverseReq
url := "/cloudapi/disks/replicationReverse"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
wrappedReq := wrapperReplicationReverseRequest{
ReplicationReverseRequest: req,
AsyncMode: false,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return false, err
}
@@ -36,3 +48,30 @@ func (d Disks) ReplicationReverse(ctx context.Context, req ReplicationReverseReq
return result, nil
}
// ReplicationReverseAsync changes role between disks replications in async mode
func (d Disks) ReplicationReverseAsync(ctx context.Context, req ReplicationReverseRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/disks/replicationReverse"
wrappedReq := wrapperReplicationReverseRequest{
ReplicationReverseRequest: req,
AsyncMode: true,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return "", err
}
var result string
if err := json.Unmarshal(res, &result); err != nil {
return "", err
}
return result, nil
}
+41 -1
View File
@@ -2,6 +2,7 @@ package disks
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -19,6 +20,12 @@ type ReplicationStartRequest struct {
TargetDiskID uint64 `url:"targetDiskId" json:"targetDiskId" validate:"required"`
}
type wrapperReplicationStartRequest struct {
ReplicationStartRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// ReplicationStart starts replication between two chosen disks. It's required for both disks to have same size to avoid replication conflicts
// Note: Source disk's SEP and target SEP supported only of TATLIN type.
func (d Disks) ReplicationStart(ctx context.Context, req ReplicationStartRequest) (bool, error) {
@@ -29,7 +36,12 @@ func (d Disks) ReplicationStart(ctx context.Context, req ReplicationStartRequest
url := "/cloudapi/disks/replicationStart"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
wrappedReq := wrapperReplicationStartRequest{
ReplicationStartRequest: req,
AsyncMode: false,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return false, err
}
@@ -41,3 +53,31 @@ func (d Disks) ReplicationStart(ctx context.Context, req ReplicationStartRequest
return result, nil
}
// ReplicationStartAsync starts replication between two chosen disks in async mode. It's required for both disks to have same size to avoid replication conflicts
// Note: Source disk's SEP and target SEP supported only of TATLIN type.
func (d Disks) ReplicationStartAsync(ctx context.Context, req ReplicationStartRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/disks/replicationStart"
wrappedReq := wrapperReplicationStartRequest{
ReplicationStartRequest: req,
AsyncMode: true,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return "", err
}
var result string
if err := json.Unmarshal(res, &result); err != nil {
return "", err
}
return result, nil
}
+40 -1
View File
@@ -2,6 +2,7 @@ package disks
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -15,6 +16,12 @@ type ReplicationStopRequest struct {
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
}
type wrapperReplicationStopRequest struct {
ReplicationStopRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// ReplicationStop remove replication between disks completely
func (d Disks) ReplicationStop(ctx context.Context, req ReplicationStopRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -24,7 +31,12 @@ func (d Disks) ReplicationStop(ctx context.Context, req ReplicationStopRequest)
url := "/cloudapi/disks/replicationStop"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
wrappedReq := wrapperReplicationStopRequest{
ReplicationStopRequest: req,
AsyncMode: false,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return false, err
}
@@ -36,3 +48,30 @@ func (d Disks) ReplicationStop(ctx context.Context, req ReplicationStopRequest)
return result, nil
}
// ReplicationStopAsync removes replication between disks completely in async mode
func (d Disks) ReplicationStopAsync(ctx context.Context, req ReplicationStopRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/disks/replicationStop"
wrappedReq := wrapperReplicationStopRequest{
ReplicationStopRequest: req,
AsyncMode: true,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return "", err
}
var result string
if err := json.Unmarshal(res, &result); err != nil {
return "", err
}
return result, nil
}
+40 -1
View File
@@ -2,6 +2,7 @@ package disks
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -15,6 +16,12 @@ type ReplicationSuspendRequest struct {
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
}
type wrapperReplicationSuspendRequest struct {
ReplicationSuspendRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// ReplicationSuspend pause replication with possibility to resume from pause moment
func (d Disks) ReplicationSuspend(ctx context.Context, req ReplicationSuspendRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -24,7 +31,12 @@ func (d Disks) ReplicationSuspend(ctx context.Context, req ReplicationSuspendReq
url := "/cloudapi/disks/replicationSuspend"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
wrappedReq := wrapperReplicationSuspendRequest{
ReplicationSuspendRequest: req,
AsyncMode: false,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return false, err
}
@@ -36,3 +48,30 @@ func (d Disks) ReplicationSuspend(ctx context.Context, req ReplicationSuspendReq
return result, nil
}
// ReplicationSuspendAsync pauses replication with possibility to resume from pause moment in async mode
func (d Disks) ReplicationSuspendAsync(ctx context.Context, req ReplicationSuspendRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/disks/replicationSuspend"
wrappedReq := wrapperReplicationSuspendRequest{
ReplicationSuspendRequest: req,
AsyncMode: true,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return "", err
}
var result string
if err := json.Unmarshal(res, &result); err != nil {
return "", err
}
return result, nil
}
+43 -1
View File
@@ -2,6 +2,7 @@ package disks
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -19,6 +20,12 @@ type ResizeRequest struct {
Size uint64 `url:"size" json:"size" validate:"required"`
}
type wrapperResizeRequest struct {
ResizeRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// Resize2 resize disk
// Returns 200 if disk is resized online, else will return 202,
// in that case please stop and start your machine after changing the disk size, for your changes to be reflected.
@@ -31,7 +38,12 @@ func (d Disks) Resize2(ctx context.Context, req ResizeRequest) (bool, error) {
url := "/cloudapi/disks/resize2"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
wrappedReq := wrapperResizeRequest{
ResizeRequest: req,
AsyncMode: false,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return false, err
}
@@ -43,3 +55,33 @@ func (d Disks) Resize2(ctx context.Context, req ResizeRequest) (bool, error) {
return result, nil
}
// Resize2Async resizes disk in async mode
// Returns 200 if disk is resized online, else will return 202,
// in that case please stop and start your machine after changing the disk size, for your changes to be reflected.
// This method will not be used for disks, assigned to "old" virtual machines. Only unassigned disks and disks, assigned with computes.
func (d Disks) Resize2Async(ctx context.Context, req ResizeRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/disks/resize2"
wrappedReq := wrapperResizeRequest{
ResizeRequest: req,
AsyncMode: true,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return "", err
}
var result string
if err := json.Unmarshal(res, &result); err != nil {
return "", err
}
return result, nil
}
+40 -1
View File
@@ -2,6 +2,7 @@ package disks
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -15,6 +16,12 @@ type RestoreRequest struct {
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
}
type wrapperRestoreRequest struct {
RestoreRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// Restore restores a deleted unattached disk from recycle bin
func (d Disks) Restore(ctx context.Context, req RestoreRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -24,7 +31,12 @@ func (d Disks) Restore(ctx context.Context, req RestoreRequest) (bool, error) {
url := "/cloudapi/disks/restore"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
wrappedReq := wrapperRestoreRequest{
RestoreRequest: req,
AsyncMode: false,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return false, err
}
@@ -36,3 +48,30 @@ func (d Disks) Restore(ctx context.Context, req RestoreRequest) (bool, error) {
return result, nil
}
// RestoreAsync restores a deleted unattached disk from recycle bin in async mode
func (d Disks) RestoreAsync(ctx context.Context, req RestoreRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/disks/restore"
wrappedReq := wrapperRestoreRequest{
RestoreRequest: req,
AsyncMode: true,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return "", err
}
var result string
if err := json.Unmarshal(res, &result); err != nil {
return "", err
}
return result, nil
}
+40 -1
View File
@@ -2,6 +2,7 @@ package disks
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -15,6 +16,12 @@ type ShareRequest struct {
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
}
type wrapperShareRequest struct {
ShareRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// Share shares data disk
func (d Disks) Share(ctx context.Context, req ShareRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -24,7 +31,12 @@ func (d Disks) Share(ctx context.Context, req ShareRequest) (bool, error) {
url := "/cloudapi/disks/share"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
wrappedReq := wrapperShareRequest{
ShareRequest: req,
AsyncMode: false,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return false, err
}
@@ -36,3 +48,30 @@ func (d Disks) Share(ctx context.Context, req ShareRequest) (bool, error) {
return result, nil
}
// ShareAsync shares data disk in async mode
func (d Disks) ShareAsync(ctx context.Context, req ShareRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/disks/share"
wrappedReq := wrapperShareRequest{
ShareRequest: req,
AsyncMode: true,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return "", err
}
var result string
if err := json.Unmarshal(res, &result); err != nil {
return "", err
}
return result, nil
}
+40 -1
View File
@@ -2,6 +2,7 @@ package disks
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -19,6 +20,12 @@ type SnapshotDeleteRequest struct {
Label string `url:"label" json:"label" validate:"required"`
}
type wrapperSnapshotDeleteRequest struct {
SnapshotDeleteRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// SnapshotDelete deletes a snapshot
func (d Disks) SnapshotDelete(ctx context.Context, req SnapshotDeleteRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -28,7 +35,12 @@ func (d Disks) SnapshotDelete(ctx context.Context, req SnapshotDeleteRequest) (b
url := "/cloudapi/disks/snapshotDelete"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
wrappedReq := wrapperSnapshotDeleteRequest{
SnapshotDeleteRequest: req,
AsyncMode: false,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return false, err
}
@@ -40,3 +52,30 @@ func (d Disks) SnapshotDelete(ctx context.Context, req SnapshotDeleteRequest) (b
return result, nil
}
// SnapshotDeleteAsync deletes a snapshot in async mode
func (d Disks) SnapshotDeleteAsync(ctx context.Context, req SnapshotDeleteRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/disks/snapshotDelete"
wrappedReq := wrapperSnapshotDeleteRequest{
SnapshotDeleteRequest: req,
AsyncMode: true,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return "", err
}
var result string
if err := json.Unmarshal(res, &result); err != nil {
return "", err
}
return result, nil
}
+39 -1
View File
@@ -2,6 +2,7 @@ package disks
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -23,6 +24,12 @@ type SnapshotRollbackRequest struct {
TimeStamp uint64 `url:"timestamp,omitempty" json:"timestamp,omitempty"`
}
type wrapperSnapshotRollbackRequest struct {
SnapshotRollbackRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// SnapshotRollback rollbacks an individual disk snapshot
func (d Disks) SnapshotRollback(ctx context.Context, req SnapshotRollbackRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -32,7 +39,12 @@ func (d Disks) SnapshotRollback(ctx context.Context, req SnapshotRollbackRequest
url := "/cloudapi/disks/snapshotRollback"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
wrappedReq := wrapperSnapshotRollbackRequest{
SnapshotRollbackRequest: req,
AsyncMode: false,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return false, err
}
@@ -43,5 +55,31 @@ func (d Disks) SnapshotRollback(ctx context.Context, req SnapshotRollbackRequest
}
return result, nil
}
// SnapshotRollbackAsync rollbacks an individual disk snapshot in async mode
func (d Disks) SnapshotRollbackAsync(ctx context.Context, req SnapshotRollbackRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/disks/snapshotRollback"
wrappedReq := wrapperSnapshotRollbackRequest{
SnapshotRollbackRequest: req,
AsyncMode: true,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return "", err
}
var result string
if err := json.Unmarshal(res, &result); err != nil {
return "", err
}
return result, nil
}
+40 -1
View File
@@ -2,6 +2,7 @@ package disks
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -15,6 +16,12 @@ type UnshareRequest struct {
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
}
type wrapperUnshareRequest struct {
UnshareRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// Unshare unshares data disk
func (d Disks) Unshare(ctx context.Context, req UnshareRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -24,7 +31,12 @@ func (d Disks) Unshare(ctx context.Context, req UnshareRequest) (bool, error) {
url := "/cloudapi/disks/unshare"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
wrappedReq := wrapperUnshareRequest{
UnshareRequest: req,
AsyncMode: false,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return false, err
}
@@ -36,3 +48,30 @@ func (d Disks) Unshare(ctx context.Context, req UnshareRequest) (bool, error) {
return result, nil
}
// UnshareAsync unshares data disk in async mode
func (d Disks) UnshareAsync(ctx context.Context, req UnshareRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/disks/unshare"
wrappedReq := wrapperUnshareRequest{
UnshareRequest: req,
AsyncMode: true,
}
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, wrappedReq)
if err != nil {
return "", err
}
var result string
if err := json.Unmarshal(res, &result); err != nil {
return "", err
}
return result, nil
}
+5
View File
@@ -17,6 +17,11 @@ type GetReservedIP struct {
// Field for specifying the ID of extnet whose reservation information we want to receive
// Required: false
ExtNetID uint64 `url:"extnetId,omitempty" json:"extnetId,omitempty"`
// Flag indicating whether the reserved IP can be auto-assigned
// Required: false
// Default: null
AutoAssignable interface{} `url:"auto_assignable,omitempty" json:"auto_assignable,omitempty" validate:"omitempty,isBool"`
}
// GetReservedIP gets information about reserved address or address poll as a slice of RecordReservedIP struct
+9 -8
View File
@@ -269,12 +269,13 @@ type RecordReservedIP struct {
}
type Reservations struct {
AccountID int `json:"account_id"`
ClientType string `json:"clientType"`
DomainName string `json:"domainname"`
Hostname string `json:"hostname"`
IP string `json:"ip"`
Mac string `json:"mac"`
Type string `json:"type"`
VMID int `json:"vmId"`
AccountID int `json:"account_id"`
ClientType string `json:"clientType"`
DomainName string `json:"domainname"`
Hostname string `json:"hostname"`
IP string `json:"ip"`
Mac string `json:"mac"`
Type string `json:"type"`
VMID int `json:"vmId"`
AutoAssignable bool `json:"auto_assignable"`
}
+6 -1
View File
@@ -247,6 +247,11 @@ type CreateRequest struct {
// Required: false
// Default: reset
WatchdogAction string `url:"watchdog_action,omitempty" json:"watchdog_action,omitempty" validate:"omitempty,watchdogAction"`
// Memory balloon mode. One of ["auto","legacy","none"]
// Required: false
// Default: "auto"
MemoryBalloonMode string `url:"memory_balloon_mode,omitempty" json:"memory_balloon_mode,omitempty" validate:"omitempty,memoryBalloonMode"`
}
// GetRAM returns RAM field values
@@ -260,7 +265,7 @@ func (r CreateRequest) GetRAM() map[string]uint64 {
type wrapperCreateRequest struct {
CreateRequest
AsyncMode bool `json:"asyncMode"`
AsyncMode bool `json:"async_mode"`
}
// Create creates KVM x86 VM based on specified OS image
+5
View File
@@ -129,6 +129,11 @@ type CreateBlankRequest struct {
// Required: false
// Default: reset
WatchdogAction string `url:"watchdog_action,omitempty" json:"watchdog_action,omitempty" validate:"omitempty,watchdogAction"`
// Memory balloon mode. One of ["auto","legacy","none"]
// Required: false
// Default: "auto"
MemoryBalloonMode string `url:"memory_balloon_mode,omitempty" json:"memory_balloon_mode,omitempty" validate:"omitempty,memoryBalloonMode"`
}
// GetRAM returns RAM field values
+3
View File
@@ -43,6 +43,9 @@ type ItemLocation struct {
// Is BRO enabled
BROEnabled bool `json:"bro_enabled"`
// Are VM Folders enabled
VMFoldersEnabled bool `json:"vm_folders_enabled"`
}
// List of locations
+2 -2
View File
@@ -22,9 +22,9 @@ type ListRequest struct {
// Required: false
Name string `url:"name,omitempty" json:"name,omitempty"`
// Find by rgId
// Find by account ID
// Required: false
RGID uint64 `url:"rgId,omitempty" json:"rgId,omitempty"`
AccountID uint64 `url:"account_id,omitempty" json:"account_id,omitempty"`
// Find by status
// Required: false
+2 -2
View File
@@ -26,8 +26,8 @@ type ItemPCIDevice struct {
// Name
Name string `json:"name"`
// Resource group ID
RGID uint64 `json:"rgId"`
// Account IDs
AccountIDs []uint64 `json:"account_ids"`
// Node ID
NodeID uint64 `json:"nodeId"`
-1
View File
@@ -2,7 +2,6 @@ package pcidevice
import (
"encoding/json"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/serialization"
)
-18
View File
@@ -45,24 +45,6 @@ func (lqp ListQoSPolicies) FilterByDescription(description string) ListQoSPolici
return lqp.FilterFunc(predicate)
}
// FilterByCreatedBy returns ListQoSPolicies with specified CreatedBy
func (lqp ListQoSPolicies) FilterByCreatedBy(createdBy string) ListQoSPolicies {
predicate := func(iqp ItemQoSPolicy) bool {
return iqp.CreatedBy == createdBy
}
return lqp.FilterFunc(predicate)
}
// FilterByUpdatedBy returns ListQoSPolicies with specified UpdatedBy
func (lqp ListQoSPolicies) FilterByUpdatedBy(updatedBy string) ListQoSPolicies {
predicate := func(iqp ItemQoSPolicy) bool {
return iqp.UpdatedBy == updatedBy
}
return lqp.FilterFunc(predicate)
}
// FilterFunc allows filtering ListQoSPolicies based on a user-specified predicate
func (lqp ListQoSPolicies) FilterFunc(predicate func(ItemQoSPolicy) bool) ListQoSPolicies {
var result ListQoSPolicies
-25
View File
@@ -10,7 +10,6 @@ var qosPolicies = ListQoSPolicies{
Name: "qos1",
Description: "some desc",
Status: "ENABLED",
CreatedBy: "user",
},
{
ID: 3,
@@ -18,7 +17,6 @@ var qosPolicies = ListQoSPolicies{
Name: "qos3",
Description: "some desc",
Status: "ENABLED",
CreatedBy: "anotheruser",
},
{
ID: 5,
@@ -26,8 +24,6 @@ var qosPolicies = ListQoSPolicies{
Name: "qos5",
Description: "some other desc",
Status: "DISABLED",
CreatedBy: "anotheruser",
UpdatedBy: "user",
},
},
EntryCount: 3,
@@ -74,24 +70,3 @@ func TestFilterByStatus(t *testing.T) {
t.Fatal("expected Status DISABLED, found: ", actual.Status)
}
}
func TestFilterByCreatedBy(t *testing.T) {
actual := qosPolicies.FilterByCreatedBy("anotheruser")
if len(actual.Data) != 2 {
t.Fatal("expected 2 found, actual: ", len(actual.Data))
}
for _, item := range actual.Data {
if item.CreatedBy != "anotheruser" {
t.Fatal("expected CreatedBy 'anotheruser', found: ", item.CreatedBy)
}
}
}
func TestFilterByUpdatedBy(t *testing.T) {
actual := qosPolicies.FilterByUpdatedBy("user").FindOne()
if actual.UpdatedBy != "user" {
t.Fatal("expected UpdatedBy 'user', found: ", actual.UpdatedBy)
}
}
+2 -26
View File
@@ -27,18 +27,6 @@ type ItemQoSPolicy struct {
// Status of the QoS policy
Status string `json:"status"`
// Created at (unix timestamp)
CreatedAt uint64 `json:"created_at"`
// Updated at (unix timestamp)
UpdatedAt uint64 `json:"updated_at"`
// Created by
CreatedBy string `json:"created_by"`
// Updated by
UpdatedBy string `json:"updated_by"`
// List of rules
Rules Rules `json:"rules"`
}
@@ -62,18 +50,6 @@ type RecordQoSPolicy struct {
// Status of the QoS policy
Status string `json:"status"`
// Created at (unix timestamp)
CreatedAt uint64 `json:"created_at"`
// Updated at (unix timestamp)
UpdatedAt uint64 `json:"updated_at"`
// Created by
CreatedBy string `json:"created_by"`
// Updated by
UpdatedBy string `json:"updated_by"`
// List of rules
Rules Rules `json:"rules"`
}
@@ -97,10 +73,10 @@ type Rule struct {
Protocol string `json:"protocol"`
// Priority Code Point (0-7). L2 marking
PCPTag uint64 `json:"pcp_tag"`
PCPTag *uint64 `json:"pcp_tag"`
// DSCP value (0-63). L3 marking
DSCPValue uint64 `json:"dscp_value"`
DSCPValue *uint64 `json:"dscp_value"`
// Source IP address
SrcIP string `json:"src_ip"`
-39
View File
@@ -1,39 +0,0 @@
package qospolicy
import "sort"
// SortByCreatedAt sorts ListQosPolicies by the CreatedAt field in ascending order
// If inverse param is set to true, the order is reversed
func (lqp ListQoSPolicies) SortByCreatedAt(inverse bool) ListQoSPolicies {
if len(lqp.Data) < 2 {
return lqp
}
sort.Slice(lqp.Data, func(i, j int) bool {
if inverse {
return lqp.Data[i].CreatedAt > lqp.Data[j].CreatedAt
}
return lqp.Data[i].CreatedAt < lqp.Data[j].CreatedAt
})
return lqp
}
// SortByUpdatedAt sorts ListQosPolicies by the UpdatedAt field in ascending order
// If inverse param is set to true, the order is reversed
func (lqp ListQoSPolicies) SortByUpdatedAt(inverse bool) ListQoSPolicies {
if len(lqp.Data) < 2 {
return lqp
}
sort.Slice(lqp.Data, func(i, j int) bool {
if inverse {
return lqp.Data[i].UpdatedAt > lqp.Data[j].UpdatedAt
}
return lqp.Data[i].UpdatedAt < lqp.Data[j].UpdatedAt
})
return lqp
}
+2 -2
View File
@@ -16,11 +16,11 @@ type UpdateRequest struct {
// New QoS policy name
// Required: false
Name string `url:"name,omitempty" json:"name,omitempty"`
Name *string `url:"name,omitempty" json:"name,omitempty"`
// New QoS policy description
// Required: false
Description string `url:"description,omitempty" json:"description,omitempty"`
Description *string `url:"description,omitempty" json:"description,omitempty"`
}
func (qp QoSPolicy) Update(ctx context.Context, req UpdateRequest) (*RecordQoSPolicy, error) {
+2
View File
@@ -27,6 +27,8 @@ type AccessGrantRequest struct {
}
// AccessGrant grants user or group access to the resource group as specified
//
// Deprecated: will be removed in SDK v1.17
func (r RG) AccessGrant(ctx context.Context, req AccessGrantRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
+2
View File
@@ -20,6 +20,8 @@ type AccessRevokeRequest struct {
}
// AccessRevoke revokes specified user or group access from the resource group
//
// Deprecated: will be removed in SDK v1.17
func (r RG) AccessRevoke(ctx context.Context, req AccessRevokeRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
+40
View File
@@ -0,0 +1,40 @@
package rg
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// AddACLAccessRequest adds ACL access to a resource group
type AddACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
AccessType string `url:"accesstype" json:"accesstype" validate:"required"`
Usernames []string `url:"usernames,omitempty" json:"usernames,omitempty"`
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
// AddACLAccess adds ACL access to a resource group.
func (r RG) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/rg/add_acl_access"
res, err := r.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 rg
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// DeleteACLAccessRequest deletes ACL access from a resource group
type DeleteACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
Usernames []string `url:"usernames,omitempty" json:"usernames,omitempty"`
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
// DeleteACLAccess deletes ACL access from a resource group.
func (r RG) DeleteACLAccess(ctx context.Context, req DeleteACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/rg/del_acl_access"
res, err := r.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
}
+44
View File
@@ -0,0 +1,44 @@
package rg
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// GetACLAccessRequest struct to get detailed information about ACL account in a resource group
type GetACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
}
// Get gets current configuration of the ACL access in a resource group as a RecordRGACLAccess struct
func (r RG) GetACLAccess(ctx context.Context, req GetACLAccessRequest) (*RecordRGACLAccess, error) {
res, err := r.GetACLAccessRaw(ctx, req)
if err != nil {
return nil, err
}
info := RecordRGACLAccess{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}
// GetACLAccessRaw gets current configuration of the ACL access in a resource group as an array of bytes
func (r RG) GetACLAccessRaw(ctx context.Context, req GetACLAccessRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/rg/get_acl_access"
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
return res, err
}
+38
View File
@@ -159,6 +159,44 @@ type RecordResourceGroup struct {
Computes []uint64 `json:"vms"`
}
// Detailed information about ACL Access in a resource group
type RecordRGACLAccess struct {
// Data
Data DataACL `json:"data"`
// Entry count
EntryCount uint64 `json:"entryCount"`
}
// Data ACL
type DataACL struct {
// RG ACL list
RGACLList []RGACL `json:"rgACL"`
// Account ACL list
AccountACL []AccountACL `json:"accountACL"`
}
// RG ACL info
type RGACL struct {
Right string `json:"right"`
GUID string `json:"guid"`
UserGroupID string `json:"userGroupId"`
Status string `json:"status"`
Type string `json:"type"`
Explicit bool `json:"explicit"`
}
// Account ACL info
type AccountACL struct {
Right string `json:"right"`
GUID string `json:"guid"`
UserGroupID string `json:"userGroupId"`
Status string `json:"status"`
Type string `json:"type"`
Explicit bool `json:"explicit"`
}
// Main information about resource group
type ItemResourceGroup struct {
//
+40
View File
@@ -0,0 +1,40 @@
package rg
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// UpdateACLAccessRequest updates ACL access in a resource group
type UpdateACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
AccessType string `url:"accesstype" json:"accesstype" validate:"required"`
Usernames []string `url:"usernames,omitempty" json:"usernames,omitempty"`
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
// UpdateACLAccess updates ACL access in a resource group.
func (r RG) UpdateACLAccess(ctx context.Context, req UpdateACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/rg/update_acl_access"
res, err := r.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
}
+3
View File
@@ -46,6 +46,9 @@ type ItemVGPU struct {
// Profile Reference
ProfileReference string `json:"profile_reference"`
// Profile Name
ProfileName string `json:"profile_name"`
// Split Mode
SplitMode string `json:"split_mode"`
+41 -1
View File
@@ -2,6 +2,7 @@ package vins
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -69,6 +70,11 @@ type CreateInAccountRequest struct {
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
}
type asyncWrapperCreateInAccountRequest struct {
CreateInAccountRequest
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
}
// CreateInAccount creates VINS in account level
func (v VINS) CreateInAccount(ctx context.Context, req CreateInAccountRequest) (uint64, error) {
err := validators.ValidateRequest(req)
@@ -78,7 +84,12 @@ func (v VINS) CreateInAccount(ctx context.Context, req CreateInAccountRequest) (
url := "/cloudapi/vins/createInAccount"
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
syncReq := asyncWrapperCreateInAccountRequest{
CreateInAccountRequest: req,
AsyncMode: false,
}
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, syncReq)
if err != nil {
return 0, err
}
@@ -90,3 +101,32 @@ func (v VINS) CreateInAccount(ctx context.Context, req CreateInAccountRequest) (
return result, nil
}
// CreateInAccount creates VINS in account level in async mode
func (v VINS) AsyncCreateInAccount(ctx context.Context, req CreateInAccountRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
asyncReq := asyncWrapperCreateInAccountRequest{
CreateInAccountRequest: req,
AsyncMode: true,
}
url := "/cloudapi/vins/createInAccount"
result, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, asyncReq)
if err != nil {
return "", err
}
var resp string
err = json.Unmarshal(result, &resp)
if err != nil {
return "", err
}
return resp, nil
}
+41 -1
View File
@@ -2,6 +2,7 @@ package vins
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -63,6 +64,11 @@ type CreateInRGRequest struct {
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
}
type asyncWrapperCreateInRgRequest struct {
CreateInRGRequest
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
}
// CreateInRG creates VINS in resource group level
func (v VINS) CreateInRG(ctx context.Context, req CreateInRGRequest) (uint64, error) {
err := validators.ValidateRequest(req)
@@ -72,7 +78,12 @@ func (v VINS) CreateInRG(ctx context.Context, req CreateInRGRequest) (uint64, er
url := "/cloudapi/vins/createInRG"
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
syncReq := asyncWrapperCreateInRgRequest{
CreateInRGRequest: req,
AsyncMode: false,
}
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, syncReq)
if err != nil {
return 0, err
}
@@ -84,3 +95,32 @@ func (v VINS) CreateInRG(ctx context.Context, req CreateInRGRequest) (uint64, er
return result, nil
}
// CreateInRG creates VINS in resource group level in async mode
func (v VINS) AsyncCreateInRG(ctx context.Context, req CreateInRGRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/vins/createInRG"
syncReq := asyncWrapperCreateInRgRequest{
CreateInRGRequest: req,
AsyncMode: true,
}
result, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, syncReq)
if err != nil {
return "", err
}
var resp string
err = json.Unmarshal(result, &resp)
if err != nil {
return "", err
}
return resp, nil
}
+39
View File
@@ -0,0 +1,39 @@
package vins
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// DisableRequest struct to disable VINS
type DisableRequest struct {
// VINS ID
// Required: true
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
}
// Disable disables VINS
func (v VINS) Disable(ctx context.Context, req DisableRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/vins/disable"
res, err := v.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
}
-62
View File
@@ -1,62 +0,0 @@
package vins
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// DisableEnableRequest struct to disable/enable VINS
type DisableEnableRequest struct {
// VINS ID
// Required: true
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
}
// Disable disables VINS
func (v VINS) Disable(ctx context.Context, req DisableEnableRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/vins/disable"
res, err := v.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
}
// Enable enables VINS
func (v VINS) Enable(ctx context.Context, req DisableEnableRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/vins/enable"
res, err := v.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
}
+78
View File
@@ -0,0 +1,78 @@
package vins
import (
"context"
"encoding/json"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// EnableRequest struct to enable VINS
type EnableRequest struct {
// VINS ID
// Required: true
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
}
type asyncWrapperEnableRequest struct {
EnableRequest
AsyncMode bool `url:"asyncMode"`
}
// Enable enables VINS
func (v VINS) Enable(ctx context.Context, req EnableRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/vins/enable"
syncReq := asyncWrapperEnableRequest{
EnableRequest: req,
AsyncMode: false,
}
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, syncReq)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
// Enable enables VINS by ID in async mode
func (v VINS) AsyncEnable(ctx context.Context, req EnableRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/vins/enable"
asyncReq := asyncWrapperEnableRequest{
EnableRequest: req,
AsyncMode: true,
}
result, err := v.client.DecortApiCall(ctx, http.MethodPost, url, asyncReq)
if err != nil {
return "", err
}
var resp string
err = json.Unmarshal(result, &resp)
if err != nil {
return "", err
}
return resp, nil
}
+3
View File
@@ -329,6 +329,9 @@ type ItemVNFInterface struct {
// QOS
QOS QOS `json:"qos"`
// List of QoS policies
QoSPolicies []uint64 `json:"qos_policies"`
// Target
Target string `json:"target"`
+41 -1
View File
@@ -2,6 +2,7 @@ package vins
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -15,6 +16,11 @@ type VNFDevRedeployRequest struct {
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
}
type asyncWrapperVNFDevRedeployRequest struct {
VNFDevRedeployRequest
AsyncMode bool `url:"asyncMode"`
}
// VNFDevRedeploy redeploys VINS VNFDevs
func (v VINS) VNFDevRedeploy(ctx context.Context, req VNFDevRedeployRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -24,7 +30,12 @@ func (v VINS) VNFDevRedeploy(ctx context.Context, req VNFDevRedeployRequest) (bo
url := "/cloudapi/vins/vnfdevRedeploy"
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
syncReq := asyncWrapperVNFDevRedeployRequest{
VNFDevRedeployRequest: req,
AsyncMode: false,
}
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, syncReq)
if err != nil {
return false, err
}
@@ -36,3 +47,32 @@ func (v VINS) VNFDevRedeploy(ctx context.Context, req VNFDevRedeployRequest) (bo
return result, nil
}
// VNFDevRedeploy redeploys VINS VNFDevs in async mode
func (v VINS) AsyncVNFDevRedeploy(ctx context.Context, req VNFDevRedeployRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/vins/vnfdevRedeploy"
asyncReq := asyncWrapperVNFDevRedeployRequest{
VNFDevRedeployRequest: req,
AsyncMode: true,
}
result, err := v.client.DecortApiCall(ctx, http.MethodPost, url, asyncReq)
if err != nil {
return "", err
}
var resp string
err = json.Unmarshal(result, &resp)
if err != nil {
return "", err
}
return resp, nil
}
+41 -1
View File
@@ -2,6 +2,7 @@ package vins
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -15,6 +16,11 @@ type VNFDevRestartRequest struct {
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
}
type asyncWrapperVNFDevRestartRequest struct {
VNFDevRestartRequest
AsyncMode bool `url:"asyncMode"`
}
// VNFDevRestart reboots VINSes primary VNF device
func (v VINS) VNFDevRestart(ctx context.Context, req VNFDevRestartRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -24,7 +30,12 @@ func (v VINS) VNFDevRestart(ctx context.Context, req VNFDevRestartRequest) (bool
url := "/cloudapi/vins/vnfdevRestart"
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
syncReq := asyncWrapperVNFDevRestartRequest{
VNFDevRestartRequest: req,
AsyncMode: false,
}
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, syncReq)
if err != nil {
return false, err
}
@@ -36,3 +47,32 @@ func (v VINS) VNFDevRestart(ctx context.Context, req VNFDevRestartRequest) (bool
return result, nil
}
// VNFDevRestart reboots VINSes primary VNF device in async mode
func (v VINS) AsyncVNFDevRestart(ctx context.Context, req VNFDevRestartRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/vins/vnfdevRestart"
asyncReq := asyncWrapperVNFDevRestartRequest{
VNFDevRestartRequest: req,
AsyncMode: true,
}
result, err := v.client.DecortApiCall(ctx, http.MethodPost, url, asyncReq)
if err != nil {
return "", err
}
var resp string
err = json.Unmarshal(result, &resp)
if err != nil {
return "", err
}
return resp, nil
}
+40
View File
@@ -0,0 +1,40 @@
package account
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// AddACLAccessRequest adds ACL access to an account
type AddACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
AccessType string `url:"accesstype" json:"accesstype" validate:"required"`
Usernames []string `url:"usernames,omitempty" json:"usernames,omitempty"`
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
// AddACLAccess adds ACL access to an account.
func (a Account) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/add_acl_access"
res, err := a.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
}
+2
View File
@@ -27,6 +27,8 @@ type AddUserRequest struct {
}
// AddUser gives a user access rights.
//
// Deprecated: will be removed in SDK v1.17
func (a Account) AddUser(ctx context.Context, req AddUserRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
+39
View File
@@ -0,0 +1,39 @@
package account
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// DelACLAccessRequest deletes ACL access from an account
type DelACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
Usernames []string `url:"usernames,omitempty" json:"usernames,omitempty"`
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
// DelACLAccess deletes ACL access from an account.
func (a Account) DeleteACLAccess(ctx context.Context, req DelACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/del_acl_access"
res, err := a.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
}
+2
View File
@@ -20,6 +20,8 @@ type DeleteUserRequest struct {
}
// DeleteUser revokes user access from the account
//
// Deprecated: will be removed in SDK v1.17
func (a Account) DeleteUser(ctx context.Context, req DeleteUserRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -3,9 +3,8 @@ package account
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
"strconv"
)
// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter
@@ -0,0 +1,40 @@
package account
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// UpdateACLAccessRequest updates ACL access in an account
type UpdateACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
AccessType string `url:"accesstype" json:"accesstype" validate:"required"`
Usernames []string `url:"usernames,omitempty" json:"usernames,omitempty"`
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
// UpdateACLAccess updates ACL access in an account.
func (a Account) UpdateACLAccess(ctx context.Context, req UpdateACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/update_acl_access"
res, err := a.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
}
+2
View File
@@ -27,6 +27,8 @@ type UpdateUserRequest struct {
}
// UpdateUser updates user access rights
//
// Deprecated: will be removed in SDK v1.17
func (a Account) UpdateUser(ctx context.Context, req UpdateUserRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
+3
View File
@@ -94,6 +94,9 @@ type ListRequest struct {
// Exclude audit lines from response
// Required: false
ExcludeAuditLines bool `url:"exclude_audit_lines,omitempty" json:"exclude_audit_lines,omitempty"`
// Public Session ID
PublicSessionID string `json:"public_session_id"`
}
// List gets audit records for the specified account object
+6
View File
@@ -38,6 +38,9 @@ type ItemAudit struct {
// User
User string `json:"user"`
// Public Session ID
PublicSessionID string `json:"public_session_id"`
// TTL
TTL string `json:"_ttl"`
}
@@ -93,6 +96,9 @@ type RecordAudit struct {
// User
User string `json:"user"`
// Public Session ID
PublicSessionID string `json:"public_session_id"`
// TTL
TTL string `json:"_ttl"`
@@ -0,0 +1,38 @@
package backup
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
type AbortDisksBackupRequest struct {
// Compute ID
// Required: true
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
}
// AbortDisksBackup aborts disks backup
func (b Backup) AbortDisksBackup(ctx context.Context, req AbortDisksBackupRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/backup/abort_disks_backup"
res, err := b.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,40 @@
package backup
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
type BackupDisksWithSpeedRequest struct {
// Compute ID
// Required: true
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
}
// Get backup disk list and speeds for a compute
func (b Backup) BackupDisksWithSpeed(ctx context.Context, req BackupDisksWithSpeedRequest) (ListDisksWithSpeed, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/backup/backup_disks_with_speed"
res, err := b.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return nil, err
}
result := make(ListDisksWithSpeed, 0)
err = json.Unmarshal(res, &result)
if err != nil {
return nil, err
}
return result, nil
}
@@ -22,6 +22,10 @@ type CreateDiskBackupRequest struct {
// Backup path
// Required: true
BackupPath string `url:"backupPath" json:"backupPath" validate:"required"`
// Backup speed in Mb/s. 0 means no limits. Applicable only for STARTED computes
// Required: false
Speed uint64 `url:"speed,omitempty" json:"speed,omitempty"`
}
type wrapperCreateDiskBackupRequest struct {
@@ -15,6 +15,10 @@ type Disk struct {
// Backup path
BackupPath string `url:"backupPath" json:"backupPath" validate:"required"`
// Backup speed in Mb/s. 0 means no limits. Applicable only for STARTED computes
// Required: false
Speed uint64 `url:"speed,omitempty" json:"speed,omitempty"`
}
// CreateDisksBackupRequest struct for creating disks backup
+40
View File
@@ -0,0 +1,40 @@
package backup
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
type InfoRequest struct {
// Compute ID
// Required: true
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
}
// Information about all backups running on the machine
func (b Backup) Info(ctx context.Context, req InfoRequest) (*TotalBackupsInfo, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/backup/info"
res, err := b.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return nil, err
}
result := TotalBackupsInfo{}
err = json.Unmarshal(res, &result)
if err != nil {
return nil, err
}
return &result, nil
}
+50
View File
@@ -29,3 +29,53 @@ type InfoRestoredDisk struct {
// RestoreDisksFromFile response
type ListInfoRestoredDisk []InfoRestoredDisk
// Main info about all backups running on the machine
type TotalBackupsInfo struct {
// Backup type
Type uint64 `json:"type"`
// Time elapsed, ms
TimeElapsedMs uint64 `json:"time_elapsed_ms"`
// Time remaining, ms
TimeRemainingMs uint64 `json:"time_remaining_ms"`
// Total data size, bytes
DataTotalBytes uint64 `json:"data_total_bytes"`
// Processed data size, bytes
DataProcessedBytes uint64 `json:"data_processed_bytes"`
// Remaining data size, bytes
DataRemainingBytes uint64 `json:"data_remaining_bytes"`
// Total memory size, bytes
MemTotalBytes uint64 `json:"mem_total_bytes"`
// Processed memory size, bytes
MemProcessedBytes uint64 `json:"mem_processed_bytes"`
// Remaining memory size, bytes
MemRemainingBytes uint64 `json:"mem_remaining_bytes"`
// Total file size, bytes
FileTotalBytes uint64 `json:"file_total_bytes"`
// Processed file size, bytes
FileProcessedBytes uint64 `json:"file_processed_bytes"`
// Remaining file size, bytes
FileRemainingBytes uint64 `json:"file_remaining_bytes"`
}
// List of disk names and backup speed
type ListDisksWithSpeed []DiskWithSpeed
type DiskWithSpeed struct {
// Device name
Device string `json:"device"`
// Backup speed limit in MB/s; 0 means unlimited
Speed uint64 `json:"speed"`
}
@@ -0,0 +1,46 @@
package backup
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
type SetBackupSpeedRequest struct {
// Compute ID
// Required: true
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
// Device to set backup speed ongit
// Required: true
Device string `url:"device" json:"device" validate:"required"`
// New backup speed in Mb/s. 0 means no limits
// Required: true
Speed uint64 `url:"speed" json:"speed" validate:"required"`
}
// Set speed limit for device backup on ruining machine
func (b Backup) SetBackupSpeed(ctx context.Context, req SetBackupSpeedRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/backup/set_backup_speed"
res, err := b.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
}
+40
View File
@@ -0,0 +1,40 @@
package compute
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// AddACLAccessRequest adds ACL access to a vm
type AddACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
AccessType string `url:"accesstype" json:"accesstype" validate:"required"`
Usernames []string `url:"usernames,omitempty" json:"usernames,omitempty"`
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
// AddACLAccess adds ACL access to a vm.
func (c Compute) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/add_acl_access"
res, err := c.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 compute
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// DeleteACLAccessRequest deletes ACL access from a vm
type DeleteACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
Usernames []string `url:"usernames,omitempty" json:"usernames,omitempty"`
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
// DeleteACLAccess deletes ACL access from a vm.
func (c Compute) DeleteACLAccess(ctx context.Context, req DeleteACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/del_acl_access"
res, err := c.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
}
+44
View File
@@ -0,0 +1,44 @@
package compute
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// GetACLAccessRequest struct to get detailed information about ACL account in a vm
type GetACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
}
// Get gets current configuration of the ACL access in a vm as a RecordRGACLAccess struct
func (c Compute) GetACLAccess(ctx context.Context, req GetACLAccessRequest) (*RecordComputeACLAccess, error) {
res, err := c.GetACLAccessRaw(ctx, req)
if err != nil {
return nil, err
}
info := RecordComputeACLAccess{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}
// GetACLAccessRaw gets current configuration of the ACL access in a vm as an array of bytes
func (c Compute) GetACLAccessRaw(ctx context.Context, req GetACLAccessRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/get_acl_access"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
return res, err
}
-4
View File
@@ -18,10 +18,6 @@ type ListVGPURequest struct {
// Required: false
GPUID uint64 `url:"gpuId,omitempty" json:"gpuId,omitempty"`
// Find by type
// Required: false
Type string `url:"type,omitempty" json:"type,omitempty"`
// Find by status
// Required: false
Status string `url:"status,omitempty" json:"status,omitempty"`
+63
View File
@@ -816,6 +816,9 @@ type InfoCompute struct {
// Manager type
ManagerType string `json:"managerType"`
// Memory balloon mode
MemoryBalloonMode string `json:"memory_balloon_mode"`
// Migration job
MigrationJob uint64 `json:"migrationjob"`
@@ -1109,6 +1112,9 @@ type RecordCompute struct {
// Manager type
ManagerType string `json:"managerType"`
// Memory balloon mode
MemoryBalloonMode string `json:"memory_balloon_mode"`
// Migration job
MigrationJob uint64 `json:"migrationjob"`
@@ -1248,6 +1254,57 @@ type RecordCompute struct {
_ uint64 `json:"nodeId"`
}
// Detailed information about ACL Access in a compute
type RecordComputeACLAccess struct {
// Data
Data DataACL `json:"data"`
// Entry count
EntryCount uint64 `json:"entryCount"`
}
// Data ACL
type DataACL struct {
// RG ACL list
RGACLList []RGACL `json:"rgACL"`
// Account ACL list
AccountACLList []AccountACL `json:"accountACL"`
// Compute ACL list
ComputeACLList []ComputeACL `json:"computeACL"`
}
// RG ACL info
type RGACL struct {
Right string `json:"right"`
GUID string `json:"guid"`
UserGroupID string `json:"userGroupId"`
Status string `json:"status"`
Type string `json:"type"`
Explicit bool `json:"explicit"`
}
// Account ACL info
type AccountACL struct {
Right string `json:"right"`
GUID string `json:"guid"`
UserGroupID string `json:"userGroupId"`
Status string `json:"status"`
Type string `json:"type"`
Explicit bool `json:"explicit"`
}
// Compute ACL info
type ComputeACL struct {
Right string `json:"right"`
GUID string `json:"guid"`
UserGroupID string `json:"userGroupId"`
Status string `json:"status"`
Type string `json:"type"`
Explicit bool `json:"explicit"`
}
// SnapRecordCompute is RecordCompute but without the SnapSets field
type SnapRecordCompute struct {
// Account ID
@@ -1705,6 +1762,9 @@ type ItemVGPU struct {
// Profile Reference
ProfileReference string `json:"profile_reference"`
// Profile Name
ProfileName string `json:"profile_name"`
// Split Mode
SplitMode string `json:"split_mode"`
@@ -2123,6 +2183,9 @@ type ItemShadowComputeInterface struct {
// QOS
QOS QOS `json:"qos"`
// List of QoS Policy IDs
QoSPolicies []uint64 `json:"qos_policies"`
// Libvirt settings
LibvirtSettings LibvirtSettings `json:"libvirtSettings"`
+4 -3
View File
@@ -5,6 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
@@ -95,7 +96,7 @@ type NetAttachRequest struct {
type wrapperNetAttachRequest struct {
NetAttachRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
}
// NetAttach attaches network to compute and gets info about network
@@ -112,7 +113,7 @@ func (c Compute) NetAttach(ctx context.Context, req NetAttachRequest) (*RecordNe
url := "/cloudbroker/compute/netAttach"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return nil, err
}
@@ -141,7 +142,7 @@ func (c Compute) NetAttachAsync(ctx context.Context, req NetAttachRequest) (stri
url := "/cloudbroker/compute/netAttach"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return "", err
}
+5
View File
@@ -83,6 +83,11 @@ type UpdateRequest struct {
// Required: false
// Default: reset
WatchdogAction string `url:"watchdog_action,omitempty" json:"watchdog_action,omitempty" validate:"omitempty,watchdogAction"`
// Memory balloon mode. One of ["auto","legacy","none"]
// Required: false
// Default: "auto"
MemoryBalloonMode string `url:"memory_balloon_mode,omitempty" json:"memory_balloon_mode,omitempty" validate:"omitempty,memoryBalloonMode"`
}
// Update updates some properties of the compute
@@ -0,0 +1,40 @@
package compute
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// UpdateACLAccessRequest updates ACL access in a vm
type UpdateACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
AccessType string `url:"accesstype" json:"accesstype" validate:"required"`
Usernames []string `url:"usernames,omitempty" json:"usernames,omitempty"`
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
// UpdateACLAccess updates ACL access in a vm.
func (c Compute) UpdateACLAccess(ctx context.Context, req UpdateACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/update_acl_access"
res, err := c.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
}
Loaded 100 of 179 files, more files were not shown because too many files have changed in this diff. Show more