Compare commits

..

6 Commits

Author SHA1 Message Date
77cbe6952b upd CHANGELOG 2026-07-10 12:47:34 +00:00
dayterr
0595b5ae39 v15.5.0
v15.5.0
2026-07-10 15:44:33 +03:00
55fe76d12e v15.4.0 2026-07-02 14:30:23 +03:00
db594a9d81 v15.3.0 2026-06-26 16:56:08 +04:00
dayterr
538f5cf026 v15.2.0
v15.2.0
2026-06-19 16:49:23 +03:00
f6acddaa8d v15.1.0 2026-06-11 16:54:48 +04:00
75 changed files with 1395 additions and 721 deletions

View File

@@ -1,199 +1,79 @@
## Version 15.0.0
Методы `Audits` в cloudapi/compute, cloudbroker/compute, cloudapi/account, cloudbroker/account, cloudapi/vins, cloudbroker/vins, cloudapi/rg и cloudbroker/rg стали deprecated и в следующих версиях будут удалены, вместо них необходимо использовать метод `List` в cloudapi/audit и cloudbroker/audit с соответствующими фильтрами
Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke`, `AccessRevokeToPool` в cloudbroker/sep стали deprecated и в следующих версиях будут удалены
Методы `ComputeCISet`, `ComputeCIUnset`, `GetAudits` в cloudbroker/compute и `GetAudits` в cloudapi/compute стали deprecated и будут удалены в следующих версиях
Методы `ComputeCISet`, `ComputeCIUnset` в cloudbroker/image стали deprecated и будут удалены в следующих версиях
Все методы группы `.SDN()` находятся в альфа-версии.
## Version 15.5.0
Методы `Audits` в cloudapi/compute, cloudbroker/compute, cloudapi/account, cloudbroker/account, cloudapi/vins, cloudbroker/vins, cloudapi/rg и cloudbroker/rg стали deprecated и будут удалены в версии 16.0, вместо них необходимо использовать метод `List` в cloudapi/audit и cloudbroker/audit с соответствующими фильтрами
Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke`, `AccessRevokeToPool` в cloudbroker/sep стали deprecated и будут удалены в версии 16.0
Методы `ComputeCISet`, `ComputeCIUnset`, `GetAudits` в cloudbroker/compute и `GetAudits` в cloudapi/compute стали deprecated и будут удалены в версии 16.0
Методы `ComputeCISet`, `ComputeCIUnset` в cloudbroker/image стали deprecated и будут удалены в версии 16.0
Методы `Delete`, `Disable`, `Enable`, `GetConsumedCloudUnitsByType`, `GetReservedAccountUnits` в cloudapi/account стали deprecated и будут удалены в версии 16.0
Методы `Disable`, `Enable` в cloudbroker/account стали deprecated и будут удалены в версии 16.0
Метод `IsValidInviteUserToken` в cloudapi/user стал deprecated и будет удален в версии 16.0
Метод `GetLog` в cloudbroker/compute стал deprecated и будет удален в версии 16.0
Методы `ExecuteMaintenanceScript`, `ListEmails`, `ServicesRestart` в cloudbroker/grid стали deprecated и будут удалены в версии 16.0
Метод `Get` в cloudbroker/group стал deprecated и будет удален в версии 16.0
### Добавлено
#### compute
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-864 | Методы `GetCPUAlignmentProfile`, `SetCPUAlignmentProfile` и `DeleteCPUAlignmentProfile` в cloudapi/compute и cloudbroker/compute |
| BGOS-864 | Структуры запросов `GetCPUAlignmentProfileRequest`, `SetCPUAlignmentProfileRequest` и `DeleteCPUAlignmentProfileRequest` в cloudapi/compute и cloudbroker/compute |
| BGOS-865 | Вычисляемое поле `CPUAlignmentProfile` в структуру ответа `RecordCompute` в cloudapi/compute и cloudbroker/compute |
| BGOS-865 | Вычисляемое поле `CPUAlignmentProfile` в структуру ответа `ItemCompute` в cloudapi/compute и cloudbroker/compute |
| BGOS-865 | Структура ответа `CPUAlignmentProfile` в cloudapi/compute и cloudbroker/compute |
| BGOS-872 | Опциональное поле `WithMemory` в структуру запроса `SnapshotCreateRequest` в cloudapi/compute и cloudbroker/compute |
| BGOS-872 | Опциональное поле `WithMemory` в структуру запроса `SnapshotRollbackRequest` в cloudapi/compute и cloudbroker/compute |
| BGOS-872 | Вычисляемые поля `MemoryDumpImage` и `Compute` в структуру ответа `ItemSnapshot` в cloudapi/compute и cloudbroker/compute |
| BGOS-872 | Методы `SnapshotCreateAsync`, `SnapshotRollbackAsync` и `AbortSharedSnapshotMergeAsync` в cloudapi/compute и cloudbroker/compute |
| BGOS-872 | Опциональное поле `NodeID` в структуру запроса `SnapshotRollbackRequest` в cloudbroker/compute |
| BGOS-877 | Опциональное поле `Clock` в структуру запроса `UpdateRequest` в cloudapi/compute и cloudbroker/compute |
| BGOS-877 | Вычисляемое поле `Clock` в структуры ответа `RecordCompute` и `ItemCompute` в cloudapi/compute|
| BGOS-877 | Вычисляемое поле `Clock` в структуры ответа `RecordCompute` и `InfoCompute` в cloudbroker/compute |
| BGOS-885 | Методы `CDEjectAsync`, `CDInsertAsync`, `ChangeIPAsync`, `ChangeLinkStateAsync`, `ChangeSecGroupsAsync`, `ChangeMTUAsync`, `CloneAsync`, `CreateTemplateAsync`, `DeleteAsync`, `DisableAsync`, `DiskAddAsync`, `DiskAttachAsync`, `DiskDelAsync`, `DiskDetachAsync`, `DiskQOSAsync`, `DiskResizeAsync`, `DiskSwitchToReplicationAsync`, `GuestAgentDisableAsync`, `GuestAgentEnableAsync`, `GuestAgentExecuteRequestAsync`, `GuestAgentFeatureUpdateAsync`, `MigrateToZoneAsync`, `MoveToRGAsync`, `NetAttachAsync`, `NetDetachAsync`, `PauseAsync`, `PFWAddAsync`, `PFWDelAsync`, `PinToNodeAsync`, `PowerCycleAsync`, `RebootAsync`, `RedeployAsync`, `ResetAsync`, `ResizeAsync`, `RestoreAsync`, `ResumeAsync`, `StartAsync`, `StopAsync`, `MassDeleteAsync`, `MassRebootAsync`, `MassStartAsync`, `MassStopAsync`, `MigrateAbortAsync`, `MigrateStorageAbortAsync`, `MigrateStorageCleanUpAsync`, `NetQOSAsync` и `RaiseDownAsync` в cloudbroker/compute |
| BGOS-885 | Методы `CDEjectAsync`, `CDInsertAsync`, `ChangeIPAsync`, `ChangeLinkStateAsync`, `ChangeMTUAsync`, `ChangeSecGroupsAsync`, `CloneAsync`, `DeleteAsync`, `DisableAsync`, `DiskAddAsync`, `DiskDelAsync`, `DiskAttachAsync`, `DiskDetachAsync`, `DiskQOSAsync`, `DiskResizeAsync`, `DiskSwitchToReplicationAsync`, `GuestAgentDisableAsync`, `GuestAgentEnableAsync`, `GuestAgentExecuteRequestAsync`, `GuestAgentFeatureUpdateAsync`, `MigrateToZoneAsync`, `MoveToRGAsync`, `NetAttachAsync`, `NetDetachAsync`, `PauseAsync`, `PFWAddAsync`, `PFWDelAsync`, `PinToNodeAsync`, `PowerCycleAsync`, `RebootAsync`, `RedeployAsync`, `ResetAsync`, `ResizeAsync`, `RestoreAsync`, `ResumeAsync`, `StartAsync` и `StopAsync` в cloudapi/compute |
| BGOS-894 | Опциональное поле `ReadOnly` в структуры запросов `DiskAddRequest` и `DiskAttachRequest` в cloudapi/compute и cloudbroker/compute |
| BGOS-894 | Опциональное поле `ReadOnly` в структуры ответа `InfoDisk` в cloudapi/compute и cloudbroker/compute |
| BGOS-894 | Опциональное поле `ReadOnly` в структуру ответа `ItemComputeDisk` в cloudapi/compute |
| BGOS-894 | Опциональное поле `ReadOnly` в структуру ответа `ItemDisk` в cloudbroker/compute |
| BGOS-954 | Вычисляемое поле `ResizedOnline` в структуры ответа `RecordCompute` и `ItemCompute` в cloudapi/compute и cloudbroker/compute |
#### disks
#### resmon
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-895 | Вычисляемое поле `ComputesReadOnly` в структуру ответа `InfoDisk` в cloudbroker/disks |
| BGOS-895 | Вычисляемое поле `ComputesReadOnly` в структуры ответа `ItemDisk` и `RecordDisk` в cloudapi/disks |
#### extnet
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-876 | Вычисляемое поле `FreeIPs` в структуру ответа `ItemExtNet` в cloudapi/extnet |
#### grid
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-888 | Вычисляемые поля `CPUAllocationRatio`, `CPUAllocationRatioVM`, `CustomBackupPath`, `InterfaceGenerationScheme`, `MACAddressPrefix`, `NodeSelfStopTimerUptimeMonitor` и `NodeSelfStopUptimeMonitor` в структуру ответа `RecordSettingsGrid` в cloudbroker/grid |
| BGOS-888 | Вычисляемое поле `ZeroAccessEnabled` в структуру ответа `RecordGrid` в cloudbroker/grid |
| BGOS-888 | Вычисляемое поле `Policies` в структуру ответа `RecordResource` и структура ответа `PolicyUsage` в cloudbroker/grid |
#### kvmx86
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-865 | Опциональное поле `CPUAlignmentProfile` в структуры запросов `CreateRequest` и `CreateBlankRequest` в cloudapi/kvmx86 и cloudbroker/kvmx86 |
| BGOS-865 | Опциональное поле `CPUAlignmentProfile` в структуру запроса `MassCreateRequest` в cloudbroker/kvmx86 |
| BGOS-877 | Опциональное поле `Clock` в структуры запросов `CreateRequest` и `CreateBlankRequest` в cloudapi/kvmx86 и cloudbroker/kvmx86 |
| BGOS-877 | Опциональное поле `Clock` в структуру запроса `MassCreateRequest` в cloudbroker/kvmx86 |
#### node
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-866 | Вычисляемые поля `OneGAvailable`, `OneGFree`, `OneGReserved`, `OneGUsed`, `OneGDPDKReserved`, `TwoMAvailable`, `TwoMFree`, `TwoMReserved` и `TwoMUsed` в структуру ответа `ItemMemory` в cloudbroker/node |
| BGOS-879 | Методы `GetPCIDevices`, `PCIDeviceDriverToVFIO` и `PCIDeviceDriverToKernel` в cloudbroker/node |
| BGOS-879 | Структуры запросов `GetPCIDevicesRequest`, `PCIDeviceDriverToVFIORequest` и `PCIDeviceDriverToKernelRequest` в cloudbroker/node |
| BGOS-879 | Структуры ответов `RecordPCIDeviceDriver`, `ListPCIDevices` и `ItemPCIDevice` в cloudbroker/node |
| BGOS-880 | Вычисляемое поле `PCIDevices` в структуру ответа `ItemNode` в cloudbroker/node |
| BGOS-882 | Метод `GetNetworkInfo` и структура запроса `GetNetworkInfoRequest` в cloudbroker/node |
| BGOS-882 | Структуры ответа `RecordNodeNetworkInfo`, `SystemNetworkInfo`, `OVSNetworkInfo`, `LibvirtNetworkInfo` и `NetworkTopology` в cloudbroker/node |
| BGOS-890 | Структура ответа `ItemNode` для методов `SetCpuAllocationRatio` и `SetMemAllocationRatio` в cloudbroker/node |
#### sep
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-873 | Метод `Update` и структура запроса `UpdateRequest` в cloudbroker/sep |
#### zone
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-862 | Метод `AddCPUAlignmentProfile` и структура запроса `AddCPUAlignmentProfileRequest` в cloudbroker/zone |
| BGOS-862 | Метод `DeleteCPUAlignmentProfile` и структура запроса `DeleteCPUAlignmentProfileRequest` в cloudbroker/zone |
| BGOS-862 | Метод `GetCPUAlignmentProfile` и структура запроса `GetCPUAlignmentProfileRequest` в cloudbroker/zone |
| BGOS-862 | Метод `ListCPUAlignmentProfile` и структура запроса `ListCPUAlignmentProfileRequest` в cloudbroker/zone |
| BGOS-862 | Метод `TestCPUAlignmentProfile` и структура запроса `TestCPUAlignmentProfileRequest` в cloudbroker/zone |
| BGOS-862 | Структуры ответов `ListCPUAlignmentProfiles`, `ItemCPUAlignmentProfile`, `TestCPUAlignmentProfileResult` и `CpuAlignmentProfileCandidate` в cloudbroker/zone |
| BGOS-863 | Вычисляемое поле `CpuAlignmentProfiles` в структуры ответа `RecordZone` и `ItemZone` и структура `CpuAlignmentProfile` в cloudapi/zone и cloudbroker/zone |
| BGOS-947 | Вычисляемое поле `UID` в структуру ответа `GetByNodePoint` в cloudbroker/resmon |
| BGOS-947 | Вычисляемые поля `ThreadCount`, `ModelName`, `Flags` и `MaxSupportedGeneration` в структуру ответа `CPUinfoByNode` в cloudbroker/resmon |
| BGOS-947 | Вычисляемые поля `UsedGiB` и `TotalGiB` в структуру ответа `ItemStorage` в cloudbroker/resmon |
#### SDN logicalports
| Идентификатор<br>задачи | Описание |
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-896 | Обязательное поле `ID` в структуру запроса `UpdateAddress` в sdn/logical_port |
#### SDN netobjgroups
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-884 | Опциональное поле `Type` в структуру запроса `ListRequest` в sdn/netobjgroups |
| BGOS-951 | Вычисляемое поле `ExcludeFirewall` в структуру ответа `LogicalPort` в sdn/logicalports |
### Изменено
#### account
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-887 | Тип поля `CPUAllocationRatio` с `float64` на `uint64` в структуре ответа `RecordAccount` в cloudapi/account |
| BGOS-887 | Тип поля `CPUAllocationRatio` с `float64` на `uint64` в структуре ответа `InfoAccount` в cloudbroker/account |
#### compute
| Идентификатор<br>задачи | Описание |
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-874 | Поле `StoragePolicyID` с обязательного на опциональное в структуре запроса `RedeployRequest` в cloudapi/compute и cloudbroker/compute |
| BGOS-870 | Тип поля `BLKDiscard` с `bool` на `string` и переименование в `Discard` в структуре ответа `ItemComputeDisk` в cloudapi/compute |
| BGOS-870 | Тип поля `BLKDiscard` с `bool` на `string` и переименование в `Discard` в структуре ответа `ItemDisk` в cloudbroker/compute|
| BGOS-870 | Тип поля `BLKDiscard` с `bool` на `string` и переименование в `Discard` в структуре запроса `DiskAddRequest` в cloudbroker/compute|
| BGOS-885 | Тип возвращаемого значения с `string` на `bool` в методе `Restore` в cloudapi/compute |
| BGOS-885 | Тип возвращаемого значения с `string` на `bool` в методе `MigrateStorageAbort` в cloudbroker/compute |
| BGOS-885 | Тип возвращаемого значения с `string` на `bool` в методе `MigrateStorageCleanUp` в cloudbroker/compute |
| BGOS-885 | Название метода с `Validate` на `MoveToRG` в cloudbroker/compute |
| BGOS-893 | Тип поля `SDNObjectGroupID` с `string` на `[]string` и переименование в `SDNObjectGroupIDs` в структуре запроса `NetAttachRequest` в cloudapi/compute и cloudbroker/compute |
#### disks
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-870 | Тип поля `BLKDiscard` с `bool` на `string` и переименование в `Discard` в структурах ответа `RecordDisk`, `ItemDisk` и `ItemDiskUnattached` в cloudapi/disks |
| BGOS-870 | Тип поля `BLKDiscard` с `bool` на `string` и переименование в `Discard` в структуре ответа `InfoDisk` в cloudbroker/disks |
| BGOS-870 | Тип поля `BLKDiscard` с `bool` на `string` и переименование в `Discard` в структурах запросов `CreateRequest` и `UpdateRequest` в cloudbroker/disks |
| BGOS-881 | Поле `StoragePolicyID` c опционального на обязательное в структуре запроса `MigrateRequest` в cloudbroker/disks |
#### grid
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-888 | Тип поля `Ratio` с `float64` на `uint64` в структурах запросов `SetCPUAllocationRatioRequest`, `SetCPUAllocationRatioForVMRequest` и `SetMemAllocationRatioRequest` в cloudbroker/grid |
#### image
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-860 | Тип ответа метода `MultiImageExport` со `string` на `uint64` в cloudbroker/image |
| BGOS-869 | Тип вычисляемого поля `AccountID` с опционального на обязательный в структуре `CreateVirtualRequest` в cloudapi/image |
| BGOS-878 | Тип поля `TypeImage` в структуре запроса `ListRequest` с `string` на `[]string` в cloudbroker/image и cloudapi/image |
#### kvmx86
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-870 | Тип поля `BLKDiscard` с `bool` на `string` и переименование в `Discard` в структуре ответа `DataDisk` в cloudbroker/kvmx86 |
| BGOS-870 | Тип поля `BootDiskBLKDiscard` с `bool` на `string` и переименование в `BootDiskDiscard` в структурах запросов `CreateRequest`, `CreateBlankRequest` и `MassCreateRequest` в cloudbroker/kvmx86 |
| BGOS-893 | Тип поля `SDNObjectGroupID` с `string` на `[]string` и переименование в `SDNObjectGroupIDs` в структуре `Interface` в cloudapi/kvmx86 и cloudbroker/kvmx86 |
| BGOS-893 | Тип поля `SDNObjectGroupID` с `string` на `[]string` и переименование в `SDNObjectGroupIDs` в структуре `InterfaceMassCreate` в cloudbroker/kvmx86 |
#### node
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-867 | Тип обязательного поля `Ratio` с `float64` на `uint64` в структурах запросов `SetMemAllocationRatioRequest` и `SetCpuAllocationRatioRequest` в cloudbroker/node |
| BGOS-889 | Тип поля `VCPU` с `float64` на `uint64` в структуре ответа `FreeResourcesInfo` в cloudbroker/node |
| BGOS-889 | Тип полей `CPUAllocationRatio` и `MemAllocationRatio` с `float64` на `uint64` в структурах ответа `RecordNode` и `ItemNode` в cloudbroker/node |
| BGOS-958 | Тип возвращаемого значения с `string` на `RecordMigrateStorageInfo` в методе `MigrateStorageInfo` в cloudbroker/compute |
#### resmon
| Идентификатор<br>задачи | Описание |
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-868 | Тип поля `EndTime` с обязательного на опциональное в структурах запроса `GetByNodeRequest`, `GetByNodesRequest` `GetByGRIDRequest`, `GetByComputeRequest` и `GetByComputesRequest` в cloudbroker/resmon |
| BGOS-947 | Тип вычисляемых полей `CPUTime` и `RAMConsumedReal` с `uint64` на `float64` в структуре ответа `ComputeUsage` в cloudbroker/resmon |
| BGOS-947 | Тип вычисляемого поля `IsUp` с `uint64` на `bool` в структуре ответа `ComputeUsage` в cloudbroker/resmon |
| BGOS-947 | Тип вычисляемого поля `SizeMax` с `float64` на `uint64` в структуре ответа `ItemDisk` в cloudbroker/resmon |
| BGOS-947 | Тип вычисляемых полей `CPUPower`, `CPUUtil`, `TotalMem`, `ReservedMem`, `UsedMem` и `FreeMem` с `uint64` на `float64` в структуре ответа `ItemTotalByGRID` в cloudbroker/resmon |
| BGOS-947 | Тип вычисляемых полей `PCPU` и `CPUUtil` с `uint64` на `float64` в структуре ответа `NodeUsage` в cloudbroker/resmon |
#### rg
| Идентификатор<br>задачи | Описание |
#### SDN hypervisors
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-886 | Тип поля `CPUAllocationRatio` с `float64` на `uint64` в структурах ответа `RecordResourceGroup` и `ItemResourceGroup` в cloudapi/rg |
| BGOS-886 | Тип поля `CPUAllocationRatio` с `float64` на `uint64` в структуре ответа `ItemRG` в cloudbroker/rg |
| BGOS-886 | Тип поля `Ratio` с `float64` на `uint64` в структуре запроса `SetCPUAllocationRatioRequest` в cloudbroker/rg |
#### user
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-891 | Тип поля `Password` с опционального на обязательный в структуре запроса `CreateRequest` в cloudbroker/user |
| BGOS-956 | Тип возвращаемого значения в методе `Delete` c `bool` на `RecordVersion` в sdn/hypervisors |
#### SDN logicalports
| Идентификатор<br>задачи | Описание |
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-896 | Тип полей `IsDiscovered` и `MAC` с опционального на обязательный в структурах запроса `UpdateAddress` и `AddAddress` в sdn/logical_port |
| BGOS-896 | Тип поля `IsDiscovered` с опционального на обязательный в структуре запроса `LogicalPortAddressRequest` в sdn/logical_port
| BGOS-896 | Тип полей `IsDiscovered`, `MAC` с `interface` на `bool` в структурах запроса `UpdateAddress`, `AddAddress`, `LogicalPortAddressRequest` в sdn/logical_port/update |
| BGOS-951 | Тип опционального поля `LogicalPortAddresses` в структуре запроса `CreateRequest` с `[]LogicalPortAddress` на `[]LogicalPortAddressRequest` в sdn/logicalports |
| BGOS-951 | Тип обязательного поля `IP` в структуре запроса `LogicalPortAddressRequest` с `string` на `interface{}` в sdn/logicalports |
| BGOS-951 | Тип обязательного поля `IsDiscovered` в структуре запроса `UpdateAddress` и `AddAddress` с `bool` на `interface{}` в sdn/logicalports |
| BGOS-951 | Тип опционального поля `Labels` в структуре запроса `CreateRequest` с `CreateLabels` на `*CreateLabels` в sdn/logicalports |
| BGOS-951 | Тип опционального поля `Labels` в структуре запроса `UpdateRequest` с `UpdateLabels` на `*UpdateLabels` в sdn/logicalports |
### Исправлено
#### vfpool
| Идентификатор<br>задачи | Описание |
#### SDN netobjgroups
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-871 | Тип поля `Config` в структуре запроса `wrapperUpdateRequest` с `[]string` на `string` в cloudbroker/vfpool |
| BGOS-957 | Тип вычисляемого поля `ExternalNetworkPorts` с массива на объект в sdn/netobjgroups |
### Удалено
#### grid
| Идентификатор<br>задачи | Описание |
#### resmon
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-888 | Вычисляемые поля `CKey` и `Meta` из структуры ответа `RecordGrid` в cloudbroker/grid |
| BGOS-947 | Вычисляемые поля `NodesCPU`, `StorageCapacity` и `VCPUConsumed` из структуры ответа `ItemTotalByGRID` в cloudbroker/resmon |
| BGOS-947 | Вычисляемые поля `CapacityLimit`, `Consumed`, `Type` и `UID` из структуры ответа `ItemStorage` в cloudbroker/resmon |
#### user
| Идентификатор<br>задачи | Описание |
#### SDN netobjgroups
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-861 | Значение по умолчанию опционального поля `Password` в структуре запроса `CreateRequest` в cloudbroker/user |
| BGOS-875 | Опциональное поле `Password` из структуры ответа `ItemUser` в cloudbroker/user |
| BGOS-957 | Вычисляемые поля `Comment`, `Enabled`, `IPv4` и `MAC` в структуре `ExternalNetworkPorts` в структуре ответа `RecordNetObjGroup` в sdn/netobjgroups |

