Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5825bdfa9e | ||
|
|
70edc100d5 | ||
|
|
025a1274f4 | ||
|
|
dca445b69a | ||
|
|
2c7f0d29df | ||
|
|
4c05d94552 | ||
|
|
dbd979b6f3 | ||
|
|
fe3c7bf63a |
No files matched your search
+72
-179
@@ -1,209 +1,102 @@
|
|||||||
## Version 16.0.0
|
## Version 16.8.0
|
||||||
|
|
||||||
Метод `ConfigFieldEdit` в cloudbroker/sep стал deprecated и в следующих версиях будет удалён
|
|
||||||
|
### Deprecated
|
||||||
|
|
||||||
|
Перечисленные методы будут удалены в `v17.0`
|
||||||
|
|
||||||
|
| Метод | 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/CreateTemplate` | :heavy_check_mark: | :heavy_check_mark: |
|
||||||
|
| `compute/CreateTemplateFromBlank` | :heavy_check_mark: | :heavy_check_mark: |
|
||||||
|
| `compute/DiskQOS` | :heavy_check_mark: | :heavy_check_mark: |
|
||||||
|
| `compute/Migrate` | :x: | :heavy_check_mark: |
|
||||||
|
| `compute/MigrateAbort` | :x: | :heavy_check_mark: |
|
||||||
|
| `compute/MigrateStorage` | :x: | :heavy_check_mark: |
|
||||||
|
| `compute/MigrateStorageAbort` | :x: | :heavy_check_mark: |
|
||||||
|
| `compute/MigrateStorageCleanUp` | :x: | :heavy_check_mark: |
|
||||||
|
| `compute/MigrateStorageInfo` | :x: | :heavy_check_mark: |
|
||||||
|
| `compute/MigrateStorageList` | :x: | :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: |
|
||||||
|
| `disks/FromPlatformDisk` | :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: |
|
||||||
|
| `apiaccess/userList` | :x: | :heavy_check_mark: |
|
||||||
|
|
||||||
|
|
||||||
### Добавлено
|
### Добавлено
|
||||||
|
|
||||||
#### Общее
|
#### apiaccess
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-991 | Допустимые значения `vgpu` и `pcidevice` в валидатор возможностей гипервизора ComputeFeatures |
|
| BGOS-1123 | Вычисляемое поле `BasisMPM` в структуру ответа `CloudBrokerEndpoints` в cloudbroker/apiaccess |
|
||||||
|
|
||||||
#### account
|
#### basismpm
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-986 | Вычисляемое поле `EnableDefaultGateway` в структуру ответа `ItemVINS` в cloudbroker/account и cloudapi/account |
|
| BGOS-1123 | Структура запроса `StartRequest` и метод `Start` в cloudbroker/basismpm |
|
||||||
| BGOS-989 | Вычисляемые поля `Starting`, `Stopping`, `Paused`, `Pausing`, `Merge`, `Migrating`, `MigratingIn`, `MigratingOut`, `Down`, `Scheduled`, `BackupStopped`, `BackupRunning`, `Snapcreate`, `Cloning` и `Rollback` в структуры ответа `Computes` и `RGComputes` в cloudapi/account |
|
| BGOS-1123 | Структура запроса `StatusRequest` и метод `Status` в cloudbroker/basismpm |
|
||||||
| BGOS-989 | Вычисляемые поля `Starting`, `Stopping`, `Paused`, `Pausing`, `Merge`, `Migrating`, `MigratingIn`, `MigratingOut`, `Down`, `Scheduled`, `BackupStopped`, `BackupRunning`, `Snapcreate`, `Cloning` и `Rollback` в структуру ответа `Computes` в cloudbroker/account |
|
| BGOS-1123 | Структура запроса `StopRequest` и метод `Stop` в cloudbroker/basismpm |
|
||||||
|
| BGOS-1123 | Структура запроса `UpdateRequest` и метод `Update` в cloudbroker/basismpm |
|
||||||
|
| BGOS-1123 | Структуры ответа `MemInfo` и `RecordBasisMPM` в cloudbroker/basismpm |
|
||||||
|
|
||||||
#### 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 |
|
|
||||||
|
|
||||||
#### vins
|
|
||||||
| Идентификатор задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| BGOS-986 | Вычисляемое поле `EnableDefaultGateway` в структуру ответа `ItemVINS` в cloudapi/vins |
|
|
||||||
|
|
||||||
#### vgpu
|
|
||||||
| Идентификатор задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| 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
|
#### image
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-975 | Методы `ComputeCISet` и `ComputeCIUnset` из cloudbroker/image |
|
| BGOS-1124 | Структура запроса `CreateFromDiskRequest` и методы `CreateFromDisk` и `CreateFromDiskAsync` в cloudapi/image |
|
||||||
|
| BGOS-1124 | Структура запроса `CreateFromDiskRequest` и методы `CreateFromDisk` и `CreateFromDiskAsync` в cloudbroker/image |
|
||||||
|
|
||||||
#### rg
|
#### compute
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-975 | Метод `Audits` из cloudapi/rg и cloudbroker/rg |
|
| BGOS-1126 | Вычисляемые поля `PreviousReservesComputeResources` и `TakeOverResources` в структуру ответа `Resolution` в cloudbroker/compute |
|
||||||
|
| BGOS-1126 | Опциональное поле `TakeOverResources` в структуру запроса `MigrateV2ResolveRequest` в cloudbroker/compute |
|
||||||
|
| BGOS-1126 | Вычисляемое поле `Message` в структуру ответа `MigrateV2ResolveRecord` в cloudbroker/compute |
|
||||||
|
| BGOS-1126 | Вычисляемые поля `DisksCompleted`, `CompletedDisks`, `DisksTotal` и `CurrentDisk` в структуру ответа `ProgressDisks` в cloudbroker/compute |
|
||||||
|
| BGOS-1126 | Структуры ответа `CompletedDisk` и `CurrentDisk` в cloudbroker/compute |
|
||||||
|
|
||||||
#### sep
|
|
||||||
|
#### zone
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-975 | Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke` и `AccessRevokeToPool` из cloudbroker/sep |
|
| BGOS-1127 | Вычисляемое поле `DRSPortSeed` в структуры ответа `ItemZone` и `RecordZone` в cloudbroker/zone |
|
||||||
|
|
||||||
#### user
|
|
||||||
|
### Изменено
|
||||||
|
|
||||||
|
#### compute
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-975 | Метод `IsValidInviteUserToken` из cloudapi/user |
|
| BGOS-1126 | Тип вычисляемого поля `UpdatedAt` с `uint64` на `float64` в структуре ответа `Observation` в cloudbroker/compute |
|
||||||
| BGOS-975 | Метод `GetAudit` из cloudapi/user и cloudbroker/user |
|
| BGOS-1126 | Тип вычисляемых полей `SampledAt`, `Percent` и `BytesPerSecond` с `uint64` на `float64` в структуре ответа `Memory` в cloudbroker/compute |
|
||||||
| BGOS-988 | Структуры `CSs` и `VMs` из структуры ответа `BriefResources` из cloudapi/user |
|
| BGOS-1126 | Тип вычисляемых полей `SampledAt`, `Percent` и `BytesPerSecond` с `uint64` на `float64` в структуре ответа `ProgressDisks` в cloudbroker/compute |
|
||||||
| BGOS-988 | Вычисляемое поле `Enabled` из структур ответов `Accounts` и `RGs` из cloudapi/user |
|
| BGOS-1126 | Тип вычисляемых полей `SampledAt`, `Percent` и `BytesPerSecond` с `uint64` на `float64` в структуре ответа `SystemDisk` в cloudbroker/compute |
|
||||||
|
| BGOS-1126 | Тип опционального поля `Storage` со `Storage` на `*Storage` в структуре запроса `MigrateV2Request` в cloudbroker/compute |
|
||||||
|
| BGOS-1126 | Тип поля `Targets` с опционального на обязательный в структуре запроса `Storage` в cloudbroker/compute |
|
||||||
|
| BGOS-1126 | Тэги `url` и `json` поля `Targets` с `targets` на `targets` в структуре запроса `Storage` в cloudbroker/compute |
|
||||||
|
|
||||||
#### vins
|
#### disks
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-975 | Метод `Audits` из cloudapi/vins и cloudbroker/vins |
|
| BGOS-1128 | Тэги `url` и `json` поля `KeepCurrentIOTune` с `keep_current_iot` на `keep_current_iotune` в структуре запроса `ChangeDiskStoragePolicyRequest` в cloudbroker/disks |
|
||||||
|
| BGOS-1128 | Тэги `url` и `json` поля `KeepCurrentIOTune` с `keep_current_iot` на `keep_current_iotune` в структуре запроса `ChangeDiskStoragePolicyRequest` в cloudapi/disks |
|
||||||
|
|
||||||
#### vgpu
|
#### client sdk
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-980 | Опциональные поля `RGID` и `Allocate` из структуры запроса `CreateRequest` в cloudbroker/vgpu |
|
| BGOS-1134 | При получении от сервера ответа с HTTP-кодом ошибки клиенты `DecortClient`, `LegacyDecortClient` и `BVSDecortClient` теперь возвращают ошибку типа `HTTPError` с полями `StatusCode` и `Body`. Для проверки статусов добавлены функции `IsNotFound` и `HasStatusCode` |
|
||||||
| 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 |
|
#### client sdk
|
||||||
|
| Идентификатор задачи | Описание |
|
||||||
|
| --- | --- |
|
||||||
|
| BGOS-1135 | Исправлена ошибка в сообщении об ошибке при отсутствии времени истечения токена в клиенте |
|
||||||
@@ -126,6 +126,7 @@ go get -u repository.basistech.ru/BASIS/dynamix-golang-sdk/v16
|
|||||||
- `Trunk` - получение информации о транковых портах;
|
- `Trunk` - получение информации о транковых портах;
|
||||||
- `VFPool` - управление пулом виртуальных сетевых функций;
|
- `VFPool` - управление пулом виртуальных сетевых функций;
|
||||||
- `VINS` - управление виртуальными изолированными сетями;
|
- `VINS` - управление виртуальными изолированными сетями;
|
||||||
|
- `VMFolder` – управление директориями ВМ;
|
||||||
- `VGPU` - управление виртуальными графическими процессорами;
|
- `VGPU` - управление виртуальными графическими процессорами;
|
||||||
- `Zone` - управление зонами.
|
- `Zone` - управление зонами.
|
||||||
|
|
||||||
@@ -138,6 +139,7 @@ go get -u repository.basistech.ru/BASIS/dynamix-golang-sdk/v16
|
|||||||
- `Audit` - получение информации о событиях системы;
|
- `Audit` - получение информации о событиях системы;
|
||||||
- `APIAccess` - управление доступом к API и его объектам;
|
- `APIAccess` - управление доступом к API и его объектам;
|
||||||
- `Backup` - управление резервным копированием;
|
- `Backup` - управление резервным копированием;
|
||||||
|
- `BasisMPM` - управление в случае нехватки памяти;
|
||||||
- `BService` - управление группами виртуальных машин (computes);
|
- `BService` - управление группами виртуальных машин (computes);
|
||||||
- `Compute` - управление виртуальными машинами (индивидуально);
|
- `Compute` - управление виртуальными машинами (индивидуально);
|
||||||
- `Disks` - управление виртуальными дисками;
|
- `Disks` - управление виртуальными дисками;
|
||||||
@@ -159,13 +161,15 @@ go get -u repository.basistech.ru/BASIS/dynamix-golang-sdk/v16
|
|||||||
- `RG` - управление ресурсными группами аккаунта;
|
- `RG` - управление ресурсными группами аккаунта;
|
||||||
- `Security group` – управление группами безопасности;
|
- `Security group` – управление группами безопасности;
|
||||||
- `SEP` - управление storage endpoint (sep);
|
- `SEP` - управление storage endpoint (sep);
|
||||||
|
- `Session` - получение информации о сессиях;
|
||||||
- `Storage policy` – управление политиками хранения;
|
- `Storage policy` – управление политиками хранения;
|
||||||
- `Tasks` - получение информации о ходе выполнения асинхронных задач (например, создание кластера);
|
- `Tasks` - получение информации о ходе выполнения асинхронных задач (например, создание кластера);
|
||||||
- `Trunk` - управление транковыми портами;
|
- `Trunk` - управление транковыми портами;
|
||||||
- `User` - управление пользователями (индивидуально);
|
- `User` - управление пользователями (индивидуально);
|
||||||
- `VGPU` - управление виртуальными графическими процессорами;
|
- `VGPU` - управление виртуальными графическими процессорами;
|
||||||
- `VFPool` - управление пулом виртуальных сетевых функций;
|
- `VFPool` - управление пулом виртуальных сетевых функций;
|
||||||
- `VINS` - управление виртуальными изолированными сетями.
|
- `VINS` - управление виртуальными изолированными сетями;
|
||||||
|
- `VMFolder` – управление директориями ВМ;
|
||||||
- `Zone` - управление зонами.
|
- `Zone` - управление зонами.
|
||||||
|
|
||||||
### SDN
|
### SDN
|
||||||
@@ -341,6 +345,7 @@ func main() {
|
|||||||
- `pkg/cloudapi/trunk` - для `Trunk`
|
- `pkg/cloudapi/trunk` - для `Trunk`
|
||||||
- `pkg/cloudapi/vfpool` - для `VFPool`
|
- `pkg/cloudapi/vfpool` - для `VFPool`
|
||||||
- `pkg/cloudapi/vins` - для `VINS`
|
- `pkg/cloudapi/vins` - для `VINS`
|
||||||
|
- `pkg/cloudapi/vmfolder` - для `VMFolder`
|
||||||
- `pkg/cloudapi/vgpu` - для `VGPU`
|
- `pkg/cloudapi/vgpu` - для `VGPU`
|
||||||
- `pkg/cloudapi/zone` - для `Zone`
|
- `pkg/cloudapi/zone` - для `Zone`
|
||||||
- **cloudbroker**:
|
- **cloudbroker**:
|
||||||
@@ -348,6 +353,7 @@ func main() {
|
|||||||
- `pkg/cloudbroker/audit` - для `Audit`
|
- `pkg/cloudbroker/audit` - для `Audit`
|
||||||
- `pkg/cloudbroker/apiaccess` - для `APIAccess`
|
- `pkg/cloudbroker/apiaccess` - для `APIAccess`
|
||||||
- `pkg/cloudbroker/backup` - для `Backup`
|
- `pkg/cloudbroker/backup` - для `Backup`
|
||||||
|
- `pkg/cloudbroker/basismpm` - для `BasisMPM`
|
||||||
- `pkg/cloudbroker/bservice` - для `Basic Service`
|
- `pkg/cloudbroker/bservice` - для `Basic Service`
|
||||||
- `pkg/cloudbroker/compute` - для `Compute`
|
- `pkg/cloudbroker/compute` - для `Compute`
|
||||||
- `pkg/cloudbroker/disks` - для `Disks`
|
- `pkg/cloudbroker/disks` - для `Disks`
|
||||||
@@ -369,6 +375,7 @@ func main() {
|
|||||||
- `pkg/cloudbroker/rg` - для `RG`
|
- `pkg/cloudbroker/rg` - для `RG`
|
||||||
- `pkg/cloudbroker/secgroup` - для `Security group`
|
- `pkg/cloudbroker/secgroup` - для `Security group`
|
||||||
- `pkg/cloudbroker/sep` - для `SEP`
|
- `pkg/cloudbroker/sep` - для `SEP`
|
||||||
|
- `pkg/cloudbroker/session` - для `Session`
|
||||||
- `pkg/cloudbroker/stpolicy` - для `Storage policy`
|
- `pkg/cloudbroker/stpolicy` - для `Storage policy`
|
||||||
- `pkg/cloudbroker/tasks` - для `Tasks`
|
- `pkg/cloudbroker/tasks` - для `Tasks`
|
||||||
- `pkg/cloudbroker/trunk` - для `Trunk`
|
- `pkg/cloudbroker/trunk` - для `Trunk`
|
||||||
@@ -376,8 +383,9 @@ func main() {
|
|||||||
- `pkg/cloudbroker/vgpu` - для `VGPU`
|
- `pkg/cloudbroker/vgpu` - для `VGPU`
|
||||||
- `pkg/cloudbroker/vfpool` - для `VFPool`
|
- `pkg/cloudbroker/vfpool` - для `VFPool`
|
||||||
- `pkg/cloudbroker/vins` - для `VINS`
|
- `pkg/cloudbroker/vins` - для `VINS`
|
||||||
|
- `pkg/cloudbroker/vmfolder` - для `VMFolder`
|
||||||
- `pkg/cloudbroker/zone` - для `Zone`
|
- `pkg/cloudbroker/zone` - для `Zone`
|
||||||
- **sdn**:
|
- **sdn**:
|
||||||
- `pkg/sdn/acsgroups` - для `Access groups`
|
- `pkg/sdn/acsgroups` - для `Access groups`
|
||||||
- `pkg/sdn/adrspools` - для `Address pool`
|
- `pkg/sdn/adrspools` - для `Address pool`
|
||||||
- `pkg/sdn/defsecpolicies` - для `DefaultSecurityPolicies`
|
- `pkg/sdn/defsecpolicies` - для `DefaultSecurityPolicies`
|
||||||
@@ -572,6 +580,7 @@ func main() {
|
|||||||
- `.RG()` - для работы с `RG`
|
- `.RG()` - для работы с `RG`
|
||||||
- `.SecurityGroup()` - для работы с `Security Group`
|
- `.SecurityGroup()` - для работы с `Security Group`
|
||||||
- `.SEP()` - для работы с `SEP`
|
- `.SEP()` - для работы с `SEP`
|
||||||
|
- `.Session()` - для работы с `Session`
|
||||||
- `.StPolicy()` - для работы с `Storage Policy`
|
- `.StPolicy()` - для работы с `Storage Policy`
|
||||||
- `.Tasks()` - для работы с `Tasks`
|
- `.Tasks()` - для работы с `Tasks`
|
||||||
- `.Trunk()` - для работы с `Trunk`
|
- `.Trunk()` - для работы с `Trunk`
|
||||||
@@ -954,7 +963,7 @@ func main() {
|
|||||||
- ToString(): строковое представление результата выполнения задачи
|
- ToString(): строковое представление результата выполнения задачи
|
||||||
- ID() и Name(): получение ID и имени созданного в результате выполнения задачи ресурса
|
- ID() и Name(): получение ID и имени созданного в результате выполнения задачи ресурса
|
||||||
- ToMaps(): получение списка карт, содержащих информацию о дисках, восстановленных в результате выполнения задачи.
|
- ToMaps(): получение списка карт, содержащих информацию о дисках, восстановленных в результате выполнения задачи.
|
||||||
Все методы оборудованы возвратом ошибок. Непустая ошибка означает, что из поля Result нельзя получить информацию, которую предоставляет метод.
|
Все методы оборудованы возвратом ошибок. Непустая ошибка означает, что из поля Result нельзя получить информацию, которую предоставляет метод.
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package main
|
package main
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ func (dc *DecortClient) getToken(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if resp.StatusCode != 200 {
|
if resp.StatusCode != 200 {
|
||||||
return fmt.Errorf("cannot get token: %s", tokenBytes)
|
return newHTTPError("cannot get token", resp.StatusCode, tokenBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// save token in config
|
// save token in config
|
||||||
@@ -297,8 +297,7 @@ func (dc *DecortClient) do(req *http.Request, ctype string) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle errors with status code other than 200
|
// handle errors with status code other than 200
|
||||||
err = fmt.Errorf("%s", respBytes)
|
return nil, newHTTPError("could not execute request", resp.StatusCode, respBytes)
|
||||||
return nil, fmt.Errorf("could not execute request: %w", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// isConnectionError checks if given error falls within specific and associated connection errors
|
// isConnectionError checks if given error falls within specific and associated connection errors
|
||||||
@@ -444,7 +443,7 @@ func getTokenExp(token string) (time.Time, error) {
|
|||||||
|
|
||||||
exp, ok := claims["exp"]
|
exp, ok := claims["exp"]
|
||||||
if !ok {
|
if !ok {
|
||||||
return time.Time{}, fmt.Errorf("exp time bot found")
|
return time.Time{}, fmt.Errorf("exp time not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
expTime := time.Unix(int64(exp.(float64)), 0)
|
expTime := time.Unix(int64(exp.(float64)), 0)
|
||||||
|
|||||||
+7
-13
@@ -5,7 +5,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -127,7 +126,7 @@ func (bdc *BVSDecortClient) DecortApiCall(ctx context.Context, method, url strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get token and retry in case of access denied
|
// get token and retry in case of access denied
|
||||||
if err.Error() == "access is denied" {
|
if HasStatusCode(err, http.StatusUnauthorized) {
|
||||||
_, err = bdc.GetToken(ctx)
|
_, err = bdc.GetToken(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -193,7 +192,7 @@ func (bdc *BVSDecortClient) DecortApiCallCtype(ctx context.Context, method, url,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get token and retry in case of access denied
|
// get token and retry in case of access denied
|
||||||
if err.Error() == "access is denied" {
|
if HasStatusCode(err, http.StatusUnauthorized) {
|
||||||
_, err = bdc.GetToken(ctx)
|
_, err = bdc.GetToken(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -243,7 +242,7 @@ func (bdc *BVSDecortClient) DecortApiCallMP(ctx context.Context, method, url str
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get token and retry in case of access denied
|
// get token and retry in case of access denied
|
||||||
if err.Error() == "access is denied" {
|
if HasStatusCode(err, http.StatusUnauthorized) {
|
||||||
_, err = bdc.GetToken(ctx)
|
_, err = bdc.GetToken(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -287,7 +286,7 @@ func (bdc *BVSDecortClient) GetToken(ctx context.Context) (config.Token, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if resp.StatusCode != 200 {
|
if resp.StatusCode != 200 {
|
||||||
return config.Token{}, fmt.Errorf("cannot get token: %s", tokenBytes)
|
return config.Token{}, newHTTPError("cannot get token", resp.StatusCode, tokenBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// save token in config
|
// save token in config
|
||||||
@@ -346,7 +345,7 @@ func (bdc *BVSDecortClient) RefreshToken(ctx context.Context) (config.Token, err
|
|||||||
}
|
}
|
||||||
|
|
||||||
if resp.StatusCode != 200 {
|
if resp.StatusCode != 200 {
|
||||||
return config.Token{}, fmt.Errorf("cannot refresh token: %s", tokenBytes)
|
return config.Token{}, newHTTPError("cannot refresh token", resp.StatusCode, tokenBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// save token in config
|
// save token in config
|
||||||
@@ -452,17 +451,12 @@ func (bdc *BVSDecortClient) do(req *http.Request, ctype string) ([]byte, error)
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle access denied and successful request
|
|
||||||
if resp.StatusCode == 401 {
|
|
||||||
return respBytes, errors.New("access is denied")
|
|
||||||
}
|
|
||||||
if resp.StatusCode == 200 {
|
if resp.StatusCode == 200 {
|
||||||
return respBytes, nil
|
return respBytes, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle errors with other status codes
|
// handle errors with status code other than 200 (401 triggers token refresh in callers)
|
||||||
err = fmt.Errorf("%s", respBytes)
|
return nil, newHTTPError("could not execute request", resp.StatusCode, respBytes)
|
||||||
return nil, fmt.Errorf("could not execute request: %w", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func trimBVSConfig(cfg *config.BVSConfig) config.BVSConfig {
|
func trimBVSConfig(cfg *config.BVSConfig) config.BVSConfig {
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package decortsdk
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// HTTPError is returned when the API responds with a non-successful status code.
|
||||||
|
type HTTPError struct {
|
||||||
|
StatusCode int
|
||||||
|
Body []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *HTTPError) Error() string {
|
||||||
|
return string(e.Body)
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsNotFound reports whether err contains an HTTPError with status 404.
|
||||||
|
func IsNotFound(err error) bool {
|
||||||
|
return HasStatusCode(err, http.StatusNotFound)
|
||||||
|
}
|
||||||
|
|
||||||
|
// HasStatusCode reports whether err contains an HTTPError with the given status code.
|
||||||
|
func HasStatusCode(err error, code int) bool {
|
||||||
|
var httpErr *HTTPError
|
||||||
|
return errors.As(err, &httpErr) && httpErr.StatusCode == code
|
||||||
|
}
|
||||||
|
|
||||||
|
func newHTTPError(prefix string, statusCode int, body []byte) error {
|
||||||
|
return fmt.Errorf("%s: %w", prefix, &HTTPError{StatusCode: statusCode, Body: body})
|
||||||
|
}
|
||||||
@@ -492,5 +492,78 @@ func sepDescriptionValidator(fe validator.FieldLevel) bool {
|
|||||||
func watchdogActionValidator(fe validator.FieldLevel) bool {
|
func watchdogActionValidator(fe validator.FieldLevel) bool {
|
||||||
fieldValue := fe.Field().String()
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
func migrateV2ModeValidator(fe validator.FieldLevel) bool {
|
||||||
|
fieldValue := fe.Field().String()
|
||||||
|
return IsInSlice(fieldValue, migrateV2ModeValues)
|
||||||
|
}
|
||||||
|
|
||||||
|
// pressureThresholdValidator checks if PressureThreshold is in range from 5 to 50
|
||||||
|
func pressureThresholdValidator(fe validator.FieldLevel) bool {
|
||||||
|
fieldValue := fe.Field().Uint()
|
||||||
|
return fieldValue >= uint64(pressureThresholdMin) && fieldValue <= uint64(pressureThresholdMax)
|
||||||
|
}
|
||||||
|
|
||||||
|
// deflateThresholdValidator checks if DeflateThreshold is in range from 10 to 70
|
||||||
|
func deflateThresholdValidator(fe validator.FieldLevel) bool {
|
||||||
|
fieldValue := fe.Field().Uint()
|
||||||
|
return fieldValue >= uint64(deflateThresholdMin) && fieldValue <= uint64(deflateThresholdMax)
|
||||||
|
}
|
||||||
|
|
||||||
|
func bufferPCTValidator(fe validator.FieldLevel) bool {
|
||||||
|
fieldValue := fe.Field().Uint()
|
||||||
|
return fieldValue >= uint64(bufferPCTMin) && fieldValue <= uint64(bufferPCTMax)
|
||||||
|
}
|
||||||
|
|
||||||
|
func guaranteedPCTValidator(fe validator.FieldLevel) bool {
|
||||||
|
fieldValue := fe.Field().Uint()
|
||||||
|
return fieldValue >= uint64(guaranteedPCTMin) && fieldValue <= uint64(guaranteedPCTMax)
|
||||||
|
}
|
||||||
|
|
||||||
|
func guaranteedABSMinValidator(fe validator.FieldLevel) bool {
|
||||||
|
fieldValue := fe.Field().Uint()
|
||||||
|
return fieldValue >= uint64(guaranteedABSMinMin) && fieldValue <= uint64(guaranteedABSMinMax)
|
||||||
|
}
|
||||||
|
|
||||||
|
func shrinkThresholdPCTValidator(fe validator.FieldLevel) bool {
|
||||||
|
fieldValue := fe.Field().Uint()
|
||||||
|
return fieldValue >= uint64(shrinkThresholdPCTMin) && fieldValue <= uint64(shrinkThresholdPCTMax)
|
||||||
|
}
|
||||||
|
|
||||||
|
func balloonMaxShrinkPCTValidator(fe validator.FieldLevel) bool {
|
||||||
|
fieldValue := fe.Field().Uint()
|
||||||
|
return fieldValue >= uint64(balloonMaxShrinkPCTMin) && fieldValue <= uint64(balloonMaxShrinkPCTMax)
|
||||||
|
}
|
||||||
|
|
||||||
|
func balloonMaxGrowPCTValidator(fe validator.FieldLevel) bool {
|
||||||
|
fieldValue := fe.Field().Uint()
|
||||||
|
return fieldValue >= uint64(balloonMaxGrowPCTMin) && fieldValue <= uint64(balloonMaxGrowPCTMax)
|
||||||
|
}
|
||||||
|
|
||||||
|
func vmChangeCooldownValidator(fe validator.FieldLevel) bool {
|
||||||
|
fieldValue := fe.Field().Uint()
|
||||||
|
return fieldValue >= uint64(vmChangeCooldownMin) && fieldValue <= uint64(vmChangeCooldownMax)
|
||||||
|
}
|
||||||
|
|
||||||
|
func emergencyReturnCooldownValidator(fe validator.FieldLevel) bool {
|
||||||
|
fieldValue := fe.Field().Uint()
|
||||||
|
return fieldValue >= uint64(emergencyReturnCooldownMin) && fieldValue <= uint64(emergencyReturnCooldownMax)
|
||||||
|
}
|
||||||
|
|
||||||
|
func majorFaultThresholdValidator(fe validator.FieldLevel) bool {
|
||||||
|
fieldValue := fe.Field().Uint()
|
||||||
|
return fieldValue >= uint64(majorFaultThresholdMin) && fieldValue <= uint64(majorFaultThresholdMax)
|
||||||
|
}
|
||||||
|
|
||||||
|
func logLevelValidator(fe validator.FieldLevel) bool {
|
||||||
|
fieldValue := fe.Field().String()
|
||||||
|
return IsInSlice(fieldValue, logLevelValues)
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@ package validators
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/multierror"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/multierror"
|
||||||
|
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
|
|||||||
@@ -331,5 +331,72 @@ func registerAllValidators(validate *validator.Validate) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = validate.RegisterValidation("memoryBalloonMode", memoryBalloonModeValidator)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = validate.RegisterValidation("migrateV2Mode", migrateV2ModeValidator)
|
||||||
|
|
||||||
|
err = validate.RegisterValidation("pressureThreshold", pressureThresholdValidator)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = validate.RegisterValidation("deflateThreshold", deflateThresholdValidator)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = validate.RegisterValidation("bufferPCT", bufferPCTValidator)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = validate.RegisterValidation("guaranteedPCT", guaranteedPCTValidator)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = validate.RegisterValidation("guaranteedABSMin", guaranteedABSMinValidator)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = validate.RegisterValidation("shrinkThresholdPCT", shrinkThresholdPCTValidator)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = validate.RegisterValidation("balloonMaxShrinkPCT", balloonMaxShrinkPCTValidator)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = validate.RegisterValidation("balloonMaxGrowPCT", balloonMaxGrowPCTValidator)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = validate.RegisterValidation("vmChangeCooldown", vmChangeCooldownValidator)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = validate.RegisterValidation("emergencyReturnCooldown", emergencyReturnCooldownValidator)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = validate.RegisterValidation("majorFaultThreshold", majorFaultThresholdValidator)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = validate.RegisterValidation("logLevel", logLevelValidator)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,13 @@ var (
|
|||||||
|
|
||||||
sepTechStatusValues = []string{"ENABLED", "DISABLED"}
|
sepTechStatusValues = []string{"ENABLED", "DISABLED"}
|
||||||
|
|
||||||
watchdogActionVaues = []string{"reset", "shutdown", "poweroff", "pause", "none"}
|
watchdogActionValues = []string{"reset", "shutdown", "poweroff", "pause", "none"}
|
||||||
|
|
||||||
|
memoryBalloonModeValues = []string{"auto", "legacy", "none"}
|
||||||
|
|
||||||
|
migrateV2ModeValues = []string{"compute", "disks", "compute_and_disks"}
|
||||||
|
|
||||||
|
logLevelValues = []string{"DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"}
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -90,4 +96,37 @@ const (
|
|||||||
|
|
||||||
trunkTagsMin = 1
|
trunkTagsMin = 1
|
||||||
trunkTagsMax = 4095
|
trunkTagsMax = 4095
|
||||||
|
|
||||||
|
pressureThresholdMin = 5
|
||||||
|
pressureThresholdMax = 50
|
||||||
|
|
||||||
|
deflateThresholdMin = 10
|
||||||
|
deflateThresholdMax = 70
|
||||||
|
|
||||||
|
bufferPCTMin = 5
|
||||||
|
bufferPCTMax = 50
|
||||||
|
|
||||||
|
guaranteedPCTMin = 10
|
||||||
|
guaranteedPCTMax = 50
|
||||||
|
|
||||||
|
guaranteedABSMinMin = 256
|
||||||
|
guaranteedABSMinMax = 4096
|
||||||
|
|
||||||
|
shrinkThresholdPCTMin = 30
|
||||||
|
shrinkThresholdPCTMax = 90
|
||||||
|
|
||||||
|
balloonMaxShrinkPCTMin = 5
|
||||||
|
balloonMaxShrinkPCTMax = 25
|
||||||
|
|
||||||
|
balloonMaxGrowPCTMin = 5
|
||||||
|
balloonMaxGrowPCTMax = 25
|
||||||
|
|
||||||
|
vmChangeCooldownMin = 30
|
||||||
|
vmChangeCooldownMax = 300
|
||||||
|
|
||||||
|
emergencyReturnCooldownMin = 60
|
||||||
|
emergencyReturnCooldownMax = 1800
|
||||||
|
|
||||||
|
majorFaultThresholdMin = 1
|
||||||
|
majorFaultThresholdMax = 10000
|
||||||
)
|
)
|
||||||
+2
-3
@@ -210,7 +210,7 @@ func (ldc *LegacyDecortClient) getToken(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if resp.StatusCode != 200 {
|
if resp.StatusCode != 200 {
|
||||||
return fmt.Errorf("cannot get token: %s", tokenBytes)
|
return newHTTPError("cannot get token", resp.StatusCode, tokenBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// save token in config
|
// save token in config
|
||||||
@@ -291,8 +291,7 @@ func (ldc *LegacyDecortClient) do(req *http.Request, ctype string) ([]byte, erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle errors with status code other than 200
|
// handle errors with status code other than 200
|
||||||
err = fmt.Errorf("%s", respBytes)
|
return nil, newHTTPError("could not execute request", resp.StatusCode, respBytes)
|
||||||
return nil, fmt.Errorf("could not execute request: %w", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func trimLegacyConfig(cfg *config.LegacyConfig) config.LegacyConfig {
|
func trimLegacyConfig(cfg *config.LegacyConfig) config.LegacyConfig {
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -27,6 +27,8 @@ type AddUserRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AddUser gives a user access rights.
|
// AddUser gives a user access rights.
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (a Account) AddUser(ctx context.Context, req AddUserRequest) (bool, error) {
|
func (a Account) AddUser(ctx context.Context, req AddUserRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -20,6 +20,8 @@ type DeleteUserRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DeleteUser revokes user access from the account
|
// DeleteUser revokes user access from the account
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (a Account) DeleteUser(ctx context.Context, req DeleteUserRequest) (bool, error) {
|
func (a Account) DeleteUser(ctx context.Context, req DeleteUserRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ type ListVINSRequest struct {
|
|||||||
|
|
||||||
// Find by VINS ID
|
// Find by VINS ID
|
||||||
// Required: false
|
// Required: false
|
||||||
VINSID uint64 `url:"vins,omitempty" json:"vinsId,omitempty"`
|
VINSID uint64 `url:"vinsId,omitempty" json:"vinsId,omitempty"`
|
||||||
|
|
||||||
// Find by name
|
// Find by name
|
||||||
// Required: false
|
// Required: false
|
||||||
|
|||||||
@@ -19,9 +19,6 @@ type ListRecordACL struct {
|
|||||||
|
|
||||||
// Account owner ID
|
// Account owner ID
|
||||||
UgroupID string `json:"userGroupId"`
|
UgroupID string `json:"userGroupId"`
|
||||||
|
|
||||||
// Is it possible to remove
|
|
||||||
CanBeDeleted bool `json:"canBeDeleted"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Access Control List
|
// Access Control List
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -27,6 +27,8 @@ type UpdateUserRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UpdateUser updates user access rights
|
// UpdateUser updates user access rights
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (a Account) UpdateUser(ctx context.Context, req UpdateUserRequest) (bool, error) {
|
func (a Account) UpdateUser(ctx context.Context, req UpdateUserRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ type Audit struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Builder for audit endpoint
|
// Builder for audit endpoint
|
||||||
func New(client interfaces.Caller) *Audit {
|
func New(client interfaces.Caller) *Audit{
|
||||||
return &Audit{
|
return &Audit{
|
||||||
client: client,
|
client: client,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,14 @@ type ListRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
AccountID uint64 `url:"account_id,omitempty" json:"account_id,omitempty"`
|
AccountID uint64 `url:"account_id,omitempty" json:"account_id,omitempty"`
|
||||||
|
|
||||||
|
// Find by disk id
|
||||||
|
// Required: false
|
||||||
|
DiskID uint64 `url:"disk_id,omitempty" json:"disk_id,omitempty"`
|
||||||
|
|
||||||
|
// Find by vm folder id
|
||||||
|
// Required: false
|
||||||
|
VMFolderID uint64 `url:"vmfolder_id,omitempty" json:"vmfolder_id,omitempty"`
|
||||||
|
|
||||||
// Find by vins id
|
// Find by vins id
|
||||||
// Required: false
|
// Required: false
|
||||||
VINSID uint64 `url:"vins_id,omitempty" json:"vins_id,omitempty"`
|
VINSID uint64 `url:"vins_id,omitempty" json:"vins_id,omitempty"`
|
||||||
@@ -90,6 +98,9 @@ type ListRequest struct {
|
|||||||
// Exclude audit lines from response
|
// Exclude audit lines from response
|
||||||
// Required: false
|
// Required: false
|
||||||
ExcludeAuditLines bool `url:"exclude_audit_lines,omitempty" json:"exclude_audit_lines,omitempty"`
|
ExcludeAuditLines bool `url:"exclude_audit_lines,omitempty" json:"exclude_audit_lines,omitempty"`
|
||||||
|
|
||||||
|
// Public Session ID
|
||||||
|
PublicSessionID string `url:"public_session_id,omitempty" json:"public_session_id,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List gets audit records for the specified account object
|
// List gets audit records for the specified account object
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package audit
|
|||||||
|
|
||||||
// Main info about audit
|
// Main info about audit
|
||||||
type RecordAudit struct {
|
type RecordAudit struct {
|
||||||
|
|
||||||
// Arguments
|
// Arguments
|
||||||
Arguments string `json:"args"`
|
Arguments string `json:"args"`
|
||||||
|
|
||||||
@@ -41,6 +40,9 @@ type RecordAudit struct {
|
|||||||
|
|
||||||
// User
|
// User
|
||||||
User string `json:"user"`
|
User string `json:"user"`
|
||||||
|
|
||||||
|
// Public Session ID
|
||||||
|
PublicSessionID string `json:"public_session_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main info about audit
|
// Main info about audit
|
||||||
@@ -81,8 +83,47 @@ type ItemAudit struct {
|
|||||||
// User
|
// User
|
||||||
User string `json:"user"`
|
User string `json:"user"`
|
||||||
|
|
||||||
|
// Public Session ID
|
||||||
|
PublicSessionID string `json:"public_session_id"`
|
||||||
|
|
||||||
// TTL
|
// TTL
|
||||||
TTL string `json:"_ttl"`
|
TTL string `json:"_ttl"`
|
||||||
|
|
||||||
|
// Resource group ID
|
||||||
|
ResgroupID uint64 `json:"resgroup_id"`
|
||||||
|
|
||||||
|
// Account ID
|
||||||
|
AccountID uint64 `json:"account_id"`
|
||||||
|
|
||||||
|
// Compute ID
|
||||||
|
ComputeID uint64 `json:"compute_id"`
|
||||||
|
|
||||||
|
// VINS ID
|
||||||
|
VINSID uint64 `json:"vins_id"`
|
||||||
|
|
||||||
|
// Service ID
|
||||||
|
ServiceID uint64 `json:"service_id"`
|
||||||
|
|
||||||
|
// K8S ID
|
||||||
|
K8SID uint64 `json:"k8s_id"`
|
||||||
|
|
||||||
|
// FLIPGroup ID
|
||||||
|
FLIPGroupID uint64 `json:"flipgroup_id"`
|
||||||
|
|
||||||
|
// Load balancer ID
|
||||||
|
LBID uint64 `json:"lb_id"`
|
||||||
|
|
||||||
|
// SEP ID
|
||||||
|
SEPID uint64 `json:"sep_id"`
|
||||||
|
|
||||||
|
// Node IDs
|
||||||
|
NodeIDs []uint64 `json:"node_ids"`
|
||||||
|
|
||||||
|
// Persistent disk IDs associated with the operation
|
||||||
|
DiskIDs []uint64 `json:"disk_ids"`
|
||||||
|
|
||||||
|
// API task ID for asynchronous calls
|
||||||
|
APITask string `json:"apitask"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of audits
|
// List of audits
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ type AbortSharedSnapshotMergeRequest struct {
|
|||||||
|
|
||||||
type wrapperAbortSharedSnapshotMergeRequest struct {
|
type wrapperAbortSharedSnapshotMergeRequest struct {
|
||||||
AbortSharedSnapshotMergeRequest
|
AbortSharedSnapshotMergeRequest
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// AbortSharedSnapshotMerge shared snapshots merge abort
|
// AbortSharedSnapshotMerge shared snapshots merge abort
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -2,9 +2,11 @@ package compute
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -40,26 +42,78 @@ type AffinityRuleAddRequest struct {
|
|||||||
// Value that must match the key to be taken into account when analyzing this rule
|
// Value that must match the key to be taken into account when analyzing this rule
|
||||||
// Required: true
|
// Required: true
|
||||||
Value string `url:"value" json:"value" validate:"required"`
|
Value string `url:"value" json:"value" validate:"required"`
|
||||||
|
|
||||||
|
// Migrate compute according to the rule
|
||||||
|
// Default: false
|
||||||
|
// Required: false
|
||||||
|
Migrate bool `url:"migrate" json:"migrate"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type wrapperAffinityRuleAddRequest struct {
|
||||||
|
AffinityRuleAddRequest
|
||||||
|
|
||||||
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// AffinityRuleAdd add affinity rule
|
// AffinityRuleAdd add affinity rule
|
||||||
func (c Compute) AffinityRuleAdd(ctx context.Context, req AffinityRuleAddRequest) (bool, error) {
|
func (c Compute) AffinityRuleAdd(ctx context.Context, req AffinityRuleAddRequest) (AffinityRuleAddResult, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
return AffinityRuleAddResult{}, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
url := "/cloudapi/compute/affinityRuleAdd"
|
url := "/cloudapi/compute/affinityRuleAdd"
|
||||||
|
|
||||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
aReq := wrapperAffinityRuleAddRequest{
|
||||||
if err != nil {
|
AffinityRuleAddRequest: req,
|
||||||
return false, err
|
AsyncMode: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, aReq)
|
||||||
|
if err != nil {
|
||||||
|
return AffinityRuleAddResult{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if !req.Migrate {
|
||||||
result, err := strconv.ParseBool(string(res))
|
result, err := strconv.ParseBool(string(res))
|
||||||
if err != nil {
|
return AffinityRuleAddResult{Ok: result}, err
|
||||||
return false, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, nil
|
var report MigrationReport
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &report)
|
||||||
|
if err != nil {
|
||||||
|
return AffinityRuleAddResult{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return AffinityRuleAddResult{Ok: report.Applied, MigrationReport: &report}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AsyncAffinityRuleAdd add affinity rule in async mode
|
||||||
|
func (c Compute) AsyncAffinityRuleAdd(ctx context.Context, req AffinityRuleAddRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/compute/affinityRuleAdd"
|
||||||
|
|
||||||
|
aReq := wrapperAffinityRuleAddRequest{
|
||||||
|
AffinityRuleAddRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, aReq)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
var resp string
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &resp)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
}
|
}
|
||||||
@@ -2,9 +2,11 @@ package compute
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -40,26 +42,78 @@ type AntiAffinityRuleAddRequest struct {
|
|||||||
// Value that must match the key to be taken into account when analyzing this rule
|
// Value that must match the key to be taken into account when analyzing this rule
|
||||||
// Required: true
|
// Required: true
|
||||||
Value string `url:"value" json:"value" validate:"required"`
|
Value string `url:"value" json:"value" validate:"required"`
|
||||||
|
|
||||||
|
// Migrate compute according to the rule
|
||||||
|
// Default: false
|
||||||
|
// Required: false
|
||||||
|
Migrate bool `url:"migrate" json:"migrate"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type wrapperAntiAffinityRuleAddRequest struct {
|
||||||
|
AntiAffinityRuleAddRequest
|
||||||
|
|
||||||
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// AntiAffinityRuleAdd add anti affinity rule
|
// AntiAffinityRuleAdd add anti affinity rule
|
||||||
func (c Compute) AntiAffinityRuleAdd(ctx context.Context, req AntiAffinityRuleAddRequest) (bool, error) {
|
func (c Compute) AntiAffinityRuleAdd(ctx context.Context, req AntiAffinityRuleAddRequest) (AntiAffinityRuleAddResult, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
return AntiAffinityRuleAddResult{}, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
url := "/cloudapi/compute/antiAffinityRuleAdd"
|
url := "/cloudapi/compute/antiAffinityRuleAdd"
|
||||||
|
|
||||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
aReq := wrapperAntiAffinityRuleAddRequest{
|
||||||
if err != nil {
|
AntiAffinityRuleAddRequest: req,
|
||||||
return false, err
|
AsyncMode: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, aReq)
|
||||||
|
if err != nil {
|
||||||
|
return AntiAffinityRuleAddResult{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if !req.Migrate {
|
||||||
result, err := strconv.ParseBool(string(res))
|
result, err := strconv.ParseBool(string(res))
|
||||||
if err != nil {
|
return AntiAffinityRuleAddResult{Ok: result}, err
|
||||||
return false, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, nil
|
var report MigrationReport
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &report)
|
||||||
|
if err != nil {
|
||||||
|
return AntiAffinityRuleAddResult{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return AntiAffinityRuleAddResult{Ok: report.Applied, MigrationReport: &report}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AsyncAntiAffinityRuleAdd add anti affinity rule in async mode
|
||||||
|
func (c Compute) AsyncAntiAffinityRuleAdd(ctx context.Context, req AntiAffinityRuleAddRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/compute/antiAffinityRuleAdd"
|
||||||
|
|
||||||
|
aReq := wrapperAntiAffinityRuleAddRequest{
|
||||||
|
AntiAffinityRuleAddRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, aReq)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
var resp string
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &resp)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type CDEjectRequest struct {
|
|||||||
type wrapperCDEjectRequest struct {
|
type wrapperCDEjectRequest struct {
|
||||||
CDEjectRequest
|
CDEjectRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CDEject eject CD image to compute's CD-ROM
|
// CDEject eject CD image to compute's CD-ROM
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ type CDInsertRequest struct {
|
|||||||
type wrapperCDInsertRequest struct {
|
type wrapperCDInsertRequest struct {
|
||||||
CDInsertRequest
|
CDInsertRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CDInsert insert new CD image to compute's CD-ROM
|
// CDInsert insert new CD image to compute's CD-ROM
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ type ChangeIPRequest struct {
|
|||||||
type wrapperChangeIPRequest struct {
|
type wrapperChangeIPRequest struct {
|
||||||
ChangeIPRequest
|
ChangeIPRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChangeIP change reserved IP for compute instance
|
// ChangeIP change reserved IP for compute instance
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ type ChangeLinkStateRequest struct {
|
|||||||
type wrapperChangeLinkStateRequest struct {
|
type wrapperChangeLinkStateRequest struct {
|
||||||
ChangeLinkStateRequest
|
ChangeLinkStateRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChangeLinkState changes the status link virtual of compute
|
// ChangeLinkState changes the status link virtual of compute
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type ChangeMTURequest struct {
|
|||||||
type wrapperChangeMTURequest struct {
|
type wrapperChangeMTURequest struct {
|
||||||
ChangeMTURequest
|
ChangeMTURequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChangeMTU change MTU for compute instance
|
// ChangeMTU change MTU for compute instance
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type ChangeQoSPoliciesRequest struct {
|
|||||||
type wrapperChangeQoSPoliciesRequest struct {
|
type wrapperChangeQoSPoliciesRequest struct {
|
||||||
ChangeQoSPoliciesRequest
|
ChangeQoSPoliciesRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChangeQoSPolicies change qos policies for compute
|
// ChangeQoSPolicies change qos policies for compute
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ type ChangeSecGroupsRequest struct {
|
|||||||
type wrapperChangeSecGroupsRequest struct {
|
type wrapperChangeSecGroupsRequest struct {
|
||||||
ChangeSecGroupsRequest
|
ChangeSecGroupsRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChangeSecGroups changes security groups for compute
|
// ChangeSecGroups changes security groups for compute
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ type CloneRequest struct {
|
|||||||
type wrapperCloneRequest struct {
|
type wrapperCloneRequest struct {
|
||||||
CloneRequest
|
CloneRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clone clones compute instance
|
// Clone clones compute instance
|
||||||
|
|||||||
@@ -22,10 +22,12 @@ type CreateTemplateRequest struct {
|
|||||||
type wrapperCreateTemplateRequest struct {
|
type wrapperCreateTemplateRequest struct {
|
||||||
CreateTemplateRequest
|
CreateTemplateRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateTemplate create template from compute instance
|
// CreateTemplate create template from compute instance
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) CreateTemplate(ctx context.Context, req CreateTemplateRequest) (string, error) {
|
func (c Compute) CreateTemplate(ctx context.Context, req CreateTemplateRequest) (string, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -39,10 +39,6 @@ type CreateTemplateFromBlankRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
Password string `url:"password,omitempty" json:"password,omitempty"`
|
Password string `url:"password,omitempty" json:"password,omitempty"`
|
||||||
|
|
||||||
// Account ID to make the image exclusive
|
|
||||||
// Required: false
|
|
||||||
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
|
|
||||||
|
|
||||||
// Pool for image create
|
// Pool for image create
|
||||||
// Required: false
|
// Required: false
|
||||||
PoolName string `url:"poolName,omitempty" json:"poolName,omitempty"`
|
PoolName string `url:"poolName,omitempty" json:"poolName,omitempty"`
|
||||||
@@ -55,11 +51,13 @@ type CreateTemplateFromBlankRequest struct {
|
|||||||
|
|
||||||
type wrapperCreateTemplateFromBlankRequest struct {
|
type wrapperCreateTemplateFromBlankRequest struct {
|
||||||
CreateTemplateFromBlankRequest
|
CreateTemplateFromBlankRequest
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateTemplateFromBlank creates template from boot disk of current compute in sync mode.
|
// CreateTemplateFromBlank creates template from boot disk of current compute in sync mode.
|
||||||
// It returns id of created compute and error.
|
// It returns id of created compute and error.
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) CreateTemplateFromBlank(ctx context.Context, req CreateTemplateFromBlankRequest) (uint64, error) {
|
func (c Compute) CreateTemplateFromBlank(ctx context.Context, req CreateTemplateFromBlankRequest) (uint64, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -88,6 +86,8 @@ func (c Compute) CreateTemplateFromBlank(ctx context.Context, req CreateTemplate
|
|||||||
|
|
||||||
// CreateTemplateFromBlankAsync creates template from boot disk of current compute in async mode.
|
// CreateTemplateFromBlankAsync creates template from boot disk of current compute in async mode.
|
||||||
// It returns guid of task and error.
|
// It returns guid of task and error.
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) CreateTemplateFromBlankAsync(ctx context.Context, req CreateTemplateFromBlankRequest) (string, error) {
|
func (c Compute) CreateTemplateFromBlankAsync(ctx context.Context, req CreateTemplateFromBlankRequest) (string, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -26,7 +26,7 @@ type DeleteRequest struct {
|
|||||||
type wrapperDeleteRequest struct {
|
type wrapperDeleteRequest struct {
|
||||||
DeleteRequest
|
DeleteRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete deletes compute
|
// Delete deletes compute
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type DisableRequest struct {
|
|||||||
type wrapperDisableRequest struct {
|
type wrapperDisableRequest struct {
|
||||||
DisableRequest
|
DisableRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable disables compute
|
// Disable disables compute
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ type DiskAddRequest struct {
|
|||||||
type wrapperDiskAddRequest struct {
|
type wrapperDiskAddRequest struct {
|
||||||
DiskAddRequest
|
DiskAddRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiskAdd creates new disk and attach to compute
|
// DiskAdd creates new disk and attach to compute
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ type DiskAttachRequest struct {
|
|||||||
type wrapperDiskAttachRequest struct {
|
type wrapperDiskAttachRequest struct {
|
||||||
DiskAttachRequest
|
DiskAttachRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiskAttach attach disk to compute
|
// DiskAttach attach disk to compute
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type DiskDelRequest struct {
|
|||||||
type wrapperDiskDelRequest struct {
|
type wrapperDiskDelRequest struct {
|
||||||
DiskDelRequest
|
DiskDelRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiskDel delete disk and detach from compute
|
// DiskDel delete disk and detach from compute
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ type DiskDetachRequest struct {
|
|||||||
type wrapperDiskDetachRequest struct {
|
type wrapperDiskDetachRequest struct {
|
||||||
DiskDetachRequest
|
DiskDetachRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiskDetach detach disk from compute
|
// DiskDetach detach disk from compute
|
||||||
|
|||||||
@@ -26,10 +26,12 @@ type DiskQOSRequest struct {
|
|||||||
type wrapperDiskQOSRequest struct {
|
type wrapperDiskQOSRequest struct {
|
||||||
DiskQOSRequest
|
DiskQOSRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiskQOS change QoS of the disk
|
// DiskQOS change QoS of the disk
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) DiskQOS(ctx context.Context, req DiskQOSRequest) (bool, error) {
|
func (c Compute) DiskQOS(ctx context.Context, req DiskQOSRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -57,6 +59,8 @@ func (c Compute) DiskQOS(ctx context.Context, req DiskQOSRequest) (bool, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DiskQOSAsync changes QoS of the disk with AsyncMode
|
// DiskQOSAsync changes QoS of the disk with AsyncMode
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) DiskQOSAsync(ctx context.Context, req DiskQOSRequest) (string, error) {
|
func (c Compute) DiskQOSAsync(ctx context.Context, req DiskQOSRequest) (string, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type DiskResizeRequest struct {
|
|||||||
type wrapperDiskResizeRequest struct {
|
type wrapperDiskResizeRequest struct {
|
||||||
DiskResizeRequest
|
DiskResizeRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiskResize change disk size
|
// DiskResize change disk size
|
||||||
|
|||||||
@@ -20,13 +20,17 @@ type DiskSwitchToReplicationRequest struct {
|
|||||||
|
|
||||||
// Delete replication relationship
|
// Delete replication relationship
|
||||||
// Required: false
|
// Required: false
|
||||||
StopReplication bool `url:"stopReplication" json:"stopReplication"`
|
StopReplication bool `url:"stopReplication,omitempty" json:"stopReplication,omitempty"`
|
||||||
|
|
||||||
|
// Use planned failover for asynchronous replication
|
||||||
|
// Required: false
|
||||||
|
Planned interface{} `url:"planned,omitempty" json:"planned,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type wrapperDiskSwitchToReplicationRequest struct {
|
type wrapperDiskSwitchToReplicationRequest struct {
|
||||||
DiskSwitchToReplicationRequest
|
DiskSwitchToReplicationRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiskSwitchToReplication switches disk to it's replication
|
// DiskSwitchToReplication switches disk to it's replication
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@ type GuestAgentDisableRequest struct {
|
|||||||
type wrapperGuestAgentDisableRequest struct {
|
type wrapperGuestAgentDisableRequest struct {
|
||||||
GuestAgentDisableRequest
|
GuestAgentDisableRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable guest agent at a specific compute
|
// Disable guest agent at a specific compute
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type GuestAgentEnableRequest struct {
|
|||||||
type wrapperGuestAgentEnableRequest struct {
|
type wrapperGuestAgentEnableRequest struct {
|
||||||
GuestAgentEnableRequest
|
GuestAgentEnableRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable guest agent at a specific compute
|
// Enable guest agent at a specific compute
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type GuestAgentExecuteRequest struct {
|
|||||||
type wrapperGuestAgentExecuteRequest struct {
|
type wrapperGuestAgentExecuteRequest struct {
|
||||||
GuestAgentExecuteRequest
|
GuestAgentExecuteRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute guest agent command
|
// Execute guest agent command
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type GuestAgentFeatureUpdateRequest struct {
|
|||||||
type wrapperGuestAgentFeatureUpdateRequest struct {
|
type wrapperGuestAgentFeatureUpdateRequest struct {
|
||||||
GuestAgentFeatureUpdateRequest
|
GuestAgentFeatureUpdateRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Feature update guest agent
|
// Feature update guest agent
|
||||||
|
|||||||
@@ -63,6 +63,14 @@ type ListRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
ZoneID uint64 `url:"zone_id,omitempty" json:"zone_id,omitempty"`
|
ZoneID uint64 `url:"zone_id,omitempty" json:"zone_id,omitempty"`
|
||||||
|
|
||||||
|
// Find by VM folder ID
|
||||||
|
// Required: false
|
||||||
|
FolderID uint64 `url:"folder_id,omitempty" json:"folder_id,omitempty"`
|
||||||
|
|
||||||
|
// Include computes from descendant folders.
|
||||||
|
// Required: false
|
||||||
|
IncludeDescendants interface{} `url:"include_descendants,omitempty" json:"include_descendants,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
// Page number
|
// Page number
|
||||||
// Required: false
|
// Required: false
|
||||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||||
|
|||||||
@@ -18,10 +18,6 @@ type ListVGPURequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
GPUID uint64 `url:"gpuId,omitempty" json:"gpuId,omitempty"`
|
GPUID uint64 `url:"gpuId,omitempty" json:"gpuId,omitempty"`
|
||||||
|
|
||||||
// Find by type
|
|
||||||
// Required: false
|
|
||||||
Type string `url:"type,omitempty" json:"type,omitempty"`
|
|
||||||
|
|
||||||
// Find by status
|
// Find by status
|
||||||
// Required: false
|
// Required: false
|
||||||
Status string `url:"status,omitempty" json:"status,omitempty"`
|
Status string `url:"status,omitempty" json:"status,omitempty"`
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ type MigrateToZoneRequest struct {
|
|||||||
type wrapperMigrateToZoneRequest struct {
|
type wrapperMigrateToZoneRequest struct {
|
||||||
MigrateToZoneRequest
|
MigrateToZoneRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MoveToRG moves compute instance to new resource group
|
// MoveToRG moves compute instance to new resource group
|
||||||
|
|||||||
@@ -446,6 +446,9 @@ type RecordCompute struct {
|
|||||||
// Manager type
|
// Manager type
|
||||||
ManagerType string `json:"managerType"`
|
ManagerType string `json:"managerType"`
|
||||||
|
|
||||||
|
// Memory balloon mode
|
||||||
|
MemoryBalloonMode string `json:"memory_balloon_mode"`
|
||||||
|
|
||||||
// Migration job
|
// Migration job
|
||||||
MigrationJob uint64 `json:"migrationjob"`
|
MigrationJob uint64 `json:"migrationjob"`
|
||||||
|
|
||||||
@@ -572,6 +575,61 @@ type RecordCompute struct {
|
|||||||
// Zone ID
|
// Zone ID
|
||||||
// Required: false
|
// Required: false
|
||||||
ZoneID uint64 `json:"zoneId"`
|
ZoneID uint64 `json:"zoneId"`
|
||||||
|
|
||||||
|
// Folder ID
|
||||||
|
FolderID uint64 `json:"folder_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 {
|
type SnapRecordCompute struct {
|
||||||
@@ -1049,6 +1107,9 @@ type ItemComputeDisk struct {
|
|||||||
// Created time
|
// Created time
|
||||||
CreatedTime uint64 `json:"createdTime"`
|
CreatedTime uint64 `json:"createdTime"`
|
||||||
|
|
||||||
|
// Whether CRT tracking is enabled
|
||||||
|
CRTTracking bool `json:"crt_tracking"`
|
||||||
|
|
||||||
// Device name
|
// Device name
|
||||||
DeviceName string `json:"devicename"`
|
DeviceName string `json:"devicename"`
|
||||||
|
|
||||||
@@ -1396,6 +1457,9 @@ type ItemCompute struct {
|
|||||||
// Manager type
|
// Manager type
|
||||||
ManagerType string `json:"managerType"`
|
ManagerType string `json:"managerType"`
|
||||||
|
|
||||||
|
// Memory balloon mode
|
||||||
|
MemoryBalloonMode string `json:"memory_balloon_mode"`
|
||||||
|
|
||||||
// Migration job
|
// Migration job
|
||||||
MigrationJob uint64 `json:"migrationjob"`
|
MigrationJob uint64 `json:"migrationjob"`
|
||||||
|
|
||||||
@@ -1506,6 +1570,9 @@ type ItemCompute struct {
|
|||||||
|
|
||||||
// Zone ID
|
// Zone ID
|
||||||
ZoneID uint64 `json:"zoneId"`
|
ZoneID uint64 `json:"zoneId"`
|
||||||
|
|
||||||
|
// Folder ID
|
||||||
|
FolderID uint64 `json:"folder_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListInfoDisks
|
// ListInfoDisks
|
||||||
@@ -1591,6 +1658,9 @@ type ItemVGPU struct {
|
|||||||
// Profile Reference
|
// Profile Reference
|
||||||
ProfileReference string `json:"profile_reference"`
|
ProfileReference string `json:"profile_reference"`
|
||||||
|
|
||||||
|
// Profile Name
|
||||||
|
ProfileName string `json:"profile_name"`
|
||||||
|
|
||||||
// Split Mode
|
// Split Mode
|
||||||
SplitMode string `json:"split_mode"`
|
SplitMode string `json:"split_mode"`
|
||||||
|
|
||||||
@@ -1682,3 +1752,47 @@ type CloneStatus struct {
|
|||||||
// Progress percent
|
// Progress percent
|
||||||
ProgressPercent int `json:"progress_percent"`
|
ProgressPercent int `json:"progress_percent"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type MigrationReportItem struct {
|
||||||
|
// ID of the compute instance
|
||||||
|
ComputeID uint64 `json:"compute_id"`
|
||||||
|
|
||||||
|
// Per-VM action result, not workflow status
|
||||||
|
// Should be one of:
|
||||||
|
// - migrated: migration completed; the rule may still be unsatisfied
|
||||||
|
// - skipped: migration was not needed or applicable
|
||||||
|
// - not_started: submission was not attempted
|
||||||
|
// - not_completed: completion is unconfirmed; the VM may have moved
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Action details, errors and final rule-placement warnings
|
||||||
|
Message string `json:"message"`
|
||||||
|
|
||||||
|
// Workflow ID for tracking, or nil if submission was not attempted.
|
||||||
|
// A non-nil ID does not confirm job acceptance
|
||||||
|
WorkflowJobID *string `json:"workflow_job_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MigrationReport struct {
|
||||||
|
// Rules were saved; does not confirm migration success or rule satisfaction
|
||||||
|
Applied bool `json:"applied"`
|
||||||
|
|
||||||
|
// Per-compute migration results
|
||||||
|
Migrations []MigrationReportItem `json:"migrations"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AffinityRuleAddResult struct {
|
||||||
|
// Result of the rule addition
|
||||||
|
Ok bool
|
||||||
|
|
||||||
|
// Migration report. Populated only when the request was made with Migrate=true, nil otherwise
|
||||||
|
MigrationReport *MigrationReport
|
||||||
|
}
|
||||||
|
|
||||||
|
type AntiAffinityRuleAddResult struct {
|
||||||
|
// Result of the rule addition
|
||||||
|
Ok bool
|
||||||
|
|
||||||
|
// Migration report. Populated only when the request was made with Migrate=true, nil otherwise
|
||||||
|
MigrationReport *MigrationReport
|
||||||
|
}
|
||||||
@@ -37,7 +37,7 @@ type MoveToRGRequest struct {
|
|||||||
type wrapperMoveToRGRequest struct {
|
type wrapperMoveToRGRequest struct {
|
||||||
MoveToRGRequest
|
MoveToRGRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MoveToRG moves compute instance to new resource group
|
// MoveToRG moves compute instance to new resource group
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -95,7 +96,7 @@ type NetAttachRequest struct {
|
|||||||
type wrapperNetAttachRequest struct {
|
type wrapperNetAttachRequest struct {
|
||||||
NetAttachRequest
|
NetAttachRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetAttach attaches network to compute and gets info about network
|
// 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"
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -141,7 +142,7 @@ func (c Compute) NetAttachAsync(ctx context.Context, req NetAttachRequest) (stri
|
|||||||
|
|
||||||
url := "/cloudapi/compute/netAttach"
|
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 {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type NetDetachRequest struct {
|
|||||||
type wrapperNetDetachRequest struct {
|
type wrapperNetDetachRequest struct {
|
||||||
NetDetachRequest
|
NetDetachRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetDetach detaches network from compute
|
// NetDetach detaches network from compute
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type PauseRequest struct {
|
|||||||
type wrapperPauseRequest struct {
|
type wrapperPauseRequest struct {
|
||||||
PauseRequest
|
PauseRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pause pause compute
|
// Pause pause compute
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ type PFWAddRequest struct {
|
|||||||
type wrapperPFWAddRequest struct {
|
type wrapperPFWAddRequest struct {
|
||||||
PFWAddRequest
|
PFWAddRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PFWAdd add port forward rule
|
// PFWAdd add port forward rule
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ type PFWDelRequest struct {
|
|||||||
type wrapperPFWDelRequest struct {
|
type wrapperPFWDelRequest struct {
|
||||||
PFWDelRequest
|
PFWDelRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PFWDel deletes port forward rule
|
// PFWDel deletes port forward rule
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ type PinToNodeRequest struct {
|
|||||||
type wrapperPinToNodeRequest struct {
|
type wrapperPinToNodeRequest struct {
|
||||||
PinToNodeRequest
|
PinToNodeRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PinToNode pin compute to current node
|
// PinToNode pin compute to current node
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type PowerCycleRequest struct {
|
|||||||
type wrapperPowerCycleRequest struct {
|
type wrapperPowerCycleRequest struct {
|
||||||
PowerCycleRequest
|
PowerCycleRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PowerCycle makes force stop and start compute
|
// PowerCycle makes force stop and start compute
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type RebootRequest struct {
|
|||||||
type wrapperRebootRequest struct {
|
type wrapperRebootRequest struct {
|
||||||
RebootRequest
|
RebootRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reboot reboots compute
|
// Reboot reboots compute
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ type RedeployRequest struct {
|
|||||||
type wrapperRedeployRequest struct {
|
type wrapperRedeployRequest struct {
|
||||||
RedeployRequest
|
RedeployRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redeploy redeploys compute
|
// Redeploy redeploys compute
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type ResetRequest struct {
|
|||||||
type wrapperResetRequest struct {
|
type wrapperResetRequest struct {
|
||||||
ResetRequest
|
ResetRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset resets compute
|
// Reset resets compute
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ func (r ResizeRequest) GetRAM() map[string]uint64 {
|
|||||||
type wrapperResizeRequest struct {
|
type wrapperResizeRequest struct {
|
||||||
ResizeRequest
|
ResizeRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resize resizes compute instance
|
// Resize resizes compute instance
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type RestoreRequest struct {
|
|||||||
type wrapperRestoreRequest struct {
|
type wrapperRestoreRequest struct {
|
||||||
RestoreRequest
|
RestoreRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore restores compute from recycle bin
|
// Restore restores compute from recycle bin
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type ResumeRequest struct {
|
|||||||
type wrapperResumeRequest struct {
|
type wrapperResumeRequest struct {
|
||||||
ResumeRequest
|
ResumeRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resume resume Compute from paused state
|
// Resume resume Compute from paused state
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ type SnapshotCreateRequest struct {
|
|||||||
|
|
||||||
type wrapperSnapshotCreateRequest struct {
|
type wrapperSnapshotCreateRequest struct {
|
||||||
SnapshotCreateRequest
|
SnapshotCreateRequest
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SnapshotCreate creates compute snapshot
|
// SnapshotCreate creates compute snapshot
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ type SnapshotDeleteRequest struct {
|
|||||||
type wrapperSnapshotDeleteRequeststruct struct {
|
type wrapperSnapshotDeleteRequeststruct struct {
|
||||||
SnapshotDeleteRequest
|
SnapshotDeleteRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SnapshotDelete deletes specified compute snapshot
|
// SnapshotDelete deletes specified compute snapshot
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type SnapshotRollbackRequest struct {
|
|||||||
|
|
||||||
type wrapperSnapshotRollbackRequest struct {
|
type wrapperSnapshotRollbackRequest struct {
|
||||||
SnapshotRollbackRequest
|
SnapshotRollbackRequest
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SnapshotRollback rollbacks specified compute snapshot
|
// SnapshotRollback rollbacks specified compute snapshot
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ type StartRequest struct {
|
|||||||
type wrapperStartRequest struct {
|
type wrapperStartRequest struct {
|
||||||
StartRequest
|
StartRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start starts compute
|
// Start starts compute
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ type StopRequest struct {
|
|||||||
type wrapperStopRequest struct {
|
type wrapperStopRequest struct {
|
||||||
StopRequest
|
StopRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop stops compute
|
// Stop stops compute
|
||||||
|
|||||||
@@ -79,6 +79,11 @@ type UpdateRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
// Default: reset
|
// Default: reset
|
||||||
WatchdogAction string `url:"watchdog_action,omitempty" json:"watchdog_action,omitempty" validate:"omitempty,watchdogAction"`
|
WatchdogAction string `url:"watchdog_action,omitempty" json:"watchdog_action,omitempty" validate:"omitempty,watchdogAction"`
|
||||||
|
|
||||||
|
// Memory balloon mode. One of ["auto","legacy","none"]
|
||||||
|
// Required: false
|
||||||
|
// Default: none
|
||||||
|
MemoryBalloonMode string `url:"memory_balloon_mode,omitempty" json:"memory_balloon_mode,omitempty" validate:"omitempty,memoryBalloonMode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update updates some properties of the compute
|
// 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 := "/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
|
||||||
|
}
|
||||||
@@ -28,6 +28,8 @@ type UserGrantRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UserGrant grants user access to the compute
|
// UserGrant grants user access to the compute
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) UserGrant(ctx context.Context, req UserGrantRequest) (bool, error) {
|
func (c Compute) UserGrant(ctx context.Context, req UserGrantRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ type UserListRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UserList gets users list for compute
|
// UserList gets users list for compute
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) UserList(ctx context.Context, req UserListRequest) (*ListUsers, error) {
|
func (c Compute) UserList(ctx context.Context, req UserListRequest) (*ListUsers, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ type UserRevokeRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UserRevoke revokes user access to the compute
|
// UserRevoke revokes user access to the compute
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) UserRevoke(ctx context.Context, req UserRevokeRequest) (bool, error) {
|
func (c Compute) UserRevoke(ctx context.Context, req UserRevokeRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ type UserUpdateRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UserUpdate updates user access to the compute
|
// UserUpdate updates user access to the compute
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) UserUpdate(ctx context.Context, req UserUpdateRequest) (bool, error) {
|
func (c Compute) UserUpdate(ctx context.Context, req UserUpdateRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package disks
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -17,6 +18,17 @@ type ChangeDiskStoragePolicyRequest struct {
|
|||||||
// ID of the storage policy to which to connect for disk
|
// ID of the storage policy to which to connect for disk
|
||||||
// Required: true
|
// Required: true
|
||||||
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
|
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
|
||||||
|
|
||||||
|
// Keep current disk I/O tune settings in the domain XML
|
||||||
|
// Required: false
|
||||||
|
// Default: false
|
||||||
|
KeepCurrentIOTune interface{} `url:"keep_current_iotune,omitempty" json:"keep_current_iotune,omitempty" validate:"omitempty,isBool"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type wrapperChangeDiskStoragePolicyRequest struct {
|
||||||
|
ChangeDiskStoragePolicyRequest
|
||||||
|
|
||||||
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChangeDiskStoragePolicy changes storage policy for disk
|
// ChangeDiskStoragePolicy changes storage policy for disk
|
||||||
@@ -28,7 +40,12 @@ func (d Disks) ChangeDiskStoragePolicy(ctx context.Context, req ChangeDiskStorag
|
|||||||
|
|
||||||
url := "/cloudapi/disks/change_disk_storage_policy"
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -40,3 +57,30 @@ func (d Disks) ChangeDiskStoragePolicy(ctx context.Context, req ChangeDiskStorag
|
|||||||
|
|
||||||
return result, nil
|
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
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package disks
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -23,6 +24,12 @@ type DeleteRequest struct {
|
|||||||
Permanently bool `url:"permanently,omitempty" json:"permanently,omitempty"`
|
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
|
// Delete deletes disk by ID
|
||||||
func (d Disks) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
func (d Disks) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -32,7 +39,12 @@ func (d Disks) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
|||||||
|
|
||||||
url := "/cloudapi/disks/delete"
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -44,3 +56,30 @@ func (d Disks) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
|||||||
|
|
||||||
return result, nil
|
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
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package disks
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -19,6 +20,12 @@ type DisksDeleteRequest struct {
|
|||||||
Permanently bool `url:"permanently,omitempty" json:"permanently,omitempty"`
|
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
|
// DeleteDisks deletes multiple disks permanently
|
||||||
func (d Disks) DeleteDisks(ctx context.Context, req DisksDeleteRequest) (bool, error) {
|
func (d Disks) DeleteDisks(ctx context.Context, req DisksDeleteRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -28,7 +35,12 @@ func (d Disks) DeleteDisks(ctx context.Context, req DisksDeleteRequest) (bool, e
|
|||||||
|
|
||||||
url := "/cloudapi/disks/deleteDisks"
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -40,3 +52,30 @@ func (d Disks) DeleteDisks(ctx context.Context, req DisksDeleteRequest) (bool, e
|
|||||||
|
|
||||||
return result, nil
|
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
|
||||||
|
}
|
||||||
@@ -35,10 +35,6 @@ type FromPlatformDiskRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
Password string `url:"password,omitempty" json:"password,omitempty"`
|
Password string `url:"password,omitempty" json:"password,omitempty"`
|
||||||
|
|
||||||
// Account ID to make the image exclusive
|
|
||||||
// Required: false
|
|
||||||
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
|
|
||||||
|
|
||||||
// Pool for image create
|
// Pool for image create
|
||||||
// Required: false
|
// Required: false
|
||||||
PoolName string `url:"poolName,omitempty" json:"poolName,omitempty"`
|
PoolName string `url:"poolName,omitempty" json:"poolName,omitempty"`
|
||||||
@@ -54,11 +50,13 @@ type FromPlatformDiskRequest struct {
|
|||||||
|
|
||||||
type wrapperFromPlatformDiskRequest struct {
|
type wrapperFromPlatformDiskRequest struct {
|
||||||
FromPlatformDiskRequest
|
FromPlatformDiskRequest
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// FromPlatformDisk creates template from platform disk in sync mode.
|
// FromPlatformDisk creates template from platform disk in sync mode.
|
||||||
// It returns id of created disk and error.
|
// It returns id of created disk and error.
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (d Disks) FromPlatformDisk(ctx context.Context, req FromPlatformDiskRequest) (uint64, error) {
|
func (d Disks) FromPlatformDisk(ctx context.Context, req FromPlatformDiskRequest) (uint64, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -87,6 +85,8 @@ func (d Disks) FromPlatformDisk(ctx context.Context, req FromPlatformDiskRequest
|
|||||||
|
|
||||||
// FromPlatformDiskAsync creates template from platform disk in async mode.
|
// FromPlatformDiskAsync creates template from platform disk in async mode.
|
||||||
// It returns guid of task and error.
|
// It returns guid of task and error.
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (d Disks) FromPlatformDiskAsync(ctx context.Context, req FromPlatformDiskRequest) (string, error) {
|
func (d Disks) FromPlatformDiskAsync(ctx context.Context, req FromPlatformDiskRequest) (string, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package disks
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -66,11 +67,41 @@ type LimitIORequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
WriteIOPSSecMax uint64 `url:"write_iops_sec_max,omitempty" json:"write_iops_sec_max,omitempty"`
|
WriteIOPSSecMax uint64 `url:"write_iops_sec_max,omitempty" json:"write_iops_sec_max,omitempty"`
|
||||||
|
|
||||||
|
// Duration in seconds of the total bytes burst. Requires TotalBytesSecMax
|
||||||
|
// Required: false
|
||||||
|
TotalBytesSecMaxLength uint64 `url:"total_bytes_sec_max_length,omitempty" json:"total_bytes_sec_max_length,omitempty"`
|
||||||
|
|
||||||
|
// Duration in seconds of the read bytes burst. Requires ReadBytesSecMax
|
||||||
|
// Required: false
|
||||||
|
ReadBytesSecMaxLength uint64 `url:"read_bytes_sec_max_length,omitempty" json:"read_bytes_sec_max_length,omitempty"`
|
||||||
|
|
||||||
|
// Duration in seconds of the write bytes burst. Requires WriteBytesSecMax
|
||||||
|
// Required: false
|
||||||
|
WriteBytesSecMaxLength uint64 `url:"write_bytes_sec_max_length,omitempty" json:"write_bytes_sec_max_length,omitempty"`
|
||||||
|
|
||||||
|
// Duration in seconds of the total IOPS burst. Requires TotalIOPSSecMax
|
||||||
|
// Required: false
|
||||||
|
TotalIOPSSecMaxLength uint64 `url:"total_iops_sec_max_length,omitempty" json:"total_iops_sec_max_length,omitempty"`
|
||||||
|
|
||||||
|
// Duration in seconds of the read IOPS burst. Requires ReadIOPSSecMax
|
||||||
|
// Required: false
|
||||||
|
ReadIOPSSecMaxLength uint64 `url:"read_iops_sec_max_length,omitempty" json:"read_iops_sec_max_length,omitempty"`
|
||||||
|
|
||||||
|
// Duration in seconds of the write IOPS burst. Requires WriteIOPSSecMax
|
||||||
|
// Required: false
|
||||||
|
WriteIOPSSecMaxLength uint64 `url:"write_iops_sec_max_length,omitempty" json:"write_iops_sec_max_length,omitempty"`
|
||||||
|
|
||||||
// SizeIOPSSec
|
// SizeIOPSSec
|
||||||
// Required: false
|
// Required: false
|
||||||
SizeIOPSSec uint64 `url:"size_iops_sec,omitempty" json:"size_iops_sec,omitempty"`
|
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
|
// LimitIO limit IO for a certain disk
|
||||||
// total and read/write options are not allowed to be combined
|
// total and read/write options are not allowed to be combined
|
||||||
// see http://libvirt.org/formatdomain.html#elementsDisks iotune section for more details
|
// see http://libvirt.org/formatdomain.html#elementsDisks iotune section for more details
|
||||||
@@ -82,7 +113,12 @@ func (d Disks) LimitIO(ctx context.Context, req LimitIORequest) (bool, error) {
|
|||||||
|
|
||||||
url := "/cloudapi/disks/limitIO"
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -94,3 +130,32 @@ func (d Disks) LimitIO(ctx context.Context, req LimitIORequest) (bool, error) {
|
|||||||
|
|
||||||
return result, nil
|
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
|
||||||
|
}
|
||||||
@@ -154,6 +154,9 @@ type ItemDisk struct {
|
|||||||
|
|
||||||
// Cache mode of disk
|
// Cache mode of disk
|
||||||
Cache string `json:"cache"`
|
Cache string `json:"cache"`
|
||||||
|
|
||||||
|
// Whether CRT is tracked
|
||||||
|
CRTTracking bool `json:"crt_tracking"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ItemDiskUnattached struct {
|
type ItemDiskUnattached struct {
|
||||||
@@ -300,6 +303,9 @@ type ItemDiskUnattached struct {
|
|||||||
|
|
||||||
// Virtual machine ID
|
// Virtual machine ID
|
||||||
VMID uint64 `json:"vmid"`
|
VMID uint64 `json:"vmid"`
|
||||||
|
|
||||||
|
// Whether CRT is tracked
|
||||||
|
CRTTracking bool `json:"crt_tracking"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of disks searched
|
// List of disks searched
|
||||||
@@ -549,6 +555,9 @@ type RecordDisk struct {
|
|||||||
|
|
||||||
// Cache mode of disk
|
// Cache mode of disk
|
||||||
Cache string `json:"cache"`
|
Cache string `json:"cache"`
|
||||||
|
|
||||||
|
// Whether CRT is tracked
|
||||||
|
CRTTracking bool `json:"crt_tracking"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ItemReplication struct {
|
type ItemReplication struct {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package disks
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -19,6 +20,12 @@ type RenameRequest struct {
|
|||||||
Name string `url:"name" json:"name" validate:"required"`
|
Name string `url:"name" json:"name" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type wrapperRenameRequest struct {
|
||||||
|
RenameRequest
|
||||||
|
|
||||||
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
|
}
|
||||||
|
|
||||||
// Rename renames disk
|
// Rename renames disk
|
||||||
func (d Disks) Rename(ctx context.Context, req RenameRequest) (bool, error) {
|
func (d Disks) Rename(ctx context.Context, req RenameRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -28,7 +35,12 @@ func (d Disks) Rename(ctx context.Context, req RenameRequest) (bool, error) {
|
|||||||
|
|
||||||
url := "/cloudapi/disks/rename"
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -40,3 +52,30 @@ func (d Disks) Rename(ctx context.Context, req RenameRequest) (bool, error) {
|
|||||||
|
|
||||||
return result, nil
|
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
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package disks
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -29,6 +30,20 @@ type ReplicateRequest struct {
|
|||||||
// ID of the storage policy under the disk will be created
|
// ID of the storage policy under the disk will be created
|
||||||
// Required: true
|
// Required: true
|
||||||
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
|
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
|
||||||
|
|
||||||
|
// Copy rate for an asynchronous replication pair (in MB/s)
|
||||||
|
// Required: false
|
||||||
|
CopyRate uint64 `url:"copy_rate,omitempty" json:"copy_rate,omitempty"`
|
||||||
|
|
||||||
|
// Name of the schedule from the replication profile
|
||||||
|
// Required: false
|
||||||
|
Schedule string `url:"schedule,omitempty" json:"schedule,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type wrapperReplicateRequest struct {
|
||||||
|
ReplicateRequest
|
||||||
|
|
||||||
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replicate create an empty disk in chosen SEP and pool combination.
|
// Replicate create an empty disk in chosen SEP and pool combination.
|
||||||
@@ -42,7 +57,12 @@ func (d Disks) Replicate(ctx context.Context, req ReplicateRequest) (uint64, err
|
|||||||
|
|
||||||
url := "/cloudapi/disks/replicate"
|
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 {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
@@ -54,3 +74,32 @@ func (d Disks) Replicate(ctx context.Context, req ReplicateRequest) (uint64, err
|
|||||||
|
|
||||||
return result, nil
|
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
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package disks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ReplicationDisableScheduleRequest to remove the schedule from an asynchronous replication pair
|
||||||
|
type ReplicationDisableScheduleRequest struct {
|
||||||
|
// Disk ID
|
||||||
|
// Required: true
|
||||||
|
DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReplicationDisableScheduleRequest removes the schedule from an asynchronous replication pair
|
||||||
|
func (d Disks) ReplicationDisableSchedule(ctx context.Context, req ReplicationDisableScheduleRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/disks/replication_disable_schedule"
|
||||||
|
|
||||||
|
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package disks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ReplicationManualSyncRequest to start manual synchronization of an asynchronous replication pair
|
||||||
|
type ReplicationManualSyncRequest struct {
|
||||||
|
// Disk ID
|
||||||
|
// Required: true
|
||||||
|
DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReplicationManualSync starts manual synchronization of an asynchronous replication pair
|
||||||
|
func (d Disks) ReplicationManualSync(ctx context.Context, req ReplicationManualSyncRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/disks/replication_manual_sync"
|
||||||
|
|
||||||
|
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package disks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ReplicationPromoteRequest to promote the primary side of an asynchronous replication pair
|
||||||
|
type ReplicationPromoteRequest struct {
|
||||||
|
// Disk ID
|
||||||
|
// Required: true
|
||||||
|
DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type wrapperReplicationPromoteRequest struct {
|
||||||
|
ReplicationPromoteRequest
|
||||||
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReplicationPromote promotes the primary side of an asynchronous replication pair
|
||||||
|
func (d Disks) ReplicationPromote(ctx context.Context, req ReplicationPromoteRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/disks/replication_promote"
|
||||||
|
|
||||||
|
aReq := wrapperReplicationPromoteRequest{
|
||||||
|
ReplicationPromoteRequest: req,
|
||||||
|
AsyncMode: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReplicationPromoteAsync promotes the primary side of an asynchronous replication pair in async mode
|
||||||
|
func (d Disks) ReplicationPromoteAsync(ctx context.Context, req ReplicationPromoteRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/disks/replication_promote"
|
||||||
|
|
||||||
|
aReq := wrapperReplicationPromoteRequest{
|
||||||
|
ReplicationPromoteRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
var resp string
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &resp)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package disks
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -15,6 +16,12 @@ type ReplicationResumeRequest struct {
|
|||||||
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
|
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type wrapperReplicationResumeRequest struct {
|
||||||
|
ReplicationResumeRequest
|
||||||
|
|
||||||
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
|
}
|
||||||
|
|
||||||
// ReplicationResume resume suspended replication
|
// ReplicationResume resume suspended replication
|
||||||
func (d Disks) ReplicationResume(ctx context.Context, req ReplicationResumeRequest) (bool, error) {
|
func (d Disks) ReplicationResume(ctx context.Context, req ReplicationResumeRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -24,7 +31,12 @@ func (d Disks) ReplicationResume(ctx context.Context, req ReplicationResumeReque
|
|||||||
|
|
||||||
url := "/cloudapi/disks/replicationResume"
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -36,3 +48,30 @@ func (d Disks) ReplicationResume(ctx context.Context, req ReplicationResumeReque
|
|||||||
|
|
||||||
return result, nil
|
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
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package disks
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -13,6 +14,16 @@ type ReplicationReverseRequest struct {
|
|||||||
// Id of the disk
|
// Id of the disk
|
||||||
// Required: true
|
// Required: true
|
||||||
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
|
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
|
||||||
|
|
||||||
|
// Use planned failover for asynchronous replication
|
||||||
|
// Required: false
|
||||||
|
Planned interface{} `url:"planned,omitempty" json:"planned,omitempty" validate:"omitempty,isBool"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type wrapperReplicationReverseRequest struct {
|
||||||
|
ReplicationReverseRequest
|
||||||
|
|
||||||
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReplicationReverse change role between disks replications
|
// ReplicationReverse change role between disks replications
|
||||||
@@ -24,7 +35,12 @@ func (d Disks) ReplicationReverse(ctx context.Context, req ReplicationReverseReq
|
|||||||
|
|
||||||
url := "/cloudapi/disks/replicationReverse"
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -36,3 +52,30 @@ func (d Disks) ReplicationReverse(ctx context.Context, req ReplicationReverseReq
|
|||||||
|
|
||||||
return result, nil
|
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
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package disks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ReplicationSetCopyRateRequest to set the copy rate of an asynchronous replication pair
|
||||||
|
type ReplicationSetCopyRateRequest struct {
|
||||||
|
// Disk ID
|
||||||
|
// Required: true
|
||||||
|
DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"`
|
||||||
|
|
||||||
|
// Copy rate in MB/s
|
||||||
|
// Required: true
|
||||||
|
CopyRate uint64 `url:"copy_rate" json:"copy_rate" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReplicationSetCopyRate sets the copy rate of an asynchronous replication pair
|
||||||
|
func (d Disks) ReplicationSetCopyRate(ctx context.Context, req ReplicationSetCopyRateRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/disks/replication_set_copy_rate"
|
||||||
|
|
||||||
|
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package disks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ReplicationSetScheduleRequest to apply a replication profile schedule to an asynchronous replication pair
|
||||||
|
type ReplicationSetScheduleRequest struct {
|
||||||
|
// Disk ID
|
||||||
|
// Required: true
|
||||||
|
DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"`
|
||||||
|
|
||||||
|
// ID of the replication profile assigned to the pair
|
||||||
|
// Required: true
|
||||||
|
ProfileID uint64 `url:"profile_id" json:"profile_id" validate:"required"`
|
||||||
|
|
||||||
|
// Name of the interval or calendar schedule from the profile
|
||||||
|
// Required: true
|
||||||
|
ScheduleName string `url:"schedule_name" json:"schedule_name" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReplicationSetSchedule applies a replication profile schedule to an asynchronous replication pair
|
||||||
|
func (d Disks) ReplicationSetSchedule(ctx context.Context, req ReplicationSetScheduleRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/disks/replication_set_schedule"
|
||||||
|
|
||||||
|
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package disks
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -17,6 +18,20 @@ type ReplicationStartRequest struct {
|
|||||||
// ID of target disk. Secondary disk in replication
|
// ID of target disk. Secondary disk in replication
|
||||||
// Required: true
|
// Required: true
|
||||||
TargetDiskID uint64 `url:"targetDiskId" json:"targetDiskId" validate:"required"`
|
TargetDiskID uint64 `url:"targetDiskId" json:"targetDiskId" validate:"required"`
|
||||||
|
|
||||||
|
// Copy rate for an asynchronous replication pair (in MB/s)
|
||||||
|
// Required: false
|
||||||
|
CopyRate uint64 `url:"copy_rate,omitempty" json:"copy_rate,omitempty"`
|
||||||
|
|
||||||
|
// Name of the schedule from the replication profile
|
||||||
|
// Required: false
|
||||||
|
Schedule string `url:"schedule,omitempty" json:"schedule,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
// ReplicationStart starts replication between two chosen disks. It's required for both disks to have same size to avoid replication conflicts
|
||||||
@@ -29,7 +44,12 @@ func (d Disks) ReplicationStart(ctx context.Context, req ReplicationStartRequest
|
|||||||
|
|
||||||
url := "/cloudapi/disks/replicationStart"
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -41,3 +61,31 @@ func (d Disks) ReplicationStart(ctx context.Context, req ReplicationStartRequest
|
|||||||
|
|
||||||
return result, nil
|
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
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package disks
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -15,6 +16,12 @@ type ReplicationStopRequest struct {
|
|||||||
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
|
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
|
// ReplicationStop remove replication between disks completely
|
||||||
func (d Disks) ReplicationStop(ctx context.Context, req ReplicationStopRequest) (bool, error) {
|
func (d Disks) ReplicationStop(ctx context.Context, req ReplicationStopRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -24,7 +31,12 @@ func (d Disks) ReplicationStop(ctx context.Context, req ReplicationStopRequest)
|
|||||||
|
|
||||||
url := "/cloudapi/disks/replicationStop"
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -36,3 +48,30 @@ func (d Disks) ReplicationStop(ctx context.Context, req ReplicationStopRequest)
|
|||||||
|
|
||||||
return result, nil
|
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
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package disks
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -15,6 +16,12 @@ type ReplicationSuspendRequest struct {
|
|||||||
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
|
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
|
// ReplicationSuspend pause replication with possibility to resume from pause moment
|
||||||
func (d Disks) ReplicationSuspend(ctx context.Context, req ReplicationSuspendRequest) (bool, error) {
|
func (d Disks) ReplicationSuspend(ctx context.Context, req ReplicationSuspendRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -24,7 +31,12 @@ func (d Disks) ReplicationSuspend(ctx context.Context, req ReplicationSuspendReq
|
|||||||
|
|
||||||
url := "/cloudapi/disks/replicationSuspend"
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -36,3 +48,30 @@ func (d Disks) ReplicationSuspend(ctx context.Context, req ReplicationSuspendReq
|
|||||||
|
|
||||||
return result, nil
|
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
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package disks
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -19,6 +20,12 @@ type ResizeRequest struct {
|
|||||||
Size uint64 `url:"size" json:"size" validate:"required"`
|
Size uint64 `url:"size" json:"size" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type wrapperResizeRequest struct {
|
||||||
|
ResizeRequest
|
||||||
|
|
||||||
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
|
}
|
||||||
|
|
||||||
// Resize2 resize disk
|
// Resize2 resize disk
|
||||||
// Returns 200 if disk is resized online, else will return 202,
|
// 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.
|
// 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"
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -43,3 +55,33 @@ func (d Disks) Resize2(ctx context.Context, req ResizeRequest) (bool, error) {
|
|||||||
|
|
||||||
return result, nil
|
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
|
||||||
|
}
|
||||||
Loaded 100 of 405 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user