View File

@@ -36,6 +36,10 @@ type DecortClient struct {
// Сlient builder
func New(cfg config.Config) *DecortClient {
if err := validators.ValidateConfig(cfg); err != nil {
panic(validators.ValidationErrors(validators.GetErrors(err)))
}
if cfg.Retries == 0 {
cfg.Retries = 5
}

View File

@@ -16,6 +16,7 @@ import (
"github.com/google/go-querystring/query"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/config"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/pkg/cloudapi"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/pkg/cloudbroker"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/pkg/sdn"
@@ -38,6 +39,10 @@ type tokenJSON struct {
// Сlient builder
func NewBVS(cfg config.BVSConfig) *BVSDecortClient {
if err := validators.ValidateConfig(cfg); err != nil {
panic(validators.ValidationErrors(validators.GetErrors(err)))
}
if cfg.Retries == 0 {
cfg.Retries = 5
}

View File

@@ -350,6 +350,10 @@ func isBoolTypeValidator(fe validator.FieldLevel) bool {
return fe.Field().CanConvert(reflect.TypeOf(true))
}
func isStringTypeValidator(fe validator.FieldLevel) bool {
return fe.Field().Kind() == reflect.String
}
func urlValidartor(fl validator.FieldLevel) bool {
fieldValues := fl.Field().String()

View File

@@ -27,6 +27,8 @@ func errorMessage(fe validator.FieldError) string {
return fmt.Sprintf("%s %s: unexpected E-Mail format", prefix, fe.Field())
case "isBool":
return fmt.Sprintf("%s %s: must be bool type", prefix, fe.Field())
case "isString":
return fmt.Sprintf("%s %s: must be string type", prefix, fe.Field())
case "accessType":
return fmt.Sprintf("%s %s must be one of the following: %s",

View File

@@ -231,6 +231,11 @@ func registerAllValidators(validate *validator.Validate) error {
return err
}
err = validate.RegisterValidation("isString", isStringTypeValidator)
if err != nil {
return err
}
err = validate.RegisterValidation("url", urlValidartor)
if err != nil {
return err

View File

@@ -16,6 +16,7 @@ import (
"github.com/google/go-querystring/query"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/config"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/pkg/cloudapi"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/pkg/cloudbroker"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/pkg/sdn"
@@ -32,6 +33,10 @@ type LegacyDecortClient struct {
// Legacy client builder
func NewLegacy(cfg config.LegacyConfig) *LegacyDecortClient {
if err := validators.ValidateConfig(cfg); err != nil {
panic(validators.ValidationErrors(validators.GetErrors(err)))
}
if cfg.Retries == 0 {
cfg.Retries = 5
}

View File

@@ -8,7 +8,7 @@ type Audit struct {
}
// Builder for audit endpoint
func New(client interfaces.Caller) *Audit{
func New(client interfaces.Caller) *Audit {
return &Audit{
client: client,
}

View File

@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)

View File

@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)

View File

@@ -86,7 +86,7 @@ type ItemSnapshot struct {
// Compute info
Compute RecordCompute `json:"compute"`
// List disk ID
// List of disk IDs
Disks []uint64 `json:"disks"`
// GUID
@@ -182,6 +182,9 @@ type RecordNetAttach struct {
// Enabled
Enabled bool `json:"enabled"`
// Enable default gateway
EnableDefaultGateway bool `json:"enable_default_gateway"`
// Enable security groups
EnableSecGroups bool `json:"enable_secgroups"`
@@ -479,6 +482,9 @@ type RecordCompute struct {
// Natable VINS network name
NatableVINSNetworkName string `json:"natableVinsNetworkName"`
// Node ID
NodeID uint64 `json:"node_id"`
// Name of OS
OSVersion string `json:"os_version"`
@@ -509,6 +515,264 @@ type RecordCompute struct {
// Registered or not
Registered bool `json:"registered"`
// Whether a compute has been resized online
ResizedOnline bool `json:"resizedOnline"`
// Resource name
ResName string `json:"resName"`
// Reserved Node Cpus
ReservedNodeCpus []uint64 `json:"reservedNodeCpus"`
// Resource group ID
RGID uint64 `json:"rgId"`
// Resource group name
RGName string `json:"rgName"`
// List snapsets
SnapSets ListSnapSets `json:"snapSets"`
// Stateless SepID
StatelessSepID int64 `json:"statelessSepId"`
// Stateless SepType
StatelessSepType string `json:"statelessSepType"`
// Status
Status string `json:"status"`
// Tags
Tags map[string]string `json:"tags"`
// Tech status
TechStatus string `json:"techStatus"`
// Updated by
UpdatedBy string `json:"updatedBy"`
// Updated time
UpdatedTime uint64 `json:"updatedTime"`
// User Managed or not
UserManaged bool `json:"userManaged"`
// Userdata
Userdata interface{} `json:"userdata"`
// vGPUs list
VGPUs []VGPUItem `json:"vgpus"`
// VNC password
VNCPassword string `json:"vncPasswd"`
// Weight
Weight uint64 `json:"weight"`
// Zone ID
// Required: false
ZoneID uint64 `json:"zoneId"`
}
type SnapRecordCompute struct {
// Access Control List
ACL ListACL `json:"acl"`
// Account ID
AccountID uint64 `json:"accountId"`
// Account name
AccountName string `json:"accountName"`
// Affinity label
AffinityLabel string `json:"affinityLabel"`
// List affinity rules
AffinityRules ListRules `json:"affinityRules"`
// Affinity weight
AffinityWeight uint64 `json:"affinityWeight"`
// List anti affinity rules
AntiAffinityRules ListRules `json:"antiAffinityRules"`
// Auto start when node restarted
AutoStart bool `json:"autoStart"`
// Architecture
Architecture string `json:"arch"`
// Boot image ID
BootImageID uint64 `json:"boot_image_id"`
// Boot order
BootOrder []string `json:"bootOrder"`
// Boot type
BootType string `json:"bootType"`
// Boot disk size
BootDiskSize uint64 `json:"bootdiskSize"`
// CD Image Id
CdImageId uint64 `json:"cdImageId"`
// Chipset
Chipset string `json:"chipset"`
// Clone reference
CloneReference uint64 `json:"cloneReference"`
// List clone IDs
Clones []uint64 `json:"clones"`
// Clock
Clock string `json:"clock"`
// Compute CI ID
ComputeCIID uint64 `json:"computeciId"`
// CPU Pin
CPUPin bool `json:"cpupin"`
// Number of cores
CPU uint64 `json:"cpus"`
// Created by
CreatedBy string `json:"createdBy"`
// Created time
CreatedTime uint64 `json:"createdTime"`
// Custom fields items
CustomFields map[string]interface{} `json:"customFields"`
// Deleted by
DeletedBy string `json:"deletedBy"`
// Deleted time
DeletedTime uint64 `json:"deletedTime"`
// Description
Description string `json:"desc"`
// Devices
Devices interface{} `json:"devices"`
// List disks in compute
Disks ListComputeDisks `json:"disks"`
// Driver
Driver string `json:"driver"`
// Grid ID
GID uint64 `json:"gid"`
// GUID
GUID uint64 `json:"guid"`
// HPBacked
HPBacked bool `json:"hpBacked"`
// Hot resize
HotResize bool `json:"hotResize"`
// ID
ID uint64 `json:"id"`
// Image ID
ImageID uint64 `json:"imageId"`
// Image name
ImageName string `json:"imageName"`
// List interfaces
Interfaces ListInterfaces `json:"interfaces"`
// Loader meta iso information
LoaderMetaIso LoaderMetaIso `json:"loaderMetaIso"`
// Live migration job ID
LiveMigrationJobID uint64 `json:"live_migration_job_id"`
// Loader type
LoaderType string `json:"loaderType"`
// Lock status
LockStatus string `json:"lockStatus"`
// Manager ID
ManagerID uint64 `json:"managerId"`
// Manager type
ManagerType string `json:"managerType"`
// Migration job
MigrationJob uint64 `json:"migrationjob"`
// Milestones
Milestones uint64 `json:"milestones"`
// Name
Name string `json:"name"`
// NeedReboot
NeedReboot bool `json:"needReboot"`
// Network interface naming
NetworkInterfaceNaming string `json:"networkInterfaceNaming"`
// Numa Affinity
NumaAffinity string `json:"numaAffinity"`
//NumaNodeId
NumaNodeId int64 `json:"numaNodeId"`
// Natable VINS ID
NatableVINSID uint64 `json:"natableVinsId"`
// Natable VINS IP
NatableVINSIP string `json:"natableVinsIp"`
// Natable VINS Name
NatableVINSName string `json:"natableVinsName"`
// Natable VINS network
NatableVINSNetwork string `json:"natableVinsNetwork"`
// Natable VINS network name
NatableVINSNetworkName string `json:"natableVinsNetworkName"`
// Name of OS
OSVersion string `json:"os_version"`
// List OS Users
OSUsers ListOSUser `json:"osUsers"`
// Pinned to node
PinnedToNode int64 `json:"pinnedToNode"`
// PreferredCPU
PreferredCPU []int64 `json:"preferredCpu"`
// CPU alignment profile
CPUAlignmentProfile CPUAlignmentProfile `json:"cpu_alignment_profile"`
// Qemu_quest
QemuQuest QemuQuest `json:"qemu_guest"`
// ReadOnly indicates read-only mode state
ReadOnly bool `json:"read_only"`
// Number of RAM
RAM uint64 `json:"ram"`
// Reference ID
ReferenceID string `json:"referenceId"`
// Registered or not
Registered bool `json:"registered"`
// Resource name
ResName string `json:"resName"`
@@ -690,7 +954,10 @@ type ListOSUser []ItemOSUser
// Main information about snapsets
type ItemSnapSet struct {
// List disk IDs
// Compute info
Compute SnapRecordCompute `json:"compute"`
// List disk ID
Disks []uint64 `json:"disks"`
// GUID
@@ -699,6 +966,9 @@ type ItemSnapSet struct {
// Label
Label string `json:"label"`
// Memory dump image ID
MemoryDumpImage uint64 `json:"memory_dump_image"`
// Timestamp
Timestamp uint64 `json:"timestamp"`
}
@@ -723,6 +993,9 @@ type ItemVNFInterface struct {
// Enabled
Enabled bool `json:"enabled"`
// Enable default gateway
EnableDefaultGateway bool `json:"enable_default_gateway"`
// Enable security groups
EnableSecGroups bool `json:"enable_secgroups"`
@@ -990,6 +1263,9 @@ type SnapshotExtend struct {
// Label
Label string `json:"label"`
// Pool name
PoolName string `json:"poolName"`
// Reference ID
ReferenceID string `json:"referenceId"`
@@ -1185,6 +1461,9 @@ type ItemCompute struct {
// Name
Name string `json:"name"`
// Node ID
NodeID uint64 `json:"node_id"`
// NeedReboot
NeedReboot bool `json:"needReboot"`
@@ -1224,6 +1503,9 @@ type ItemCompute struct {
// Registered
Registered bool `json:"registered"`
// Whether a compute has been resized online
ResizedOnline bool `json:"resizedOnline"`
// Resource name
ResName string `json:"resName"`

View File

@@ -81,6 +81,11 @@ type NetAttachRequest struct {
// Flag indicating whether this interface is enabled (only for VINS, EXTNET, DPDK, SDN, TRUNK)
// Required: false
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
// Flag indicating whether default gateway is enabled for this interface
// Required: false
// Default: true
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
}
type wrapperNetAttachRequest struct {

View File

@@ -331,6 +331,10 @@ type ItemSnapshot struct {
// Label
Label string `json:"label"`
// Pool name
PoolName string `json:"poolName"`
// Reference ID
ReferenceID string `json:"referenceId"`
// Resource ID

View File

@@ -5,6 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
@@ -102,6 +103,6 @@ func (i Image) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
url := "/cloudapi/image/list"
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
res, err := i.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
return res, err
}

View File

@@ -2,10 +2,10 @@ package kvmx86
import (
"context"
"encoding/json"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
@@ -76,6 +76,11 @@ type Interface struct {
// Flag indicating whether this interface is enabled (only for VINS, EXTNET, DPDK, SDN, TRUNK)
// Required: false
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
// Flag indicating whether default gateway are enabled for this interface, not applicable to netType EXTNET, VFNIC, TRUNK, or SDN
// Default: true
// Required: false
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
}
// DataDisk detailed struct for DataDisks field in CreateRequest and CreateBlankRequest
@@ -231,7 +236,6 @@ type CreateRequest struct {
// GetRAM returns RAM field values
func (r CreateRequest) GetRAM() map[string]uint64 {
res := make(map[string]uint64, 1)
res["RAM"] = r.RAM
@@ -239,12 +243,6 @@ func (r CreateRequest) GetRAM() map[string]uint64 {
return res
}
type wrapperCreateRequest struct {
CreateRequest
Interfaces []string `url:"interfaces,omitempty"`
DataDisks []string `url:"dataDisks,omitempty"`
}
// Create creates KVM x86 VM based on specified OS image
func (k KVMX86) Create(ctx context.Context, req CreateRequest) (uint64, error) {
err := validators.ValidateRequest(req)
@@ -252,55 +250,12 @@ func (k KVMX86) Create(ctx context.Context, req CreateRequest) (uint64, error) {
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
var interfaces []string
if len(req.Interfaces) != 0 {
interfaces = make([]string, 0, len(req.Interfaces))
for i := range req.Interfaces {
b, err := json.Marshal(req.Interfaces[i])
if err != nil {
return 0, err
}
interfaces = append(interfaces, string(b))
}
} else if req.Interfaces != nil && len(req.Interfaces) == 0 {
interfaces = []string{"[]"}
}
var dataDisks []string
if len(req.DataDisks) != 0 {
dataDisks = make([]string, 0, len(req.DataDisks))
for i := range req.DataDisks {
b, err := json.Marshal(req.DataDisks[i])
if err != nil {
return 0, err
}
dataDisks = append(dataDisks, string(b))
}
}
reqWrapped := wrapperCreateRequest{
CreateRequest: req,
Interfaces: interfaces,
DataDisks: dataDisks,
}
url := "/cloudapi/kvmx86/create"
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
res, err := k.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return 0, err
}
result, err := strconv.ParseUint(string(res), 10, 64)
if err != nil {
return 0, err
}
return result, nil
return strconv.ParseUint(string(res), 10, 64)
}

View File

@@ -2,10 +2,10 @@ package kvmx86
import (
"context"
"encoding/json"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
@@ -136,12 +136,6 @@ func (r CreateBlankRequest) GetRAM() map[string]uint64 {
return res
}
type wrapperCreateBlankRequest struct {
CreateBlankRequest
Interfaces []string `url:"interfaces,omitempty"`
DataDisks []string `url:"dataDisks,omitempty"`
}
// CreateBlank creates KVM x86 VM from scratch
func (k KVMX86) CreateBlank(ctx context.Context, req CreateBlankRequest) (uint64, error) {
err := validators.ValidateRequest(req)
@@ -149,55 +143,12 @@ func (k KVMX86) CreateBlank(ctx context.Context, req CreateBlankRequest) (uint64
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
var interfaces []string
if len(req.Interfaces) != 0 {
interfaces = make([]string, 0, len(req.Interfaces))
for i := range req.Interfaces {
b, err := json.Marshal(req.Interfaces[i])
if err != nil {
return 0, err
}
interfaces = append(interfaces, string(b))
}
} else if req.Interfaces != nil && len(req.Interfaces) == 0 {
interfaces = []string{"[]"}
}
var dataDisks []string
if len(req.DataDisks) != 0 {
dataDisks = make([]string, 0, len(req.DataDisks))
for i := range req.DataDisks {
b, err := json.Marshal(req.DataDisks[i])
if err != nil {
return 0, err
}
dataDisks = append(dataDisks, string(b))
}
}
reqWrapped := wrapperCreateBlankRequest{
CreateBlankRequest: req,
Interfaces: interfaces,
DataDisks: dataDisks,
}
url := "/cloudapi/kvmx86/createBlank"
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
res, err := k.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return 0, err
}
result, err := strconv.ParseUint(string(res), 10, 64)
if err != nil {
return 0, err
}
return result, nil
return strconv.ParseUint(string(res), 10, 64)
}

View File

@@ -2,6 +2,7 @@ package pcidevice
import (
"encoding/json"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/serialization"
)

View File

@@ -76,6 +76,10 @@ type CreateRequest struct {
// SDN access group id
// Required: false
SDNAccessGroupID string `url:"sdn_access_group_id,omitempty" json:"sdn_access_group_id,omitempty"`
// Enabling default gateway
// Required: false
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
}
type StoragePolicy struct {

View File

@@ -2,10 +2,10 @@ package vins
import (
"context"
"encoding/json"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
@@ -62,11 +62,11 @@ type CreateInAccountRequest struct {
// Required: false
// Default: false
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
}
type wrapperCreateRequestInAcc struct {
CreateInAccountRequest
Routes []string `url:"routes,omitempty"`
// Flag indicating whether default gateway is enabled for this VINS
// Required: false
// Default: true
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
}
// CreateInAccount creates VINS in account level
@@ -76,31 +76,9 @@ func (v VINS) CreateInAccount(ctx context.Context, req CreateInAccountRequest) (
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
var routes []string
if len(req.Routes) != 0 {
routes = make([]string, 0, len(req.Routes))
for r := range req.Routes {
b, err := json.Marshal(req.Routes[r])
if err != nil {
return 0, err
}
routes = append(routes, string(b))
}
} else {
routes = []string{}
}
reqWrapped := wrapperCreateRequestInAcc{
CreateInAccountRequest: req,
Routes: routes,
}
url := "/cloudapi/vins/createInAccount"
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return 0, err
}

View File

@@ -2,10 +2,10 @@ package vins
import (
"context"
"encoding/json"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
@@ -56,11 +56,11 @@ type CreateInRGRequest struct {
// Required: false
// Default: false
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
}
type wrapperCreateRequestInRG struct {
CreateInRGRequest
Routes []string `url:"routes,omitempty"`
// Flag indicating whether default gateway is enabled for this VINS
// Required: false
// Default: true
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
}
// CreateInRG creates VINS in resource group level
@@ -70,31 +70,9 @@ func (v VINS) CreateInRG(ctx context.Context, req CreateInRGRequest) (uint64, er
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
var routes []string
if len(req.Routes) != 0 {
routes = make([]string, 0, len(req.Routes))
for r := range req.Routes {
b, err := json.Marshal(req.Routes[r])
if err != nil {
return 0, err
}
routes = append(routes, string(b))
}
} else {
routes = []string{}
}
reqWrapped := wrapperCreateRequestInRG{
CreateInRGRequest: req,
Routes: routes,
}
url := "/cloudapi/vins/createInRG"
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return 0, err
}

View File

@@ -694,6 +694,9 @@ type RecordVINS struct {
// Description
Description string `json:"desc"`
// Enable Default Gateway
EnableDefaultGateway bool `json:"enable_default_gateway"`
// Enable Security Groups
EnableSecGroups bool `json:"enable_secgroups"`

View File

@@ -111,6 +111,12 @@ type RecordZone struct {
// CPU alignment profiles
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
// Reserved CPU
ReservedCPU uint64 `json:"reserved_cpu"`
// Reserved RAM
ReservedRAM uint64 `json:"reserved_ram"`
}
// A zone item from a list
@@ -183,4 +189,10 @@ type ItemZone struct {
// CPU alignment profiles
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
// Reserved CPU
ReservedCPU uint64 `json:"reserved_cpu"`
// Reserved RAM
ReservedRAM uint64 `json:"reserved_ram"`
}

View File

@@ -3,8 +3,9 @@ package account
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter

View File

@@ -16,7 +16,7 @@ type SetCPUAllocationRatioRequest struct {
// CPU allocation ratio, i.e. one pCPU = ratio*vCPU
// Required: true
Ratio float64 `url:"ratio" json:"ratio" validate:"required"`
Ratio uint64 `url:"ratio" json:"ratio" validate:"required"`
}
// SetCPUAllocationRatio sets CPU allocation ratio

View File

@@ -8,7 +8,7 @@ type Audit struct {
}
// Builder for audit endpoint
func New(client interfaces.Caller) *Audit{
func New(client interfaces.Caller) *Audit {
return &Audit{
client: client,
}

View File

@@ -18,11 +18,6 @@ type MigrateRequest struct {
// Particular Node ID to migrate this compute to
// Required: false
TargetNodeID uint64 `url:"targetNodeId,omitempty" json:"targetNodeId,omitempty"`
// If live migration fails, destroy compute
// on source node and recreate on the target
// Required: false
Force bool `url:"force,omitempty" json:"force,omitempty"`
}
type AsyncWrapperMigrateRequest struct {

View File

@@ -2,8 +2,8 @@ package compute
import (
"context"
"encoding/json"
"net/http"
"strings"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
@@ -16,20 +16,35 @@ type MigrateStorageInfoRequest struct {
}
// MigrateStorageInfo gets info about last (include ongoing) storage migration
func (c Compute) MigrateStorageInfo(ctx context.Context, req MigrateStorageInfoRequest) (string, error) {
func (c Compute) MigrateStorageInfo(ctx context.Context, req MigrateStorageInfoRequest) (*RecordMigrateStorageInfo, error) {
res, err := c.MigrateStorageInfoRaw(ctx, req)
if err != nil {
return nil, err
}
info := RecordMigrateStorageInfo{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}
// MigrateStorageInfoRaw gets info about last (include ongoing) storage migration as an array of bytes
func (c Compute) MigrateStorageInfoRaw(ctx context.Context, req MigrateStorageInfoRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/migrateStorageInfo"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return "", err
return nil, err
}
result := strings.ReplaceAll(string(res), "\"", "")
return result, nil
return res, nil
}

View File

@@ -148,6 +148,9 @@ type RecordNetAttach struct {
// Enabled
Enabled bool `json:"enabled"`
// Enable default gateway
EnableDefaultGateway bool `json:"enable_default_gateway"`
// Enable security groups
EnableSecGroups bool `json:"enable_secgroups"`
@@ -367,6 +370,9 @@ type ItemSnapshotDetailed struct {
// Label
Label string `json:"label"`
// Pool name
PoolName string `json:"poolName"`
// Resource ID
ResID string `json:"resId"`
@@ -597,6 +603,9 @@ type ItemInterface struct {
// Enabled
Enabled bool `json:"enabled"`
// Enable default gateway
EnableDefaultGateway bool `json:"enable_default_gateway"`
// Enable security groups
EnableSecGroups bool `json:"enable_secgroups"`
@@ -855,6 +864,9 @@ type InfoCompute struct {
// Registered
Registered bool `json:"registered"`
// Whether a compute has been resized online
ResizedOnline bool `json:"resizedOnline"`
// Resource name
ResName string `json:"resName"`
@@ -1157,6 +1169,9 @@ type RecordCompute struct {
// Registered
Registered bool `json:"registered"`
// Whether a compute has been resized online
ResizedOnline bool `json:"resizedOnline"`
// Resource name
ResName string `json:"resName"`
@@ -1511,6 +1526,405 @@ type MigrateStorageItem struct {
TargetNodeID uint64 `json:"targetNodeId"`
}
// Info about last (including ongoing) storage migration
type RecordMigrateStorageInfo struct {
// Migration completion status
Completed bool `json:"completed"`
// Daemon address
DaemonAddr string `json:"daemonAddr"`
// Domain name
DomainName string `json:"domainName"`
// Domain UUID
DomainUUID string `json:"domainUUID"`
// Elapsed time
ElapsedTime uint64 `json:"elapsedTime"`
// GID
GID uint64 `json:"gid"`
// GUID
GUID uint64 `json:"guid"`
// ID
ID uint64 `json:"id"`
// List interfaces
Interfaces []ItemShadowComputeInterface `json:"interfaces"`
// Log
Log []string `json:"log"`
// New disk XMLs
NewDiskXmls []string `json:"newDiskXmls"`
// New disks
NewDisks []uint64 `json:"newDisks"`
// Old disks
OldDisks []uint64 `json:"oldDisks"`
// PID
PID uint64 `json:"pid"`
// Source node ID
SourceNodeID uint64 `json:"sourceNodeId"`
// Source numa node ID
SourceNumaNodeID int64 `json:"sourceNumaNodeId"`
// Source reserved node CPUs
SourceReservedNodeCpus []uint64 `json:"sourceReservedNodeCpus"`
// Source URL
SourceURL string `json:"sourceURL"`
// Status
Status string `json:"status"`
// Target shadow compute
TargetShadowCompute ShadowCompute `json:"target_shadow_compute"`
// Target node ID
TargetNodeID uint64 `json:"targetNodeId"`
// Target URL
TargetURL string `json:"targetURL"`
// VM log directory
VMLogDir string `json:"vmlogDir"`
}
// Shadow compute created for the duration of a storage migration
type ShadowCompute struct {
// Account ID
AccountID uint64 `json:"accountId"`
// Access Control List
ACL []interface{} `json:"acl"`
// Affinity label
AffinityLabel string `json:"affinityLabel"`
// Affinity rules
AffinityRules ListShadowComputeRules `json:"affinityRules"`
// Affinity weight
AffinityWeight uint64 `json:"affinityWeight"`
// Anti affinity rules
AntiAffinityRules ListShadowComputeRules `json:"antiAffinityRules"`
// Architecture
Arch string `json:"arch"`
// Auto start when node restarted
AutoStart bool `json:"autoStart"`
// Boot image ID
BootImageID uint64 `json:"boot_image_id"`
// Boot order
BootOrder []string `json:"bootOrder"`
// Boot type
BootType string `json:"bootType"`
// Boot disk size
BootDiskSize uint64 `json:"bootdiskSize"`
// CD Image ID
CDImageID uint64 `json:"cdImageId"`
// Chipset
Chipset string `json:"chipset"`
// Clone reference
CloneReference uint64 `json:"cloneReference"`
// List clone IDs
Clones []uint64 `json:"clones"`
// Compute CI ID
ComputeCIID uint64 `json:"computeciId"`
// CPU pin
CPUPin bool `json:"cpupin"`
// Number of CPU
CPUs uint64 `json:"cpus"`
// Custom fields
CustomFields map[string]interface{} `json:"customFields"`
// Description
Description string `json:"desc"`
// Devices
Devices interface{} `json:"devices"`
// List disks
Disks []ItemShadowComputeDisk `json:"disks"`
// Driver
Driver string `json:"driver"`
// GID
GID uint64 `json:"gid"`
// GUID
GUID uint64 `json:"guid"`
// HPBacked
HPBacked bool `json:"hpBacked"`
// Hot resize
HotResize bool `json:"hotResize"`
// ID
ID uint64 `json:"id"`
// List interfaces
Interfaces []ItemShadowComputeInterface `json:"interfaces"`
// Live migration job ID
LiveMigrationJobID uint64 `json:"live_migration_job_id"`
// Loader type
LoaderType string `json:"loaderType"`
// Lock status
LockStatus string `json:"lockStatus"`
// Manager ID
ManagerID uint64 `json:"managerId"`
// Manager type
ManagerType string `json:"managerType"`
// Migration job
MigrationJob uint64 `json:"migrationjob"`
// Milestones
Milestones uint64 `json:"milestones"`
// Name
Name string `json:"name"`
// Need reboot
NeedReboot bool `json:"needReboot"`
// Network interface naming
NetworkInterfaceNaming string `json:"networkInterfaceNaming"`
// Node ID
NodeID uint64 `json:"node_id"`
// NumaAffinity
NumaAffinity string `json:"numaAffinity"`
// NumaNodeId
NumaNodeID int64 `json:"numaNodeId"`
// List OS users
OSUsers ListOSUsers `json:"osUsers"`
// Name of OS
OSVersion string `json:"os_version"`
// Pinned to node
PinnedToNode int64 `json:"pinnedToNode"`
// Preferred CPU
PreferredCPU []int64 `json:"preferredCpu"`
// Qemu guest
QemuGuest QemuQuest `json:"qemu_guest"`
// ReadOnly indicates read-only mode state
ReadOnly bool `json:"read_only"`
// Number of RAM
RAM uint64 `json:"ram"`
// Reference ID
ReferenceID string `json:"referenceId"`
// Reserved node CPUs
ReservedNodeCpus []uint64 `json:"reservedNodeCpus"`
// Resized online
ResizedOnline bool `json:"resizedOnline"`
// Resource name
ResName string `json:"resName"`
// Resource group ID
RGID uint64 `json:"rgId"`
// SnapSets
SnapSets ListShadowComputeSnapshots `json:"snapSets"`
// Stateless SEP ID
StatelessSEPID int64 `json:"statelessSepId"`
// Stateless SEP type
StatelessSEPType string `json:"statelessSepType"`
// Status
Status string `json:"status"`
// Tags
Tags map[string]interface{} `json:"tags"`
// Tech status
TechStatus string `json:"techStatus"`
// User managed
UserManaged bool `json:"userManaged"`
// Userdata
Userdata interface{} `json:"userdata"`
// List VGPU IDs
VGPUs []uint64 `json:"vgpus"`
// VNC password
VNCPassword string `json:"vncPasswd"`
// Zone ID
ZoneID uint64 `json:"zoneId"`
}
// Disk of a shadow compute
type ItemShadowComputeDisk struct {
// ID
ID uint64 `json:"id"`
}
// Affinity/anti-affinity rule of a shadow compute
type ItemShadowComputeRule struct {
// Key
Key string `json:"key"`
// Mode
Mode string `json:"mode"`
// Policy
Policy string `json:"policy"`
// Topology
Topology string `json:"topology"`
// Value
Value string `json:"value"`
}
// List of shadow compute affinity/anti-affinity rules
type ListShadowComputeRules []ItemShadowComputeRule
// Snapshot of a shadow compute
type ItemShadowComputeSnapshot struct {
// List of disk IDs
Disks []uint64 `json:"disks"`
// GUID
GUID string `json:"guid"`
// Label
Label string `json:"label"`
// Timestamp
Timestamp uint64 `json:"timestamp"`
}
// List of shadow compute snapshots
type ListShadowComputeSnapshots []ItemShadowComputeSnapshot
// Network interface of a shadow compute
type ItemShadowComputeInterface struct {
// Name
Name string `json:"name"`
// Target
Target string `json:"target"`
// PCI slot
PCISlot int64 `json:"pciSlot"`
// Bus number
BusNumber int64 `json:"bus_number"`
// MAC
MAC string `json:"mac"`
// Maximum transmission unit
MTU int64 `json:"mtu"`
// Type
Type string `json:"type"`
// Connection type
ConnType string `json:"connType"`
// Connection ID
ConnID uint64 `json:"connId"`
// FLIPGroup ID
FLIPGroupID uint64 `json:"flipgroupId"`
// Network type
NetType string `json:"netType"`
// Network ID
NetID uint64 `json:"netId"`
// IP address
IPAddress string `json:"ipAddress"`
// Network mask
NetMask int64 `json:"netMask"`
// Default GW
DefGW string `json:"defGw"`
// List of VNF IDs
VNFs []uint64 `json:"vnfs"`
// QOS
QOS QOS `json:"qos"`
// Libvirt settings
LibvirtSettings LibvirtSettings `json:"libvirtSettings"`
// GUID
GUID string `json:"guid"`
// Listen SSH or not
ListenSSH bool `json:"listenSsh"`
// Enabled
Enabled bool `json:"enabled"`
// Node ID
NodeID uint64 `json:"nodeId"`
// SDN interface ID
SDNInterfaceID string `json:"sdn_interface_id"`
// List of security groups
SecGroups []uint64 `json:"security_groups"`
// Enable security groups
EnableSecGroups bool `json:"enable_secgroups"`
// Trunk tags
TrunkTags []int64 `json:"trunk_tags"`
}
type RecordCloneAbort struct {
// Disk ID
DiskID uint64 `json:"disk_id"`

View File

@@ -81,6 +81,11 @@ type NetAttachRequest struct {
// Flag indicating whether this interface is enabled (only for VINS, EXTNET, DPDK, SDN, TRUNK)
// Required: false
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
// Flag indicating whether default gateway is enabled for this interface
// Required: false
// Default: true
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
}
type wrapperNetAttachRequest struct {

View File

@@ -12,15 +12,19 @@ import (
// Must be provided if NewVMUUID is provided.
type OSUser struct {
// Login of a user
Login string `url:"login,omitempty" json:"login,omitempty"`
// Required: true
Login string `url:"login" json:"login" validate:"required"`
// Password of a user
Password string `url:"password,omitempty" json:"password,omitempty"`
// Required: true
Password string `url:"password" json:"password" validate:"required"`
// GUID
// Required: false
GUID string `url:"guid,omitempty" json:"guid,omitempty"`
// Pubkey
// Required: false
Pubkey string `url:"pubkey,omitempty" json:"pubkey,omitempty"`
}
@@ -36,7 +40,7 @@ type StopMigrationINRequest struct {
// OS user data for Guest OS
// Required: false
OSUsers []OSUser `url:"os_users,omitempty" json:"os_users,omitempty"`
OSUsers []OSUser `url:"os_users,omitempty" json:"os_users,omitempty" validate:"omitempty,dive"`
}
// StopMigrationIN stops compute for external migration in

View File

@@ -3,8 +3,9 @@ package disks
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// DepresentRequest struct to depresent disk from node

View File

@@ -309,6 +309,9 @@ type ItemSnapshot struct {
// Label
Label string `json:"label"`
// Pool name
PoolName string `json:"poolName"`
// Reference ID
ReferenceID string `json:"referenceId"`
@@ -343,4 +346,7 @@ type MigrateStatus struct {
// Progress percent
ProgressPercent int `json:"progress_percent"`
// Operation status
Ready bool `json:"ready"`
}

View File

@@ -3,8 +3,9 @@ package disks
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// PresentRequest struct to present disk to node

View File

@@ -100,6 +100,12 @@ type RecordGrid struct {
// Network modes
NetworkModes []string `json:"network_modes"`
// Reserved CPU
ReservedCPU uint64 `json:"reserved_cpu"`
// Reserved RAM
ReservedRAM uint64 `json:"reserved_ram"`
// SDN support
SDNSupport bool `json:"sdn_support"`
@@ -139,6 +145,12 @@ type ItemGridList struct {
// Network modes
NetworkModes []string `json:"network_modes"`
// Reserved CPU
ReservedCPU uint64 `json:"reserved_cpu"`
// Reserved RAM
ReservedRAM uint64 `json:"reserved_ram"`
// SDN support
SDNSupport bool `json:"sdn_support"`
@@ -175,15 +187,6 @@ type RecordSettingsGrid struct {
//Cleanup retention period
CleanupRetentionPeriod uint64 `json:"cleanupRetentionPeriod"`
// CPU allocation ratio
CPUAllocationRatio uint64 `json:"cpu_allocation_ratio"`
// CPU allocation ratio for VMs
CPUAllocationRatioVM uint64 `json:"cpu_allocation_ratio_vm"`
// Custom backup path
CustomBackupPath []string `json:"custom_backup_path"`
//Docker registry
DockerRegistry DockerRegistry `json:"docker_registry"`
@@ -214,9 +217,6 @@ type RecordSettingsGrid struct {
//Net QOS
NetQOS NetQOS `json:"net_qos"`
//Networks
Networks string `json:"networks"`
// Node self stop timer uptime monitor
NodeSelfStopTimerUptimeMonitor uint64 `json:"nodeSelfStopTimerUptimeMonitor"`

View File

@@ -3,8 +3,9 @@ package grid
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// SetCPUAllocationParameterRequest for setting CPU allocation parameter

View File

@@ -3,8 +3,9 @@ package grid
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// SetCPUAllocationRatioForVMRequest for setting CPU allocation ratio for computes

View File

@@ -0,0 +1,44 @@
package grid
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// SetResourcesLimitRequest struct to set resources limit
type SetResourcesLimitRequest struct {
// ID of the grid
// Required: true
GID uint64 `url:"grid_id" json:"grid_id" validate:"required"`
// Number of CPU cores reserved
// Default: 0
// Required: true
ReservedCPU uint64 `url:"reserved_cpu" json:"reserved_cpu"`
// Amount of RAM in MB reserved
// Default: 0
// Required: true
ReservedRAM uint64 `url:"reserved_ram" json:"reserved_ram"`
}
// SetResourcesLimit sets reserved CPU and RAM limits for the grid
func (g Grid) SetResourcesLimit(ctx context.Context, req SetResourcesLimitRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/grid/set_resources_limit"
res, err := g.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return false, err
}
return strconv.ParseBool(string(res))
}

View File

@@ -5,6 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
@@ -102,6 +103,6 @@ func (i Image) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
url := "/cloudbroker/image/list"
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
res, err := i.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
return res, err
}

View File

@@ -19,7 +19,7 @@ type AccessAddRequest struct {
}
// Add accountId to sharedWith access list for k8ci.
func (k K8CI) AccessAdd (ctx context.Context, req AccessAddRequest) (string, error) {
func (k K8CI) AccessAdd(ctx context.Context, req AccessAddRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))

View File

@@ -19,7 +19,7 @@ type AccessRemoveRequest struct {
}
// Remove accountId from sharedWith access list for k8ci.
func (k K8CI) AccessRemove (ctx context.Context, req AccessRemoveRequest) (string, error) {
func (k K8CI) AccessRemove(ctx context.Context, req AccessRemoveRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))

View File

@@ -2,10 +2,10 @@ package kvmx86
import (
"context"
"encoding/json"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
@@ -59,6 +59,11 @@ type Interface struct {
// Required: false
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
// Flag indicating whether default gateway are enabled for this interface, not applicable to netType EXTNET, VFNIC, TRUNK, or SDN
// Default: true
// Required: false
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
// SDN Segment ID
// Required: false
SDNSegmentID string `url:"sdn_segment_id,omitempty" json:"sdn_segment_id,omitempty"`
@@ -254,7 +259,6 @@ type CreateRequest struct {
// GetRAM returns RAM field values
func (r CreateRequest) GetRAM() map[string]uint64 {
res := make(map[string]uint64, 1)
res["RAM"] = r.RAM
@@ -262,12 +266,6 @@ func (r CreateRequest) GetRAM() map[string]uint64 {
return res
}
type wrapperCreateRequest struct {
CreateRequest
Interfaces []string `url:"interfaces,omitempty"`
DataDisks []string `url:"dataDisks,omitempty"`
}
// Create creates KVM PowerPC VM based on specified OS image
func (k KVMX86) Create(ctx context.Context, req CreateRequest) (uint64, error) {
err := validators.ValidateRequest(req)
@@ -275,55 +273,12 @@ func (k KVMX86) Create(ctx context.Context, req CreateRequest) (uint64, error) {
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
var interfaces []string
if len(req.Interfaces) != 0 {
interfaces = make([]string, 0, len(req.Interfaces))
for i := range req.Interfaces {
b, err := json.Marshal(req.Interfaces[i])
if err != nil {
return 0, err
}
interfaces = append(interfaces, string(b))
}
} else if req.Interfaces != nil && len(req.Interfaces) == 0 {
interfaces = []string{"[]"}
}
var dataDisks []string
if len(req.DataDisks) != 0 {
dataDisks = make([]string, 0, len(req.DataDisks))
for i := range req.DataDisks {
b, err := json.Marshal(req.DataDisks[i])
if err != nil {
return 0, err
}
dataDisks = append(dataDisks, string(b))
}
}
reqWrapped := wrapperCreateRequest{
CreateRequest: req,
Interfaces: interfaces,
DataDisks: dataDisks,
}
url := "/cloudbroker/kvmx86/create"
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
res, err := k.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return 0, err
}
result, err := strconv.ParseUint(string(res), 10, 64)
if err != nil {
return 0, err
}
return result, nil
return strconv.ParseUint(string(res), 10, 64)
}

View File

@@ -2,10 +2,10 @@ package kvmx86
import (
"context"
"encoding/json"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
@@ -149,12 +149,6 @@ func (r CreateBlankRequest) GetRAM() map[string]uint64 {
return res
}
type wrapperCreateBlankRequest struct {
CreateBlankRequest
Interfaces []string `url:"interfaces,omitempty"`
DataDisks []string `url:"dataDisks,omitempty"`
}
// CreateBlank creates KVM x86 VM from scratch
func (k KVMX86) CreateBlank(ctx context.Context, req CreateBlankRequest) (uint64, error) {
err := validators.ValidateRequest(req)
@@ -162,56 +156,12 @@ func (k KVMX86) CreateBlank(ctx context.Context, req CreateBlankRequest) (uint64
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
var interfaces []string
if len(req.Interfaces) != 0 {
interfaces = make([]string, 0, len(req.Interfaces))
for i := range req.Interfaces {
b, err := json.Marshal(req.Interfaces[i])
if err != nil {
return 0, err
}
interfaces = append(interfaces, string(b))
}
} else if req.Interfaces != nil && len(req.Interfaces) == 0 {
interfaces = []string{"[]"}
}
var dataDisks []string
if len(req.DataDisks) != 0 {
dataDisks = make([]string, 0, len(req.DataDisks))
for i := range req.DataDisks {
b, err := json.Marshal(req.DataDisks[i])
if err != nil {
return 0, err
}
dataDisks = append(dataDisks, string(b))
}
}
reqWrapped := wrapperCreateBlankRequest{
CreateBlankRequest: req,
Interfaces: interfaces,
DataDisks: dataDisks,
}
url := "/cloudbroker/kvmx86/createBlank"
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
res, err := k.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return 0, err
}
result, err := strconv.ParseUint(string(res), 10, 64)
if err != nil {
return 0, err
}
return result, nil
return strconv.ParseUint(string(res), 10, 64)
}

View File

@@ -3,8 +3,11 @@ package kvmx86
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
@@ -53,6 +56,11 @@ type InterfaceMassCreate struct {
// Required: false
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
// Flag indicating whether default gateway are enabled for this interface, not applicable to netType EXTNET, VFNIC, TRUNK, or SDN
// Default: true
// Required: false
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
// SDN Segment ID
// Required: false
SDNSegmentID string `url:"sdn_segment_id,omitempty" json:"sdn_segment_id,omitempty"`
@@ -177,14 +185,8 @@ type MassCreateRequest struct {
Clock string `url:"clock,omitempty" json:"clock,omitempty"`
}
type asyncWrapperMassCreateRequest struct {
wrapperMassCreateRequest
AsyncMode bool `url:"asyncMode"`
}
// GetRAM returns RAM field values
func (r MassCreateRequest) GetRAM() map[string]uint64 {
res := make(map[string]uint64, 1)
res["RAM"] = r.RAM
@@ -194,8 +196,24 @@ func (r MassCreateRequest) GetRAM() map[string]uint64 {
type wrapperMassCreateRequest struct {
MassCreateRequest
Interfaces []string `url:"interfaces,omitempty"`
DataDisks []string `url:"dataDisks,omitempty"`
AsyncMode bool `json:"asyncMode"`
}
type massCreateResponse struct {
Created []uint64 `json:"created"`
Errors map[string]string `json:"errors"`
}
type MassCreateError struct {
Errors map[string]string
}
func (e *MassCreateError) Error() string {
errs := make([]error, 0, len(e.Errors))
for k, v := range e.Errors {
errs = append(errs, fmt.Errorf("%s: %s", k, v))
}
return errors.Join(errs...).Error()
}
// MassCreate creates KVM x86 computes based on specified OS image
@@ -205,113 +223,42 @@ func (k KVMX86) MassCreate(ctx context.Context, req MassCreateRequest) ([]uint64
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
var interfaces []string
if len(req.Interfaces) != 0 {
interfaces = make([]string, 0, len(req.Interfaces))
for i := range req.Interfaces {
b, err := json.Marshal(req.Interfaces[i])
if err != nil {
return nil, err
}
interfaces = append(interfaces, string(b))
}
} else if req.Interfaces != nil && len(req.Interfaces) == 0 {
interfaces = []string{"[]"}
}
var dataDisks []string
if len(req.DataDisks) != 0 {
dataDisks = make([]string, 0, len(req.DataDisks))
for i := range req.DataDisks {
b, err := json.Marshal(req.DataDisks[i])
if err != nil {
return nil, err
}
dataDisks = append(dataDisks, string(b))
}
}
reqWrapped := wrapperMassCreateRequest{
MassCreateRequest: req,
Interfaces: interfaces,
DataDisks: dataDisks,
}
finalReq := asyncWrapperMassCreateRequest{wrapperMassCreateRequest: reqWrapped, AsyncMode: false}
url := "/cloudbroker/kvmx86/massCreate"
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, finalReq)
res, err := k.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, wrapperMassCreateRequest{
MassCreateRequest: req,
AsyncMode: false,
})
if err != nil {
return nil, err
}
computes := make([]uint64, 0)
var result massCreateResponse
err = json.Unmarshal(res, &computes)
if err != nil {
if err = json.Unmarshal(res, &result); err != nil {
return nil, err
}
return computes, nil
if len(result.Errors) > 0 {
return result.Created, &MassCreateError{Errors: result.Errors}
}
return result.Created, nil
}
// MassCreate creates KVM x86 computes based on specified OS image in async mode
// MassCreateAsync creates KVM x86 computes based on specified OS image in async mode
func (k KVMX86) MassCreateAsync(ctx context.Context, req MassCreateRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
var interfaces []string
if len(req.Interfaces) != 0 {
interfaces = make([]string, 0, len(req.Interfaces))
for i := range req.Interfaces {
b, err := json.Marshal(req.Interfaces[i])
if err != nil {
return "", err
}
interfaces = append(interfaces, string(b))
}
} else if req.Interfaces != nil && len(req.Interfaces) == 0 {
interfaces = []string{"[]"}
}
var dataDisks []string
if len(req.DataDisks) != 0 {
dataDisks = make([]string, 0, len(req.DataDisks))
for i := range req.DataDisks {
b, err := json.Marshal(req.DataDisks[i])
if err != nil {
return "", err
}
dataDisks = append(dataDisks, string(b))
}
}
reqWrapped := wrapperMassCreateRequest{
MassCreateRequest: req,
Interfaces: interfaces,
DataDisks: dataDisks,
}
finalReq := asyncWrapperMassCreateRequest{wrapperMassCreateRequest: reqWrapped, AsyncMode: true}
url := "/cloudbroker/kvmx86/massCreate"
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, finalReq)
res, err := k.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, wrapperMassCreateRequest{
MassCreateRequest: req,
AsyncMode: true,
})
if err != nil {
return "", err
}

View File

@@ -0,0 +1,76 @@
package node
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// InstallRequest struct to install a node
type InstallRequest struct {
// Node name
// Required: true
Name string `url:"name" json:"name" validate:"required"`
// Node roles
// Required: true
Roles []string `url:"roles" json:"roles" validate:"required"`
// OS version
// Required: true
OSVersion string `url:"os_version" json:"os_version" validate:"required"`
// OS user
// Required: false
OSUser string `url:"os_user,omitempty" json:"os_user,omitempty"`
// OS user password
// Required: true
OSUserPassword string `url:"os_user_password" json:"os_user_password" validate:"required"`
// Backplane IP address
// Required: true
BackplaneIP string `url:"backplane_ip" json:"backplane_ip" validate:"required"`
// Management IP address
// Required: true
ManagementIP string `url:"management_ip" json:"management_ip" validate:"required"`
// VX backend IP address
// Required: true
VXBackendIP string `url:"vxbackend_ip" json:"vxbackend_ip" validate:"required"`
// Gateway management IP address
// Required: true
GWMgmtIP string `url:"gw_mgmt_ip" json:"gw_mgmt_ip" validate:"required"`
// IPMI address
// Required: true
IPMIAddress string `url:"ipmi_address" json:"ipmi_address" validate:"required"`
// IPMI user
// Required: true
IPMIUser string `url:"ipmi_user" json:"ipmi_user" validate:"required"`
// IPMI password
// Required: true
IPMIPassword string `url:"ipmi_password" json:"ipmi_password" validate:"required"`
}
// Install installs a node
func (n Node) Install(ctx context.Context, req InstallRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/node/install"
res, err := n.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return "", err
}
return string(res), nil
}

View File

@@ -50,6 +50,12 @@ type RecordNode struct {
// ReservedCPUs
ReservedCPUs []interface{} `json:"reservedCpus"`
// Reserved CPU
ReservedCPU uint64 `json:"reserved_cpu"`
// Reserved RAM
ReservedRAM uint64 `json:"reserved_ram"`
// Roles
Roles []string `json:"roles"`
@@ -161,8 +167,11 @@ type CpuInfo struct {
// Flags
Flags []string `json:"flags"`
// Mddel name
// Model name
ModelName string `json:"model_name"`
// Max supported generation
MaxSupportedGeneration string `json:"max_supported_generation"`
}
// Main information about node
@@ -200,6 +209,9 @@ type ItemNode struct {
// Last check
LastCheck uint64 `json:"lastcheck"`
// Machine ID
MachineID string `json:"machine_id"`
// Machine GUID
MachineGUID string `json:"machineguid"`
@@ -257,6 +269,12 @@ type ItemNode struct {
// ReservedCPUs
ReservedCPUs []interface{} `json:"reservedCpus"`
// Reserved CPU
ReservedCPU uint64 `json:"reserved_cpu"`
// Reserved RAM
ReservedRAM uint64 `json:"reserved_ram"`
// Roles
Roles []string `json:"roles"`

View File

@@ -0,0 +1,42 @@
package node
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// SetResourcesLimitRequest struct to set resources limit for node
type SetResourcesLimitRequest struct {
// Node ID
// Required: true
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
// Number of CPU cores reserved
// Required: true
ReservedCPU uint64 `url:"reserved_cpu" json:"reserved_cpu"`
// Amount of RAM in MB reserved
// Required: true
ReservedRAM uint64 `url:"reserved_ram" json:"reserved_ram"`
}
// SetResourcesLimit sets reserved CPU and RAM limits for the node
func (n Node) SetResourcesLimit(ctx context.Context, req SetResourcesLimitRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/node/set_resources_limit"
res, err := n.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return false, err
}
return strconv.ParseBool(string(res))
}

View File

@@ -3,8 +3,9 @@ package pcidevice
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// DeleteRequest struct to deleting PCI device

View File

@@ -3,8 +3,9 @@ package pcidevice
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// DisableRequest struct for disabling PCI device

View File

@@ -3,8 +3,9 @@ package pcidevice
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// EnableRequest struct for enabling PCI device

View File

@@ -2,6 +2,7 @@ package pcidevice
import (
"encoding/json"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/serialization"
)

View File

@@ -11,7 +11,7 @@ import (
type GetByNodeRequest struct {
// Node ID
// Required: true
NodeID uint64 `url:"nodeId" json:"nodeId" validate:"required"`
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
// Start of time period - unixtime
// Required: false

View File

@@ -18,12 +18,12 @@ type GetByComputePoint struct {
type ComputeUsage struct {
VCPUsConsumed uint64 `json:"vcpusConsumed"`
Storage uint64 `json:"storage"`
CPUTime uint64 `json:"cpuTime"`
CPUTime float64 `json:"cpuTime"`
ExtIPs uint64 `json:"extips"`
RAMConsumed uint64 `json:"ramConsumed"`
VCPUsReserved uint64 `json:"vcpusReserved"`
IsUp uint64 `json:"isUp"`
RAMConsumedReal uint64 `json:"ramConsumedReal"`
IsUp bool `json:"isUp"`
RAMConsumedReal float64 `json:"ramConsumedReal"`
RAMReserved uint64 `json:"ramReserved"`
}
@@ -33,7 +33,7 @@ type ItemDisk struct {
ResID string `json:"resId"`
SizeUsed float64 `json:"sizeUsed"`
SizeAvailable float64 `json:"sizeAvailable"`
SizeMax float64 `json:"sizeMax"`
SizeMax uint64 `json:"sizeMax"`
}
// GetByGRIDData represents an array of data points
@@ -46,22 +46,17 @@ type GetByGRIDPoint struct {
}
type ItemTotalByGRID struct {
NodesCPU uint64 `json:"nodesCPU"`
StorageCapacity uint64 `json:"storageCapacity"`
CPUPower uint64 `json:"cpuPower"`
CPUUtil uint64 `json:"cpuUtil"`
TotalMem uint64 `json:"totalMem"`
ReservedMem uint64 `json:"reservedMem"`
UsedMem uint64 `json:"usedMem"`
FreeMem uint64 `json:"freeMem"`
VCPUConsumed uint64 `json:"vcpuConsumed"`
CPUPower float64 `json:"cpuPower"`
CPUUtil float64 `json:"cpuUtil"`
TotalMem float64 `json:"totalMem"`
ReservedMem float64 `json:"reservedMem"`
UsedMem float64 `json:"usedMem"`
FreeMem float64 `json:"freeMem"`
}
type ItemStorage struct {
CapacityLimit uint64 `json:"capacityLimit"`
Consumed uint64 `json:"consumed"`
Type string `json:"type"`
UID string `json:"uid"`
UsedGiB uint64 `json:"usedGiB"`
TotalGiB uint64 `json:"totalGiB"`
}
// GetByNodeData represents an array of data points
@@ -72,14 +67,15 @@ type GetByNodePoint struct {
CPUInfo CPUinfoByNode `json:"cpuInfo"`
Name string `json:"name"`
ID uint64 `json:"id"`
UID string `json:"uid"`
}
type NodeUsage struct {
CPUPower uint64 `json:"cpuPower"`
UsedVCPUs uint64 `json:"usedVcpus"`
PCPU uint64 `json:"pcpu"`
PCPU float64 `json:"pcpu"`
UsedMem uint64 `json:"usedMem"`
CPUUtil uint64 `json:"cpuUtil"`
CPUUtil float64 `json:"cpuUtil"`
ReservedMem uint64 `json:"reservedMem"`
FreeMem uint64 `json:"freeMem"`
}
@@ -88,4 +84,8 @@ type CPUinfoByNode struct {
ClockSpeed uint64 `json:"clockSpeed"`
CoreCount uint64 `json:"coreCount"`
PhysCount uint64 `json:"physCount"`
ThreadCount uint64 `json:"threadCount"`
ModelName string `json:"model_name"`
Flags []string `json:"flags"`
MaxSupportedGeneration string `json:"max_supported_generation"`
}

View File

@@ -81,6 +81,10 @@ type CreateRequest struct {
// SDN access group id
// Required: false
SDNAccessGroupID string `url:"sdn_access_group_id,omitempty" json:"sdn_access_group_id,omitempty"`
// Enabling default gateway
// Required: false
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
}
type StoragePolicy struct {

View File

@@ -3,8 +3,9 @@ package rg
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter

View File

@@ -3,8 +3,9 @@ package rg
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// SetCPUAllocationRatioRequest struct for setting CPU allocation ratio

View File

@@ -11,12 +11,12 @@ import (
// ConsumptionRequest struct to get consumption info
type ConsumptionRequest struct {
// Storage endpoint provider ID
// Required: true
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
// Required: false
SEPID uint64 `url:"sep_id,omitempty" json:"sep_id,omitempty"`
}
// Consumption gets SEP consumption info
func (s SEP) Consumption(ctx context.Context, req ConsumptionRequest) (*RecordConsumption, error) {
func (s SEP) Consumption(ctx context.Context, req ConsumptionRequest) (*ListConsumption, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
@@ -29,7 +29,7 @@ func (s SEP) Consumption(ctx context.Context, req ConsumptionRequest) (*RecordCo
return nil, err
}
info := RecordConsumption{}
info := ListConsumption{}
err = json.Unmarshal(res, &info)
if err != nil {

View File

@@ -47,8 +47,22 @@ type ByPool struct {
UsageLimit uint64 `json:"usage_limit"`
}
// List of Resource groups
type ListConsumption struct {
// Data
Data []RecordConsumption `json:"data"`
// Enrtry count
EntryCount uint64 `json:"entryCount"`
}
// Main information about consumption
type RecordConsumption struct {
// ID
ID uint64 `json:"id"`
// Name
Name string `json:"name"`
// By pool
ByPool map[string]ByPool `json:"byPool"`
@@ -57,6 +71,9 @@ type RecordConsumption struct {
// Type
Type string `json:"type"`
// Consumed by
ConsumedBy []uint64 `json:"consumedBy"`
}
// Main information about URI

View File

@@ -3,8 +3,9 @@ package vgpu
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// AllocateRequest struct for allocating VGPU

View File

@@ -3,8 +3,9 @@ package vgpu
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// CreateRequest struct for creating VGPU

View File

@@ -3,8 +3,9 @@ package vgpu
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// DeallocateRequest struct for deallocating VGPU

View File

@@ -3,8 +3,9 @@ package vgpu
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// DestroyRequest struct for destroying VGPU

View File

@@ -2,10 +2,10 @@ package vins
import (
"context"
"encoding/json"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
@@ -62,11 +62,11 @@ type CreateInAccountRequest struct {
// Required: false
// Default: false
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
}
type wrapperCreateRequestInAcc struct {
CreateInAccountRequest
Routes []string `url:"routes,omitempty"`
// Flag indicating whether default gateway is enabled for this VINS
// Required: false
// Default: true
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
}
// CreateInAccount creates VINS in account level
@@ -76,31 +76,9 @@ func (v VINS) CreateInAccount(ctx context.Context, req CreateInAccountRequest) (
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
var routes []string
if len(req.Routes) != 0 {
routes = make([]string, 0, len(req.Routes))
for r := range req.Routes {
b, err := json.Marshal(req.Routes[r])
if err != nil {
return 0, err
}
routes = append(routes, string(b))
}
} else {
routes = []string{"[]"}
}
reqWrapped := wrapperCreateRequestInAcc{
CreateInAccountRequest: req,
Routes: routes,
}
url := "/cloudbroker/vins/createInAccount"
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return 0, err
}

View File

@@ -2,10 +2,10 @@ package vins
import (
"context"
"encoding/json"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
@@ -56,11 +56,11 @@ type CreateInRGRequest struct {
// Required: false
// Default: false
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
}
type wrapperCreateRequestInRG struct {
CreateInRGRequest
Routes []string `url:"routes,omitempty"`
// Flag indicating whether default gateway is enabled for this VINS
// Required: false
// Default: true
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
}
// CreateInRG creates VINS in resource group level
@@ -69,31 +69,10 @@ func (v VINS) CreateInRG(ctx context.Context, req CreateInRGRequest) (uint64, er
if err != nil {
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
var routes []string
if len(req.Routes) != 0 {
routes = make([]string, 0, len(req.Routes))
for r := range req.Routes {
b, err := json.Marshal(req.Routes[r])
if err != nil {
return 0, err
}
routes = append(routes, string(b))
}
} else {
routes = []string{"[]"}
}
reqWrapped := wrapperCreateRequestInRG{
CreateInRGRequest: req,
Routes: routes,
}
url := "/cloudbroker/vins/createInRG"
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return 0, err
}

View File

@@ -523,6 +523,9 @@ type RecordVINS struct {
// Description
Description string `json:"desc"`
// Enable Default Gateway
EnableDefaultGateway bool `json:"enable_default_gateway"`
// Enable Security Groups
EnableSecGroups bool `json:"enable_secgroups"`
@@ -736,6 +739,9 @@ type ItemVINS struct {
// Description
Description string `json:"desc"`
// Enable Default Gateway
EnableDefaultGateway bool `json:"enable_default_gateway"`
// Enable Security Groups
EnableSecGroups bool `json:"enable_secgroups"`

View File

@@ -25,6 +25,10 @@ type UpdateRequest struct {
// Flag indicating whether security groups are enabled for this network
// Required: false
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
// Flag indicating whether default gateway is enabled for this VINS
// Required: false
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
}
// Update updates a vins parameters

View File

@@ -12,6 +12,21 @@ type CpuAlignmentProfile struct {
Model string `json:"model"`
}
// Supported CPU model
type SupportedCpuModel struct {
// Vendor
Vendor string `json:"vendor"`
// Model
Model string `json:"model"`
// Count
Count uint64 `json:"count"`
// Percentage
Percentage float64 `json:"percentage"`
}
// CPU alignment profile candidate
type CpuAlignmentProfileCandidate struct {
// Profile name
@@ -27,7 +42,7 @@ type CpuAlignmentProfileCandidate struct {
Count uint64 `json:"count"`
// Percentage
Percentage uint64 `json:"percentage"`
Percentage float64 `json:"percentage"`
// Required count
RequiredCount uint64 `json:"required_count"`
@@ -40,6 +55,9 @@ type TestCPUAlignmentProfileResult struct {
// Candidates
Candidates []CpuAlignmentProfileCandidate `json:"candidates"`
// Supported CPU models
SupportedCpuModels []SupportedCpuModel `json:"supported_cpu_models"`
}
// Item for list_cpu_alignment_profile response
@@ -159,6 +177,12 @@ type RecordZone struct {
// CPU alignment profiles
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
// Reserved CPU
ReservedCPU uint64 `json:"reserved_cpu"`
// Reserved RAM
ReservedRAM uint64 `json:"reserved_ram"`
}
// A zone item from a list
@@ -231,4 +255,10 @@ type ItemZone struct {
// CPU alignment profiles
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
// Reserved CPU
ReservedCPU uint64 `json:"reserved_cpu"`
// Reserved RAM
ReservedRAM uint64 `json:"reserved_ram"`
}

View File

@@ -0,0 +1,42 @@
package zone
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// SetResourcesLimitRequest struct to set resources limit
type SetResourcesLimitRequest struct {
// ID of the zone
// Required: true
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
// Number of CPU cores reserved
// Required: true
ReservedCPU uint64 `url:"reserved_cpu" json:"reserved_cpu"`
// Amount of RAM in MB reserved
// Required: true
ReservedRAM uint64 `url:"reserved_ram" json:"reserved_ram"`
}
// SetResourcesLimit sets reserved CPU and RAM limits for the zone
func (e Zone) SetResourcesLimit(ctx context.Context, req SetResourcesLimitRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/zone/set_resources_limit"
res, err := e.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return false, err
}
return strconv.ParseBool(string(res))
}

View File

@@ -0,0 +1,46 @@
package zone
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// UpdateCPUAlignmentProfileRequest struct to update CPU alignment profile of zone
type UpdateCPUAlignmentProfileRequest struct {
// ID of zone
// Required: true
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
// Minimum percentage of hypervisors that must support the selected CPU model for the balanced profile
// Default: 70
// Required: false
HypervisorSimilarityInPercentage uint64 `url:"hypervisor_similarity_in_percentage,omitempty" json:"hypervisor_similarity_in_percentage,omitempty" validate:"omitempty,max=100"`
}
// UpdateCPUAlignmentProfile updates CPU alignment profile of zone
func (e Zone) UpdateCPUAlignmentProfile(ctx context.Context, req UpdateCPUAlignmentProfileRequest) ([]CpuAlignmentProfile, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/zone/update_cpu_alignment_profile"
res, err := e.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return nil, err
}
var profiles []CpuAlignmentProfile
err = json.Unmarshal(res, &profiles)
if err != nil {
return nil, err
}
return profiles, nil
}

View File

@@ -2,8 +2,8 @@ package hypervisors
import (
"context"
"encoding/json"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
@@ -17,27 +17,21 @@ type DeleteRequest struct {
}
// Delete a hypervisor
func (hv Hypervisors) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
func (hv Hypervisors) Delete(ctx context.Context, req DeleteRequest) (*RecordVersion, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/sdn/hypervisor/delete"
res, err := hv.client.DecortApiCallCtype(ctx, http.MethodDelete, url, constants.MIMEJSON, req)
info := RecordVersion{}
err = json.Unmarshal(res, &info)
if err != nil {
return false, err
return nil, err
}
if string(res) == "" {
return true, nil
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
return &info, nil
}

View File

@@ -1,5 +1,11 @@
package hypervisors
// Information about a version
type RecordVersion struct {
// Version ID
VersionID uint64 `json:"version_id"`
}
// Main information about hypervisor
type RecordHypervisor struct {
// Created at

View File

@@ -55,34 +55,35 @@ type CreateRequest struct {
// Logical port addresses
// Required: false
LogicalPortAddresses []LogicalPortAddress `url:"logical_port_addresses,omitempty" json:"logical_port_addresses,omitempty" validate:"dive"`
LogicalPortAddresses []LogicalPortAddressRequest `url:"logical_port_addresses,omitempty" json:"logical_port_addresses,omitempty" validate:"dive"`
// Labels
// Required: false
Labels CreateLabels `url:"labels,omitempty" json:"labels,omitempty"`
Labels *CreateLabels `url:"labels,omitempty" json:"labels"`
}
// LogicalPortAddressRequest struct representing logical port address
type LogicalPortAddressRequest struct {
// IP address
// IP address. IPv4 or IPv6 address of the logical port
// If nil (allowed only when IsPrimary is true), the system will automatically generate a valid address
// Required: true
IP string `url:"ip" json:"ip" validate:"required"`
IP interface{} `url:"ip" json:"ip" validate:"omitempty,isString"`
// IP type
// Required: true
IPType string `url:"ip_type" json:"ip_type" validate:"required,oneof=IPv4 IPv6"`
// Is primary. True or False
// Is primary
// Required: true
IsPrimary interface{} `url:"is_primary" json:"is_primary" validate:"required,isBool"`
// Is discovered
// Required: true
IsDiscovered interface{} `url:"is_discovered" json:"is_discovered" validate:"required,isBool"`
// MAC address
// Required: false
MAC string `url:"mac,omitempty" json:"mac,omitempty"`
// Is discovered. True or False
// Required: true
IsDiscovered bool `url:"is_discovered" json:"is_discovered" validate:"required"`
}
// Create creates a logical port

View File

@@ -34,6 +34,9 @@ type LogicalPort struct {
// Enabled
Enabled bool `json:"enabled"`
// Exclude firewall information
ExcludeFirewall ExcludeFirewall `json:"exclude_firewall"`
// External network ID
ExternalNetworkID string `json:"external_network_id"`
@@ -162,6 +165,18 @@ type MigrationStatus struct {
VersionID uint64 `json:"version_id"`
}
// ExcludeFirewall information
type ExcludeFirewall struct {
// Exclusion reason
ExclusionReason string `json:"exclusion_reason"`
// Whether logical port addresses are excluded from firewall
LogicalPortAddressesExcluded bool `json:"logical_port_addresses_excluded"`
// Whether logical port is excluded from firewall
LogicalPortExcluded bool `json:"logical_port_excluded"`
}
// Labels information
type Labels struct {
// VM ID

View File

@@ -67,7 +67,7 @@ type UpdateRequest struct {
// Labels
// Required: false
Labels UpdateLabels `url:"labels,omitempty" json:"labels,omitempty"`
Labels *UpdateLabels `url:"labels,omitempty" json:"labels"`
}
// UpdateAddress struct representing update address
@@ -86,7 +86,7 @@ type UpdateAddress struct {
// Is discovered. True or False
// Required: true
IsDiscovered bool `url:"is_discovered" json:"is_discovered" validate:"required"`
IsDiscovered interface{} `url:"is_discovered" json:"is_discovered" validate:"required,isBool"`
// Is primary. True or False
// Required: true
@@ -107,17 +107,17 @@ type AddAddress struct {
// Required: true
IPType string `url:"ip_type" json:"ip_type" validate:"required,oneof=IPv4 IPv6"`
// Is discovered. True or False
// Is discovered
// Required: true
IsDiscovered bool `url:"is_discovered" json:"is_discovered" validate:"required"`
IsDiscovered interface{} `url:"is_discovered" json:"is_discovered" validate:"required,isBool"`
// Is primary. True or False
// Is primary
// Required: true
IsPrimary interface{} `url:"is_primary" json:"is_primary" validate:"required,isBool"`
// MAC address
// Required: false
MAC string `url:"mac,omitempty" json:"mac,omitempty"`
// Required: true
MAC string `url:"mac" json:"mac" validate:"required"`
}
// Update updates a logical port

View File

@@ -182,7 +182,7 @@ type L2ExternalNetwork struct {
}
// Info about an external network port
type ExternalNetworkPort struct {
type ExternalNetworkPorts struct {
// Access group ID
AccessGroupID string `json:"access_group_id"`
@@ -192,9 +192,6 @@ type ExternalNetworkPort struct {
// Bridge network name
BridgeNetworkName string `json:"bridge_network_name"`
// Comment
Comment string `json:"comment"`
// Default gateway for IPv4
DefaultGatewayIPv4 string `json:"default_gateway_ipv4"`
@@ -204,9 +201,6 @@ type ExternalNetworkPort struct {
// Description
Description string `json:"description"`
// Is a logical port enabled
Enabled bool `json:"enabled"`
// Details of external network ports
ExternalNetworkPorts ExternalNetworkPortsField `json:"external_network_ports"`
@@ -216,9 +210,6 @@ type ExternalNetworkPort struct {
// ID of an external network port
ID string `json:"id"`
// IP v4
IPv4 string `json:"ipv4"`
// Status
Status Status `json:"status"`
@@ -239,14 +230,8 @@ type ExternalNetworkPort struct {
// VLAN Tag
VLANTag int `json:"vlan_tag"`
// MAC
MAC string `json:"mac"`
}
// List of external network ports
type ExternalNetworkPorts []ExternalNetworkPort
// Info about a logical port
type LogicalPort struct {
// ID

View File

@@ -30,7 +30,6 @@ func (m *migrator) Migrate(ctxOrigin context.Context, dxVMID, nodeID uint64) (bo
req := compute.MigrateRequest{
ComputeID: dxVMID,
TargetNodeID: nodeID,
Force: false,
}
ctx, cancel := context.WithTimeout(ctxOrigin, m.cfg.QueryTimeout)
ok, err := m.client.CloudBroker().Compute().Migrate(ctx, req)