Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fea00bbb42 | |||
|
|
e9adcfec1c | ||
| f6bc14c7be | |||
|
|
f93065e8b1 | ||
|
|
2bd93e92c2 | ||
|
|
5cdae8520f | ||
| 30e464e4d2 | |||
| 9258a1574b | |||
|
|
444a33dc7e |
193
CHANGELOG.md
193
CHANGELOG.md
@@ -1,4 +1,4 @@
|
||||
## Version 1.14.3
|
||||
## Version 1.15.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 и в следующих версиях будут удалены
|
||||
@@ -7,64 +7,193 @@
|
||||
|
||||
Все методы группы `.SDN()` находятся в альфа-версии.
|
||||
|
||||
|
||||
### Добавлено
|
||||
|
||||
#### 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 |
|
||||
|
||||
#### disks
|
||||
| Идентификатор задачи | Описание |
|
||||
| --- | --- |
|
||||
| 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 |
|
||||
|
||||
#### SDN logicalports
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-896 | Обязательное поле `ID` в структуру запроса `UpdateAddress` в sdn/logical_port |
|
||||
|
||||
#### SDN netobjgroups
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-884 | Опциональное поле `Type` в структуру запроса `ListRequest` в sdn/netobjgroups |
|
||||
|
||||
### Изменено
|
||||
|
||||
#### account
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-887 | Тип поля `CPUAllocationRatio` с `float64` на `uint64` в структуре ответа `RecordAccount` в cloudapi/account |
|
||||
| BGOS-887 | Тип поля `CPUAllocationRatio` с `float64` на `uint64` в структуре ответа `InfoAccount` в cloudbroker/account |
|
||||
|
||||
#### compute
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-805 | Вычисляемое поле `Provision` в структуру ответа `ItemComputeDisk` в cloudapi/compute и в структуру ответа `ItemDisk` в cloudbroker/compute |
|
||||
| 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-806 | Вычисляемое поле `Provision` в структуры ответа `ItemDisk`, `ItemDiskUnattached` и `RecordDisk` в cloudapi/disks и в структуру ответа `InfoDisk` в cloudbroker/disks |
|
||||
| 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 |
|
||||
|
||||
### node
|
||||
#### grid
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-802 | Опциональное поле `Target` в структуру запроса `GetLogicalCoresCountRequest` в cloudbroker/node |
|
||||
| BGOS-888 | Тип поля `Ratio` с `float64` на `uint64` в структурах запросов `SetCPUAllocationRatioRequest`, `SetCPUAllocationRatioForVMRequest` и `SetMemAllocationRatioRequest` в cloudbroker/grid |
|
||||
|
||||
#### rg
|
||||
#### image
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-803 | Опциональное поле `CPUAllocationParameter` в структуру запроса `UpdateRequest` в cloudbroker/rg |
|
||||
|
||||
#### SDN Logical Ports
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-695 | Опциональное поле `Labels` в структуры запроса `CreateRequest` и `UpdateRequest` в sdn/logical_ports |
|
||||
| BGOS-695 | Вычисляемое поле `Labels` в структуру ответа `LogicalPort` в sdn/logical_ports |
|
||||
| BGOS-695 | Опциональные поля `OperationStatus` и `HypervisorStatus` в структуру запроса `ListRequest` в sdn/logical_ports |
|
||||
| BGOS-695 | Вычисляемые поля `OperationStatus` и `HypervisorStatus` в структуре `Status` в структуру ответа `LogicalPort` в sdn/logical_ports |
|
||||
|
||||
### Изменено
|
||||
|
||||
#### compute
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-794 | Тип возвращаемого значения метода `AbortSharedSnapshotMerge` с `bool` на `string` в cloudapi/compute и в cloudbroker/compute |
|
||||
| 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-808 | Минимальное значение поля `MTU` в структуре `Interface` в cloudapi/kvmx86 и cloudbroker/kvmx86 и в структуре `InterfaceMassCreate` в cloudbroker/kvmx86 с 1 на 1500 |
|
||||
| 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 |
|
||||
|
||||
#### zone
|
||||
#### node
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-807 | JSON-тег у вычисляемого поля `LBIDs` в структуре ответа `RecordZone` с `lbIds` на `lbsIds` в cloudapi/zone |
|
||||
| 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 |
|
||||
|
||||
#### SDN Logical Ports
|
||||
#### resmon
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-695 | Имя вычисляемого поля со `Status` на `OperationStatus` в sdn/logical_ports |
|
||||
| BGOS-868 | Тип поля `EndTime` с обязательного на опциональное в структурах запроса `GetByNodeRequest`, `GetByNodesRequest` `GetByGRIDRequest`, `GetByComputeRequest` и `GetByComputesRequest` в cloudbroker/resmon |
|
||||
|
||||
#### rg
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| 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 |
|
||||
|
||||
#### 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 |
|
||||
|
||||
### Исправлено
|
||||
|
||||
#### vfpool
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-871 | Тип поля `Config` в структуре запроса `wrapperUpdateRequest` с `[]string` на `string` в cloudbroker/vfpool |
|
||||
|
||||
### Удалено
|
||||
|
||||
#### SDN Logical Ports
|
||||
#### grid
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-695 | Обязательное поле `IsExcludedFromFirewall` в структурах запроса `CreateRequest` и `UpdateRequest` в sdn/logical_ports |
|
||||
| BGOS-695 | Вычисляемое поле `IsExcludedFromFirewall` в структуре `Bindings` в структуре ответа `LogicalPort` в sdn/logical_ports |
|
||||
| BGOS-695 | Вычисляемое поле `Common` в структуре `Status` в структуре ответа `LogicalPort` в sdn/logical_ports |
|
||||
| BGOS-695 | Структуры запроса `ExcludeFirewallRequest`, `UnexcludeFirewallRequest`, `CreateBatchRequest` и `DeleteBatchRequest` и методы `ExcludeFirewall`, `UnexcludeFirewall`, `CreateBatch` и `DeleteBatch` в sdn/logical_ports |
|
||||
| BGOS-888 | Вычисляемые поля `CKey` и `Meta` из структуры ответа `RecordGrid` в cloudbroker/grid |
|
||||
|
||||
#### user
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-861 | Значение по умолчанию опционального поля `Password` в структуре запроса `CreateRequest` в cloudbroker/user |
|
||||
| BGOS-875 | Опциональное поле `Password` из структуры ответа `ItemUser` в cloudbroker/user |
|
||||
|
||||
10
README.md
10
README.md
@@ -19,6 +19,7 @@ Decort SDK - это библиотека, написанная на языке G
|
||||
- Версия 1.12.х Decort-SDK соответствует 4.4.0 версии платформы
|
||||
- Версия 1.13.х Decort-SDK соответствует 4.5.0 версии платформы
|
||||
- Версия 1.14.х Decort-SDK соответствует 4.6.0 версии платформы
|
||||
- Версия 1.15.х Decort-SDK соответствует 4.7.0 версии платформы
|
||||
|
||||
## Оглавление
|
||||
|
||||
@@ -132,6 +133,7 @@ go get -u repository.basistech.ru/BASIS/decort-golang-sdk
|
||||
- `Trunk` - получение информации о транковых портах;
|
||||
- `VFPool` - управление пулом виртуальных сетевых функций;
|
||||
- `VINS` - управление виртуальными изолированными сетями;
|
||||
- `VGPU` - управление виртуальными графическими процессорами;
|
||||
- `Zone` - управление зонами.
|
||||
|
||||
### Cloudbroker
|
||||
@@ -181,12 +183,14 @@ go get -u repository.basistech.ru/BASIS/decort-golang-sdk
|
||||
- `Address pool` - управление пулами адресов;
|
||||
- `DefaultSecurityPolicies` - управление политиками хранения по умолчанию;
|
||||
- `ExtNet` - управление виртуальными сетями, отвечающими за внешний доступ;
|
||||
- `Hypervisors` - управление гипервизорами;
|
||||
- `FloatingIPs` - управление плавающими IP-адресами;
|
||||
- `Logical ports` - управление логическими портами;
|
||||
- `NetworkObjectGroups` - управление группами объектов сети;
|
||||
- `Routers` - управление роутерами;
|
||||
- `SecurityPolicies` - управление политиками хранения;
|
||||
- `Segments` - управление сегментами;
|
||||
- `Version` - получение информации о версии SDN;
|
||||
|
||||
## Работа с библиотекой
|
||||
|
||||
@@ -342,6 +346,7 @@ func main() {
|
||||
- `pkg/cloudapi/trunk` - для `Trunk`
|
||||
- `pkg/cloudapi/vfpool` - для `VFPool`
|
||||
- `pkg/cloudapi/vins` - для `VINS`
|
||||
- `pkg/cloudapi/vgpu` - для `VGPU`
|
||||
- `pkg/cloudapi/zone` - для `Zone`
|
||||
- **cloudbroker**:
|
||||
- `pkg/cloudbroker/account` - для `Account`
|
||||
@@ -381,12 +386,14 @@ func main() {
|
||||
- `pkg/sdn/adrspools` - для `Address pool`
|
||||
- `pkg/sdn/defsecpolicies` - для `DefaultSecurityPolicies`
|
||||
- `pkg/sdn/external_networks` - для `ExtNet`
|
||||
- `pkg/sdn/hypervisors` - для `Hypervisors`
|
||||
- `pkg/sdn/flips` - для `FloatingIPs`
|
||||
- `pkg/sdn/logicalports` - для `Logical ports`
|
||||
- `pkg/sdn/netobjgroups` - для `NetworkObjectGroups`
|
||||
- `pkg/sdn/routers` - для `Routers`
|
||||
- `pkg/sdn/secpolicies` - для `SecurityPolicies`
|
||||
- `pkg/sdn/segments` - для `Segments`
|
||||
- `pkg/sdn/version` - для `Version`
|
||||
|
||||
Все поля структуры имеют описание, в которых содержится:
|
||||
|
||||
@@ -538,6 +545,7 @@ func main() {
|
||||
- `.Trunk()` - для работы с `Trunk`
|
||||
- `.VFPool()` - для работы с `VFPool`
|
||||
- `.VINS()` - для работы с `VINS`
|
||||
- `.VGPU()` - для работы с `VGPU`
|
||||
- `.Zone()` - для работы с `Zone`
|
||||
|
||||
Доступные методы для `.CloudBroker()`:
|
||||
@@ -581,12 +589,14 @@ func main() {
|
||||
- `.AddressPool()` - для работы с `Addres pool`
|
||||
- `.DefaultSecurityPolicies()` - для работы с `DefaultSecurityPolicies`
|
||||
- `.ExtNet()` - для работы с `ExtNet`
|
||||
- `.Hypervisors()` - для работы с `Hypervisors`
|
||||
- `.FloatingIPs()` - для работы с `FloatingIPs`
|
||||
- `.LogicalPorts()` - для работы с `Logical ports`
|
||||
- `.NetworkObjectGroups()` - для работы с `NetworkObjectGroups`
|
||||
- `.Routers()` - для работы с `Routers`
|
||||
- `.SecurityPolicies()` - для работы с `SecurityPolicies`
|
||||
- `.Segments()` - для работы с `Segments`
|
||||
- `.Version()` - для работы с `Version`
|
||||
|
||||
3. Вызвать метод, отвечающий за выполнение запроса и передать в него:
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ var FileName = map[string]string{
|
||||
var K8sValues = []string{"labels", "taints", "annotations, additionalSANs"}
|
||||
|
||||
var VersionMap = map[string]string{
|
||||
"4.7.0": "-",
|
||||
"4.6.0": "-",
|
||||
"4.5.0": "-",
|
||||
"4.4.0": "-",
|
||||
|
||||
@@ -464,3 +464,23 @@ func sepTechStatusValidator(fe validator.FieldLevel) bool {
|
||||
|
||||
return IsInSlice(fieldValue, sepTechStatusValues)
|
||||
}
|
||||
|
||||
// pciDeviceHWPathValidator is used to validate PCI device hardware path fields (e.g. 0000:81:00.0)
|
||||
func pciDeviceHWPathValidator(fe validator.FieldLevel) bool {
|
||||
fieldValue := fe.Field().String()
|
||||
|
||||
ok, _ := regexp.MatchString(`^[0-9a-fA-F]{4}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}\.[0-7]$`, fieldValue)
|
||||
return ok
|
||||
}
|
||||
|
||||
// sepNameValidator is used to validate SEP name fields
|
||||
func sepNameValidator(fe validator.FieldLevel) bool {
|
||||
ok, _ := regexp.MatchString(`^[a-zA-Zа-яА-ЯёЁ0-9][a-zA-Zа-яА-ЯёЁ0-9_.\[\]()\-]*$`, fe.Field().String())
|
||||
return ok
|
||||
}
|
||||
|
||||
// sepDescriptionValidator is used to validate SEP description fields
|
||||
func sepDescriptionValidator(fe validator.FieldLevel) bool {
|
||||
ok, _ := regexp.MatchString(`^[a-zA-Zа-яА-ЯёЁ0-9_.\[\]()\-]*$`, fe.Field().String())
|
||||
return ok
|
||||
}
|
||||
|
||||
@@ -306,5 +306,20 @@ func registerAllValidators(validate *validator.Validate) error {
|
||||
return err
|
||||
}
|
||||
|
||||
err = validate.RegisterValidation("pciDeviceHWPath", pciDeviceHWPathValidator)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = validate.RegisterValidation("sepName", sepNameValidator)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = validate.RegisterValidation("sepDescription", sepDescriptionValidator)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ type RecordAccount struct {
|
||||
CPUAllocationParameter string `json:"cpu_allocation_parameter"`
|
||||
|
||||
// CPU allocation ratio
|
||||
CPUAllocationRatio float64 `json:"cpu_allocation_ratio"`
|
||||
CPUAllocationRatio uint64 `json:"cpu_allocation_ratio"`
|
||||
|
||||
// Created by
|
||||
CreatedBy string `json:"createdBy"`
|
||||
|
||||
@@ -18,6 +18,11 @@ type AbortSharedSnapshotMergeRequest struct {
|
||||
Label string `url:"label" json:"label" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperAbortSharedSnapshotMergeRequest struct {
|
||||
AbortSharedSnapshotMergeRequest
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// AbortSharedSnapshotMerge shared snapshots merge abort
|
||||
func (c Compute) AbortSharedSnapshotMerge(ctx context.Context, req AbortSharedSnapshotMergeRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -25,9 +30,36 @@ func (c Compute) AbortSharedSnapshotMerge(ctx context.Context, req AbortSharedSn
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperAbortSharedSnapshotMergeRequest{
|
||||
AbortSharedSnapshotMergeRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/abort_shared_snapshot_merge"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
// AbortSharedSnapshotMergeAsync shared snapshots merge abort in async mode
|
||||
func (c Compute) AbortSharedSnapshotMergeAsync(ctx context.Context, req AbortSharedSnapshotMergeRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperAbortSharedSnapshotMergeRequest{
|
||||
AbortSharedSnapshotMergeRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/abort_shared_snapshot_merge"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -15,6 +15,12 @@ type CDEjectRequest struct {
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperCDEjectRequest struct {
|
||||
CDEjectRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// CDEject eject CD image to compute's CD-ROM
|
||||
func (c Compute) CDEject(ctx context.Context, req CDEjectRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -22,9 +28,14 @@ func (c Compute) CDEject(ctx context.Context, req CDEjectRequest) (bool, error)
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperCDEjectRequest{
|
||||
CDEjectRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/cdEject"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -33,5 +44,28 @@ func (c Compute) CDEject(ctx context.Context, req CDEjectRequest) (bool, error)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// CDEjectAsync ejects CD image to compute's CD-ROM with AsyncMode
|
||||
func (c Compute) CDEjectAsync(ctx context.Context, req CDEjectRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperCDEjectRequest{
|
||||
CDEjectRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/cdEject"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -19,6 +19,12 @@ type CDInsertRequest struct {
|
||||
CDROMID uint64 `url:"cdromId" json:"cdromId" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperCDInsertRequest struct {
|
||||
CDInsertRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// CDInsert insert new CD image to compute's CD-ROM
|
||||
func (c Compute) CDInsert(ctx context.Context, req CDInsertRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -26,9 +32,14 @@ func (c Compute) CDInsert(ctx context.Context, req CDInsertRequest) (bool, error
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperCDInsertRequest{
|
||||
CDInsertRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/cdInsert"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -37,5 +48,28 @@ func (c Compute) CDInsert(ctx context.Context, req CDInsertRequest) (bool, error
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// CDInsertAsync inserts new CD image to compute's CD-ROM with AsyncMode
|
||||
func (c Compute) CDInsertAsync(ctx context.Context, req CDInsertRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperCDInsertRequest{
|
||||
CDInsertRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/cdInsert"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -31,6 +31,12 @@ type ChangeIPRequest struct {
|
||||
IPAddr string `url:"ip_addr" json:"ip_addr" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperChangeIPRequest struct {
|
||||
ChangeIPRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// ChangeIP change reserved IP for compute instance
|
||||
func (c Compute) ChangeIP(ctx context.Context, req ChangeIPRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -38,9 +44,14 @@ func (c Compute) ChangeIP(ctx context.Context, req ChangeIPRequest) (bool, error
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperChangeIPRequest{
|
||||
ChangeIPRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/changeIp"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -52,3 +63,25 @@ func (c Compute) ChangeIP(ctx context.Context, req ChangeIPRequest) (bool, error
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ChangeIPAsync change reserved IP for compute instance with AsyncMode
|
||||
func (c Compute) ChangeIPAsync(ctx context.Context, req ChangeIPRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperChangeIPRequest{
|
||||
ChangeIPRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/changeIp"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -3,8 +3,9 @@ package compute
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// ChangeLinkStateRequest struct to change link state
|
||||
@@ -23,6 +24,12 @@ type ChangeLinkStateRequest struct {
|
||||
State string `url:"state" json:"state" validate:"required,interfaceState"`
|
||||
}
|
||||
|
||||
type wrapperChangeLinkStateRequest struct {
|
||||
ChangeLinkStateRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// ChangeLinkState changes the status link virtual of compute
|
||||
func (c Compute) ChangeLinkState(ctx context.Context, req ChangeLinkStateRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -30,9 +37,14 @@ func (c Compute) ChangeLinkState(ctx context.Context, req ChangeLinkStateRequest
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperChangeLinkStateRequest{
|
||||
ChangeLinkStateRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/changeLinkState"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -41,5 +53,28 @@ func (c Compute) ChangeLinkState(ctx context.Context, req ChangeLinkStateRequest
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ChangeLinkStateAsync changes the status link virtual of compute with AsyncMode
|
||||
func (c Compute) ChangeLinkStateAsync(ctx context.Context, req ChangeLinkStateRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperChangeLinkStateRequest{
|
||||
ChangeLinkStateRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/changeLinkState"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,12 @@ type ChangeMTURequest struct {
|
||||
MTU uint64 `url:"mtu" json:"mtu" validate:"required" validate:"omitempty,mtu"`
|
||||
}
|
||||
|
||||
type wrapperChangeMTURequest struct {
|
||||
ChangeMTURequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// ChangeMTU change MTU for compute instance
|
||||
func (c Compute) ChangeMTU(ctx context.Context, req ChangeMTURequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -30,9 +36,14 @@ func (c Compute) ChangeMTU(ctx context.Context, req ChangeMTURequest) (bool, err
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperChangeMTURequest{
|
||||
ChangeMTURequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/change_mtu"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -44,3 +55,25 @@ func (c Compute) ChangeMTU(ctx context.Context, req ChangeMTURequest) (bool, err
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ChangeMTUAsync change MTU for compute instance with AsyncMode
|
||||
func (c Compute) ChangeMTUAsync(ctx context.Context, req ChangeMTURequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperChangeMTURequest{
|
||||
ChangeMTURequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/change_mtu"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -27,6 +27,12 @@ type ChangeSecGroupsRequest struct {
|
||||
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||
}
|
||||
|
||||
type wrapperChangeSecGroupsRequest struct {
|
||||
ChangeSecGroupsRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// ChangeSecGroups changes security groups for compute
|
||||
func (c Compute) ChangeSecGroups(ctx context.Context, req ChangeSecGroupsRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -34,9 +40,14 @@ func (c Compute) ChangeSecGroups(ctx context.Context, req ChangeSecGroupsRequest
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperChangeSecGroupsRequest{
|
||||
ChangeSecGroupsRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/change_security_groups"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -48,3 +59,25 @@ func (c Compute) ChangeSecGroups(ctx context.Context, req ChangeSecGroupsRequest
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ChangeSecGroupsAsync changes security groups for compute with AsyncMode
|
||||
func (c Compute) ChangeSecGroupsAsync(ctx context.Context, req ChangeSecGroupsRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperChangeSecGroupsRequest{
|
||||
ChangeSecGroupsRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/change_security_groups"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -44,6 +44,12 @@ type CloneRequest struct {
|
||||
SEPID uint64 `url:"sep_id" json:"sep_id"`
|
||||
}
|
||||
|
||||
type wrapperCloneRequest struct {
|
||||
CloneRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
|
||||
}
|
||||
|
||||
// Clone clones compute instance
|
||||
func (c Compute) Clone(ctx context.Context, req CloneRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -51,9 +57,36 @@ func (c Compute) Clone(ctx context.Context, req CloneRequest) (string, error) {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperCloneRequest{
|
||||
CloneRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/clone"
|
||||
|
||||
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
// CloneAsync clones compute instance with AsyncMode
|
||||
func (c Compute) CloneAsync(ctx context.Context, req CloneRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperCloneRequest{
|
||||
CloneRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/clone"
|
||||
|
||||
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -23,6 +23,12 @@ type DeleteRequest struct {
|
||||
DetachDisks bool `url:"detachDisks,omitempty" json:"detachDisks,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperDeleteRequest struct {
|
||||
DeleteRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Delete deletes compute
|
||||
func (c Compute) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -30,9 +36,14 @@ func (c Compute) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDeleteRequest{
|
||||
DeleteRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/delete"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -44,3 +55,25 @@ func (c Compute) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DeleteAsync deletes compute with AsyncMode
|
||||
func (c Compute) DeleteAsync(ctx context.Context, req DeleteRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDeleteRequest{
|
||||
DeleteRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/delete"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
39
pkg/cloudapi/compute/delete_cpu_alignment_profile.go
Normal file
39
pkg/cloudapi/compute/delete_cpu_alignment_profile.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// DeleteCPUAlignmentProfileRequest struct to delete CPU alignment profile for computes
|
||||
type DeleteCPUAlignmentProfileRequest struct {
|
||||
// IDs of the compute instances
|
||||
// Required: true
|
||||
ComputeIDs []uint64 `url:"compute_ids" json:"compute_ids" validate:"min=1"`
|
||||
}
|
||||
|
||||
// DeleteCPUAlignmentProfile deletes CPU alignment profile for computes
|
||||
func (c Compute) DeleteCPUAlignmentProfile(ctx context.Context, req DeleteCPUAlignmentProfileRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/delete_cpu_alignment_profile"
|
||||
|
||||
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@@ -15,6 +15,12 @@ type DisableRequest struct {
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperDisableRequest struct {
|
||||
DisableRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Disable disables compute
|
||||
func (c Compute) Disable(ctx context.Context, req DisableRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -22,9 +28,14 @@ func (c Compute) Disable(ctx context.Context, req DisableRequest) (bool, error)
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDisableRequest{
|
||||
DisableRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/disable"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -36,3 +47,25 @@ func (c Compute) Disable(ctx context.Context, req DisableRequest) (bool, error)
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DisableAsync disables compute with AsyncMode
|
||||
func (c Compute) DisableAsync(ctx context.Context, req DisableRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDisableRequest{
|
||||
DisableRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/disable"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -51,6 +51,16 @@ type DiskAddRequest struct {
|
||||
// Desired bus number (hex string, e.g. "0x03")
|
||||
// Required: false
|
||||
BusNumber string `url:"bus_number,omitempty" json:"bus_number,omitempty"`
|
||||
|
||||
// Mount disk in read-only mode
|
||||
// Required: false
|
||||
ReadOnly bool `url:"read_only,omitempty" json:"read_only,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperDiskAddRequest struct {
|
||||
DiskAddRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// DiskAdd creates new disk and attach to compute
|
||||
@@ -60,9 +70,14 @@ func (c Compute) DiskAdd(ctx context.Context, req DiskAddRequest) (uint64, error
|
||||
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskAddRequest{
|
||||
DiskAddRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/diskAdd"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -74,3 +89,25 @@ func (c Compute) DiskAdd(ctx context.Context, req DiskAddRequest) (uint64, error
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DiskAddAsync creates new disk and attach to compute with AsyncMode
|
||||
func (c Compute) DiskAddAsync(ctx context.Context, req DiskAddRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskAddRequest{
|
||||
DiskAddRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/diskAdd"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -25,6 +25,16 @@ type DiskAttachRequest struct {
|
||||
// Desired bus number (hex string, e.g. "0x03")
|
||||
// Required: false
|
||||
BusNumber string `url:"bus_number,omitempty" json:"bus_number,omitempty"`
|
||||
|
||||
// Mount disk in read-only mode
|
||||
// Required: false
|
||||
ReadOnly bool `url:"read_only,omitempty" json:"read_only,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperDiskAttachRequest struct {
|
||||
DiskAttachRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// DiskAttach attach disk to compute
|
||||
@@ -34,9 +44,14 @@ func (c Compute) DiskAttach(ctx context.Context, req DiskAttachRequest) (bool, e
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskAttachRequest{
|
||||
DiskAttachRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/diskAttach"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -48,3 +63,25 @@ func (c Compute) DiskAttach(ctx context.Context, req DiskAttachRequest) (bool, e
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DiskAttachAsync attaches disk to compute with AsyncMode
|
||||
func (c Compute) DiskAttachAsync(ctx context.Context, req DiskAttachRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskAttachRequest{
|
||||
DiskAttachRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/diskAttach"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,12 @@ type DiskDelRequest struct {
|
||||
Permanently bool `url:"permanently" json:"permanently"`
|
||||
}
|
||||
|
||||
type wrapperDiskDelRequest struct {
|
||||
DiskDelRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// DiskDel delete disk and detach from compute
|
||||
func (c Compute) DiskDel(ctx context.Context, req DiskDelRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -30,9 +36,14 @@ func (c Compute) DiskDel(ctx context.Context, req DiskDelRequest) (bool, error)
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskDelRequest{
|
||||
DiskDelRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/diskDel"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -44,3 +55,25 @@ func (c Compute) DiskDel(ctx context.Context, req DiskDelRequest) (bool, error)
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DiskDelAsync deletes disk and detaches from compute with AsyncMode
|
||||
func (c Compute) DiskDelAsync(ctx context.Context, req DiskDelRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskDelRequest{
|
||||
DiskDelRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/diskDel"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -19,6 +19,12 @@ type DiskDetachRequest struct {
|
||||
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperDiskDetachRequest struct {
|
||||
DiskDetachRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// DiskDetach detach disk from compute
|
||||
func (c Compute) DiskDetach(ctx context.Context, req DiskDetachRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -26,9 +32,14 @@ func (c Compute) DiskDetach(ctx context.Context, req DiskDetachRequest) (bool, e
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskDetachRequest{
|
||||
DiskDetachRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/diskDetach"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -40,3 +51,25 @@ func (c Compute) DiskDetach(ctx context.Context, req DiskDetachRequest) (bool, e
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DiskDetachAsync detaches disk from compute with AsyncMode
|
||||
func (c Compute) DiskDetachAsync(ctx context.Context, req DiskDetachRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskDetachRequest{
|
||||
DiskDetachRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/diskDetach"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,12 @@ type DiskQOSRequest struct {
|
||||
Limits string `url:"limits" json:"limits" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperDiskQOSRequest struct {
|
||||
DiskQOSRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// DiskQOS change QoS of the disk
|
||||
func (c Compute) DiskQOS(ctx context.Context, req DiskQOSRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -30,9 +36,14 @@ func (c Compute) DiskQOS(ctx context.Context, req DiskQOSRequest) (bool, error)
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskQOSRequest{
|
||||
DiskQOSRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/diskQos"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -44,3 +55,25 @@ func (c Compute) DiskQOS(ctx context.Context, req DiskQOSRequest) (bool, error)
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DiskQOSAsync changes QoS of the disk with AsyncMode
|
||||
func (c Compute) DiskQOSAsync(ctx context.Context, req DiskQOSRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskQOSRequest{
|
||||
DiskQOSRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/diskQos"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,12 @@ type DiskResizeRequest struct {
|
||||
Size uint64 `url:"size" json:"size" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperDiskResizeRequest struct {
|
||||
DiskResizeRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// DiskResize change disk size
|
||||
func (c Compute) DiskResize(ctx context.Context, req DiskResizeRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -30,9 +36,14 @@ func (c Compute) DiskResize(ctx context.Context, req DiskResizeRequest) (bool, e
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskResizeRequest{
|
||||
DiskResizeRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/diskResize"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -44,3 +55,25 @@ func (c Compute) DiskResize(ctx context.Context, req DiskResizeRequest) (bool, e
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DiskResizeAsync changes disk size with AsyncMode
|
||||
func (c Compute) DiskResizeAsync(ctx context.Context, req DiskResizeRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskResizeRequest{
|
||||
DiskResizeRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/diskResize"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,12 @@ type DiskSwitchToReplicationRequest struct {
|
||||
StopReplication bool `url:"stopReplication" json:"stopReplication"`
|
||||
}
|
||||
|
||||
type wrapperDiskSwitchToReplicationRequest struct {
|
||||
DiskSwitchToReplicationRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// DiskSwitchToReplication switches disk to it's replication
|
||||
func (c Compute) DiskSwitchToReplication(ctx context.Context, req DiskSwitchToReplicationRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -30,9 +36,14 @@ func (c Compute) DiskSwitchToReplication(ctx context.Context, req DiskSwitchToRe
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskSwitchToReplicationRequest{
|
||||
DiskSwitchToReplicationRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/diskSwitchToReplication"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -44,3 +55,25 @@ func (c Compute) DiskSwitchToReplication(ctx context.Context, req DiskSwitchToRe
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DiskSwitchToReplicationAsync switches disk to it's replication with AsyncMode
|
||||
func (c Compute) DiskSwitchToReplicationAsync(ctx context.Context, req DiskSwitchToReplicationRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskSwitchToReplicationRequest{
|
||||
DiskSwitchToReplicationRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/diskSwitchToReplication"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
46
pkg/cloudapi/compute/get_cpu_alignment_profile.go
Normal file
46
pkg/cloudapi/compute/get_cpu_alignment_profile.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// GetCPUAlignmentProfileRequest struct to get CPU alignment profile for compute
|
||||
type GetCPUAlignmentProfileRequest struct {
|
||||
// ID of the compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
|
||||
}
|
||||
|
||||
// GetCPUAlignmentProfile gets CPU alignment profile for compute
|
||||
func (c Compute) GetCPUAlignmentProfile(ctx context.Context, req GetCPUAlignmentProfileRequest) (*CPUAlignmentProfile, error) {
|
||||
res, err := c.GetCPUAlignmentProfileRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := CPUAlignmentProfile{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetCPUAlignmentProfileRaw gets CPU alignment profile for compute as an array of bytes
|
||||
func (c Compute) GetCPUAlignmentProfileRaw(ctx context.Context, req GetCPUAlignmentProfileRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/get_cpu_alignment_profile"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodGet, url, req)
|
||||
return res, err
|
||||
}
|
||||
@@ -15,6 +15,12 @@ type GuestAgentDisableRequest struct {
|
||||
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperGuestAgentDisableRequest struct {
|
||||
GuestAgentDisableRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Disable guest agent at a specific compute
|
||||
func (c Compute) GuestAgentDisable(ctx context.Context, req GuestAgentDisableRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -22,9 +28,14 @@ func (c Compute) GuestAgentDisable(ctx context.Context, req GuestAgentDisableReq
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperGuestAgentDisableRequest{
|
||||
GuestAgentDisableRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/guest_agent_disable"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -36,3 +47,25 @@ func (c Compute) GuestAgentDisable(ctx context.Context, req GuestAgentDisableReq
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GuestAgentDisableAsync disables guest agent at a specific compute with AsyncMode
|
||||
func (c Compute) GuestAgentDisableAsync(ctx context.Context, req GuestAgentDisableRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperGuestAgentDisableRequest{
|
||||
GuestAgentDisableRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/guest_agent_disable"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -15,6 +15,12 @@ type GuestAgentEnableRequest struct {
|
||||
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperGuestAgentEnableRequest struct {
|
||||
GuestAgentEnableRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Enable guest agent at a specific compute
|
||||
func (c Compute) GuestAgentEnable(ctx context.Context, req GuestAgentEnableRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -22,9 +28,14 @@ func (c Compute) GuestAgentEnable(ctx context.Context, req GuestAgentEnableReque
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperGuestAgentEnableRequest{
|
||||
GuestAgentEnableRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/guest_agent_enable"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -36,3 +47,25 @@ func (c Compute) GuestAgentEnable(ctx context.Context, req GuestAgentEnableReque
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GuestAgentEnableAsync enables guest agent at a specific compute with AsyncMode
|
||||
func (c Compute) GuestAgentEnableAsync(ctx context.Context, req GuestAgentEnableRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperGuestAgentEnableRequest{
|
||||
GuestAgentEnableRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/guest_agent_enable"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,12 @@ type GuestAgentExecuteRequest struct {
|
||||
Arguments string `url:"arguments" json:"arguments" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperGuestAgentExecuteRequest struct {
|
||||
GuestAgentExecuteRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Execute guest agent command
|
||||
func (c Compute) GuestAgentExecuteRequest(ctx context.Context, req GuestAgentExecuteRequest) (map[string]interface{}, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -30,9 +36,14 @@ func (c Compute) GuestAgentExecuteRequest(ctx context.Context, req GuestAgentExe
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperGuestAgentExecuteRequest{
|
||||
GuestAgentExecuteRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/guest_agent_execute"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -46,3 +57,25 @@ func (c Compute) GuestAgentExecuteRequest(ctx context.Context, req GuestAgentExe
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GuestAgentExecuteRequestAsync executes guest agent command with AsyncMode
|
||||
func (c Compute) GuestAgentExecuteRequestAsync(ctx context.Context, req GuestAgentExecuteRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperGuestAgentExecuteRequest{
|
||||
GuestAgentExecuteRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/guest_agent_execute"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -15,6 +15,12 @@ type GuestAgentFeatureUpdateRequest struct {
|
||||
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperGuestAgentFeatureUpdateRequest struct {
|
||||
GuestAgentFeatureUpdateRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Feature update guest agent
|
||||
func (c Compute) GuestAgentFeatureUpdate(ctx context.Context, req GuestAgentFeatureUpdateRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -22,9 +28,14 @@ func (c Compute) GuestAgentFeatureUpdate(ctx context.Context, req GuestAgentFeat
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperGuestAgentFeatureUpdateRequest{
|
||||
GuestAgentFeatureUpdateRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/guest_agent_feature_update"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -36,3 +47,25 @@ func (c Compute) GuestAgentFeatureUpdate(ctx context.Context, req GuestAgentFeat
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GuestAgentFeatureUpdateAsync feature updates guest agent with AsyncMode
|
||||
func (c Compute) GuestAgentFeatureUpdateAsync(ctx context.Context, req GuestAgentFeatureUpdateRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperGuestAgentFeatureUpdateRequest{
|
||||
GuestAgentFeatureUpdateRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/guest_agent_feature_update"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -19,6 +19,12 @@ type MigrateToZoneRequest struct {
|
||||
ZoneID uint64 `url:"zoneId" json:"zoneId " validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperMigrateToZoneRequest struct {
|
||||
MigrateToZoneRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// MoveToRG moves compute instance to new resource group
|
||||
func (c Compute) MigrateToZone(ctx context.Context, req MigrateToZoneRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -26,9 +32,14 @@ func (c Compute) MigrateToZone(ctx context.Context, req MigrateToZoneRequest) (b
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperMigrateToZoneRequest{
|
||||
MigrateToZoneRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/migrateToZone"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -40,3 +51,25 @@ func (c Compute) MigrateToZone(ctx context.Context, req MigrateToZoneRequest) (b
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// MigrateToZoneAsync moves compute to another zone with AsyncMode
|
||||
func (c Compute) MigrateToZoneAsync(ctx context.Context, req MigrateToZoneRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperMigrateToZoneRequest{
|
||||
MigrateToZoneRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/migrateToZone"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -83,6 +83,9 @@ type ListUsageSnapshots []ItemUsageSnapshot
|
||||
|
||||
// Main information about snapshot
|
||||
type ItemSnapshot struct {
|
||||
// Compute info
|
||||
Compute RecordCompute `json:"compute"`
|
||||
|
||||
// List disk ID
|
||||
Disks []uint64 `json:"disks"`
|
||||
|
||||
@@ -92,6 +95,9 @@ type ItemSnapshot struct {
|
||||
// Label
|
||||
Label string `json:"label"`
|
||||
|
||||
// Memory dump image ID
|
||||
MemoryDumpImage uint64 `json:"memory_dump_image"`
|
||||
|
||||
// Timestamp
|
||||
Timestamp uint64 `json:"timestamp"`
|
||||
}
|
||||
@@ -356,6 +362,9 @@ type RecordCompute struct {
|
||||
// List clone IDs
|
||||
Clones []uint64 `json:"clones"`
|
||||
|
||||
// Clock
|
||||
Clock string `json:"clock"`
|
||||
|
||||
// Compute CI ID
|
||||
ComputeCIID uint64 `json:"computeciId"`
|
||||
|
||||
@@ -482,6 +491,9 @@ type RecordCompute struct {
|
||||
// PreferredCPU
|
||||
PreferredCPU []int64 `json:"preferredCpu"`
|
||||
|
||||
// CPU alignment profile
|
||||
CPUAlignmentProfile CPUAlignmentProfile `json:"cpu_alignment_profile"`
|
||||
|
||||
// Qemu_quest
|
||||
QemuQuest QemuQuest `json:"qemu_guest"`
|
||||
|
||||
@@ -552,6 +564,7 @@ type RecordCompute struct {
|
||||
// Required: false
|
||||
ZoneID uint64 `json:"zoneId"`
|
||||
}
|
||||
|
||||
type LoaderMetaIso struct {
|
||||
// Name
|
||||
DeviceName string `json:"devicename"`
|
||||
@@ -568,6 +581,12 @@ type QemuQuest struct {
|
||||
User string `json:"user"`
|
||||
}
|
||||
|
||||
type CPUAlignmentProfile struct {
|
||||
Model string `json:"model"`
|
||||
Name string `json:"name"`
|
||||
Vendor string `json:"vendor"`
|
||||
}
|
||||
|
||||
type VGPUItem struct {
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
@@ -792,8 +811,8 @@ type ItemComputeDisk struct {
|
||||
// Account ID
|
||||
AccountID uint64 `json:"accountId"`
|
||||
|
||||
// BLK Discard
|
||||
BLKDiscard bool `json:"blkdiscard"`
|
||||
// Discard
|
||||
Discard string `json:"discard"`
|
||||
|
||||
// Block Size
|
||||
BlockSize string `json:"block_size"`
|
||||
@@ -938,6 +957,9 @@ type ItemComputeDisk struct {
|
||||
|
||||
// UpdatedTime
|
||||
UpdatedTime uint64 `json:"updatedTime"`
|
||||
|
||||
// Read-only
|
||||
ReadOnly bool `json:"read_only"`
|
||||
}
|
||||
|
||||
type ItemReplication struct {
|
||||
@@ -1079,6 +1101,9 @@ type ItemCompute struct {
|
||||
// Clone reference
|
||||
CloneReference uint64 `json:"cloneReference"`
|
||||
|
||||
// Clock
|
||||
Clock string `json:"clock"`
|
||||
|
||||
// List clone IDs
|
||||
Clones []uint64 `json:"clones"`
|
||||
|
||||
@@ -1184,6 +1209,9 @@ type ItemCompute struct {
|
||||
// Name of OS
|
||||
OSVersion string `json:"os_version"`
|
||||
|
||||
// CPU alignment profile
|
||||
CPUAlignmentProfile CPUAlignmentProfile `json:"cpu_alignment_profile"`
|
||||
|
||||
// Qemu_quest
|
||||
QemuQuest QemuQuest `json:"qemu_guest"`
|
||||
|
||||
@@ -1261,6 +1289,9 @@ type InfoDisk struct {
|
||||
|
||||
// SEP ID
|
||||
SepID int64 `json:"sepId"`
|
||||
|
||||
// Read-only
|
||||
ReadOnly bool `json:"read_only"`
|
||||
}
|
||||
|
||||
// List information about computes
|
||||
|
||||
@@ -34,6 +34,12 @@ type MoveToRGRequest struct {
|
||||
ForceStop bool `url:"forceStop,omitempty" json:"forceStop,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperMoveToRGRequest struct {
|
||||
MoveToRGRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// MoveToRG moves compute instance to new resource group
|
||||
func (c Compute) MoveToRG(ctx context.Context, req MoveToRGRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -41,9 +47,14 @@ func (c Compute) MoveToRG(ctx context.Context, req MoveToRGRequest) (bool, error
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperMoveToRGRequest{
|
||||
MoveToRGRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/moveToRg"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -55,3 +66,25 @@ func (c Compute) MoveToRG(ctx context.Context, req MoveToRGRequest) (bool, error
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// MoveToRGAsync moves compute instance to new resource group with AsyncMode
|
||||
func (c Compute) MoveToRGAsync(ctx context.Context, req MoveToRGRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperMoveToRGRequest{
|
||||
MoveToRGRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/moveToRg"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -53,9 +53,9 @@ type NetAttachRequest struct {
|
||||
// Required: false
|
||||
SDNSegmentID string `url:"sdn_segment_id,omitempty" json:"sdn_segment_id,omitempty"`
|
||||
|
||||
// SDN Object Group ID
|
||||
// SDN Object Group IDs
|
||||
// Required: false
|
||||
SDNObjectGroupID string `url:"sdn_object_group_id,omitempty" json:"sdn_object_group_id,omitempty"`
|
||||
SDNObjectGroupIDs []string `url:"sdn_object_group_ids,omitempty" json:"sdn_object_group_ids,omitempty"`
|
||||
|
||||
// SDN Logical Port Display Name
|
||||
// Required: false
|
||||
@@ -74,6 +74,7 @@ type NetAttachRequest struct {
|
||||
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
|
||||
|
||||
// Flag indicating whether security groups are enabled for this interface
|
||||
// Not applicable to netType VFNIC, TRUNK, or SDN
|
||||
// Required: false
|
||||
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
|
||||
|
||||
@@ -82,6 +83,12 @@ type NetAttachRequest struct {
|
||||
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
||||
}
|
||||
|
||||
type wrapperNetAttachRequest struct {
|
||||
NetAttachRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// NetAttach attaches network to compute and gets info about network
|
||||
func (c Compute) NetAttach(ctx context.Context, req NetAttachRequest) (*RecordNetAttach, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -89,9 +96,14 @@ func (c Compute) NetAttach(ctx context.Context, req NetAttachRequest) (*RecordNe
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperNetAttachRequest{
|
||||
NetAttachRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/netAttach"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -105,3 +117,25 @@ func (c Compute) NetAttach(ctx context.Context, req NetAttachRequest) (*RecordNe
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// NetAttachAsync attaches network to compute with AsyncMode
|
||||
func (c Compute) NetAttachAsync(ctx context.Context, req NetAttachRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperNetAttachRequest{
|
||||
NetAttachRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/netAttach"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,12 @@ type NetDetachRequest struct {
|
||||
MAC string `url:"mac,omitempty" json:"mac,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperNetDetachRequest struct {
|
||||
NetDetachRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// NetDetach detaches network from compute
|
||||
func (c Compute) NetDetach(ctx context.Context, req NetDetachRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -30,9 +36,14 @@ func (c Compute) NetDetach(ctx context.Context, req NetDetachRequest) (bool, err
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperNetDetachRequest{
|
||||
NetDetachRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/netDetach"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -44,3 +55,25 @@ func (c Compute) NetDetach(ctx context.Context, req NetDetachRequest) (bool, err
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NetDetachAsync detaches network from compute with AsyncMode
|
||||
func (c Compute) NetDetachAsync(ctx context.Context, req NetDetachRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperNetDetachRequest{
|
||||
NetDetachRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/netDetach"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -15,6 +15,12 @@ type PauseRequest struct {
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperPauseRequest struct {
|
||||
PauseRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Pause pause compute
|
||||
func (c Compute) Pause(ctx context.Context, req PauseRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -22,9 +28,14 @@ func (c Compute) Pause(ctx context.Context, req PauseRequest) (bool, error) {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperPauseRequest{
|
||||
PauseRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/pause"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -36,3 +47,25 @@ func (c Compute) Pause(ctx context.Context, req PauseRequest) (bool, error) {
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// PauseAsync pauses compute with AsyncMode
|
||||
func (c Compute) PauseAsync(ctx context.Context, req PauseRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperPauseRequest{
|
||||
PauseRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/pause"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -33,6 +33,12 @@ type PFWAddRequest struct {
|
||||
Proto string `url:"proto" json:"proto" validate:"proto"`
|
||||
}
|
||||
|
||||
type wrapperPFWAddRequest struct {
|
||||
PFWAddRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// PFWAdd add port forward rule
|
||||
func (c Compute) PFWAdd(ctx context.Context, req PFWAddRequest) (uint64, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -40,9 +46,14 @@ func (c Compute) PFWAdd(ctx context.Context, req PFWAddRequest) (uint64, error)
|
||||
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperPFWAddRequest{
|
||||
PFWAddRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/pfwAdd"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -54,3 +65,25 @@ func (c Compute) PFWAdd(ctx context.Context, req PFWAddRequest) (uint64, error)
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// PFWAddAsync adds port forward rule with AsyncMode
|
||||
func (c Compute) PFWAddAsync(ctx context.Context, req PFWAddRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperPFWAddRequest{
|
||||
PFWAddRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/pfwAdd"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -36,6 +36,12 @@ type PFWDelRequest struct {
|
||||
Proto string `url:"proto,omitempty" json:"proto,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperPFWDelRequest struct {
|
||||
PFWDelRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// PFWDel deletes port forward rule
|
||||
func (c Compute) PFWDel(ctx context.Context, req PFWDelRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -43,9 +49,14 @@ func (c Compute) PFWDel(ctx context.Context, req PFWDelRequest) (bool, error) {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperPFWDelRequest{
|
||||
PFWDelRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/pfwDel"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -57,3 +68,25 @@ func (c Compute) PFWDel(ctx context.Context, req PFWDelRequest) (bool, error) {
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// PFWDelAsync deletes port forward rule with AsyncMode
|
||||
func (c Compute) PFWDelAsync(ctx context.Context, req PFWDelRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperPFWDelRequest{
|
||||
PFWDelRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/pfwDel"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -20,6 +20,12 @@ type PinToNodeRequest struct {
|
||||
AutoStart bool `url:"autoStart" json:"autoStart"`
|
||||
}
|
||||
|
||||
type wrapperPinToNodeRequest struct {
|
||||
PinToNodeRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// PinToNode pin compute to current node
|
||||
func (c Compute) PinToNode(ctx context.Context, req PinToNodeRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -27,9 +33,14 @@ func (c Compute) PinToNode(ctx context.Context, req PinToNodeRequest) (bool, err
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperPinToNodeRequest{
|
||||
PinToNodeRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/pin_to_node"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -41,3 +52,25 @@ func (c Compute) PinToNode(ctx context.Context, req PinToNodeRequest) (bool, err
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// PinToNodeAsync pins compute to current node with AsyncMode
|
||||
func (c Compute) PinToNodeAsync(ctx context.Context, req PinToNodeRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperPinToNodeRequest{
|
||||
PinToNodeRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/pin_to_node"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -15,6 +15,12 @@ type PowerCycleRequest struct {
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperPowerCycleRequest struct {
|
||||
PowerCycleRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// PowerCycle makes force stop and start compute
|
||||
func (c Compute) PowerCycle(ctx context.Context, req PowerCycleRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -22,9 +28,14 @@ func (c Compute) PowerCycle(ctx context.Context, req PowerCycleRequest) (bool, e
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperPowerCycleRequest{
|
||||
PowerCycleRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/powerCycle"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -36,3 +47,25 @@ func (c Compute) PowerCycle(ctx context.Context, req PowerCycleRequest) (bool, e
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// PowerCycleAsync makes force stop and start compute with AsyncMode
|
||||
func (c Compute) PowerCycleAsync(ctx context.Context, req PowerCycleRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperPowerCycleRequest{
|
||||
PowerCycleRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/powerCycle"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -15,6 +15,12 @@ type RebootRequest struct {
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperRebootRequest struct {
|
||||
RebootRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Reboot reboots compute
|
||||
func (c Compute) Reboot(ctx context.Context, req RebootRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -22,9 +28,14 @@ func (c Compute) Reboot(ctx context.Context, req RebootRequest) (bool, error) {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperRebootRequest{
|
||||
RebootRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/reboot"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -36,3 +47,25 @@ func (c Compute) Reboot(ctx context.Context, req RebootRequest) (bool, error) {
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// RebootAsync reboots compute with AsyncMode
|
||||
func (c Compute) RebootAsync(ctx context.Context, req RebootRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperRebootRequest{
|
||||
RebootRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/reboot"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ type RedeployRequest struct {
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
|
||||
// Storage policy id of compute. The rules of the specified storage policy will be used.
|
||||
// Required: true
|
||||
// Required: false
|
||||
StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"`
|
||||
|
||||
// ID of the new OS image, if image change is required
|
||||
@@ -44,6 +44,12 @@ type RedeployRequest struct {
|
||||
ForceStop bool `url:"forceStop,omitempty" json:"forceStop,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperRedeployRequest struct {
|
||||
RedeployRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Redeploy redeploys compute
|
||||
func (c Compute) Redeploy(ctx context.Context, req RedeployRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -51,9 +57,14 @@ func (c Compute) Redeploy(ctx context.Context, req RedeployRequest) (bool, error
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperRedeployRequest{
|
||||
RedeployRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/redeploy"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -65,3 +76,25 @@ func (c Compute) Redeploy(ctx context.Context, req RedeployRequest) (bool, error
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// RedeployAsync redeploys compute with AsyncMode
|
||||
func (c Compute) RedeployAsync(ctx context.Context, req RedeployRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperRedeployRequest{
|
||||
RedeployRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/redeploy"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -15,6 +15,12 @@ type ResetRequest struct {
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperResetRequest struct {
|
||||
ResetRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Reset resets compute
|
||||
func (c Compute) Reset(ctx context.Context, req ResetRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -22,9 +28,14 @@ func (c Compute) Reset(ctx context.Context, req ResetRequest) (bool, error) {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperResetRequest{
|
||||
ResetRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/reset"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -36,3 +47,25 @@ func (c Compute) Reset(ctx context.Context, req ResetRequest) (bool, error) {
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ResetAsync resets compute with AsyncMode
|
||||
func (c Compute) ResetAsync(ctx context.Context, req ResetRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperResetRequest{
|
||||
ResetRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/reset"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -43,6 +43,12 @@ func (r ResizeRequest) GetRAM() map[string]uint64 {
|
||||
return res
|
||||
}
|
||||
|
||||
type wrapperResizeRequest struct {
|
||||
ResizeRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Resize resizes compute instance
|
||||
func (c Compute) Resize(ctx context.Context, req ResizeRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -50,9 +56,14 @@ func (c Compute) Resize(ctx context.Context, req ResizeRequest) (bool, error) {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperResizeRequest{
|
||||
ResizeRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/resize"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -64,3 +75,25 @@ func (c Compute) Resize(ctx context.Context, req ResizeRequest) (bool, error) {
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ResizeAsync resizes compute instance with AsyncMode
|
||||
func (c Compute) ResizeAsync(ctx context.Context, req ResizeRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperResizeRequest{
|
||||
ResizeRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/resize"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package compute
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
@@ -14,16 +15,54 @@ type RestoreRequest struct {
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperRestoreRequest struct {
|
||||
RestoreRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Restore restores compute from recycle bin
|
||||
func (c Compute) Restore(ctx context.Context, req RestoreRequest) (string, error) {
|
||||
func (c Compute) Restore(ctx context.Context, req RestoreRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperRestoreRequest{
|
||||
RestoreRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/restore"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// RestoreAsync restores compute from recycle bin with AsyncMode
|
||||
func (c Compute) RestoreAsync(ctx context.Context, req RestoreRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperRestoreRequest{
|
||||
RestoreRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/restore"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -15,6 +15,12 @@ type ResumeRequest struct {
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperResumeRequest struct {
|
||||
ResumeRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Resume resume Compute from paused state
|
||||
func (c Compute) Resume(ctx context.Context, req ResumeRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -22,9 +28,14 @@ func (c Compute) Resume(ctx context.Context, req ResumeRequest) (bool, error) {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperResumeRequest{
|
||||
ResumeRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/resume"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -36,3 +47,25 @@ func (c Compute) Resume(ctx context.Context, req ResumeRequest) (bool, error) {
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ResumeAsync resumes Compute from paused state with AsyncMode
|
||||
func (c Compute) ResumeAsync(ctx context.Context, req ResumeRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperResumeRequest{
|
||||
ResumeRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/resume"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
43
pkg/cloudapi/compute/set_cpu_alignment_profile.go
Normal file
43
pkg/cloudapi/compute/set_cpu_alignment_profile.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// SetCPUAlignmentProfileRequest struct to set CPU alignment profile for computes
|
||||
type SetCPUAlignmentProfileRequest struct {
|
||||
// IDs of the compute instances
|
||||
// Required: true
|
||||
ComputeIDs []int64 `url:"compute_ids" json:"compute_ids" validate:"min=1"`
|
||||
|
||||
// CPU alignment profile name
|
||||
// Required: true
|
||||
CPUAlignmentProfile string `url:"cpu_alignment_profile" json:"cpu_alignment_profile" validate:"required"`
|
||||
}
|
||||
|
||||
// SetCPUAlignmentProfile sets CPU alignment profile for computes
|
||||
func (c Compute) SetCPUAlignmentProfile(ctx context.Context, req SetCPUAlignmentProfileRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/set_cpu_alignment_profile"
|
||||
|
||||
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@@ -16,20 +16,37 @@ type SnapshotCreateRequest struct {
|
||||
|
||||
// Text label for snapshot.
|
||||
// Must be unique among this compute snapshots
|
||||
// Allowed characters: a-z, 0-9, spaces, punctuation except '<' and '>'
|
||||
// Maximum length: 36 characters
|
||||
// Required: true
|
||||
Label string `url:"label" json:"label" validate:"required"`
|
||||
Label string `url:"label" json:"label" validate:"required,max=36,excludesall=<>"`
|
||||
|
||||
// Create snapshot with memory dump
|
||||
// Required: false
|
||||
// Default: false
|
||||
WithMemory bool `url:"with_memory" json:"with_memory"`
|
||||
}
|
||||
|
||||
// SnapshotCreate create compute snapshot
|
||||
type wrapperSnapshotCreateRequest struct {
|
||||
SnapshotCreateRequest
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// SnapshotCreate creates compute snapshot
|
||||
func (c Compute) SnapshotCreate(ctx context.Context, req SnapshotCreateRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperSnapshotCreateRequest{
|
||||
SnapshotCreateRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/snapshotCreate"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -38,3 +55,25 @@ func (c Compute) SnapshotCreate(ctx context.Context, req SnapshotCreateRequest)
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// SnapshotCreateAsync creates compute snapshot in async mode
|
||||
func (c Compute) SnapshotCreateAsync(ctx context.Context, req SnapshotCreateRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperSnapshotCreateRequest{
|
||||
SnapshotCreateRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/snapshotCreate"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -17,6 +17,16 @@ type SnapshotRollbackRequest struct {
|
||||
// Text label of snapshot to rollback
|
||||
// Required: true
|
||||
Label string `url:"label" json:"label" validate:"required"`
|
||||
|
||||
// Rollback with memory dump restore
|
||||
// Required: false
|
||||
// Default: true
|
||||
WithMemory interface{} `url:"with_memory,omitempty" json:"with_memory,omitempty" validate:"omitempty,isBool"`
|
||||
}
|
||||
|
||||
type wrapperSnapshotRollbackRequest struct {
|
||||
SnapshotRollbackRequest
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// SnapshotRollback rollbacks specified compute snapshot
|
||||
@@ -26,9 +36,14 @@ func (c Compute) SnapshotRollback(ctx context.Context, req SnapshotRollbackReque
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperSnapshotRollbackRequest{
|
||||
SnapshotRollbackRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/snapshotRollback"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -40,3 +55,25 @@ func (c Compute) SnapshotRollback(ctx context.Context, req SnapshotRollbackReque
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// SnapshotRollbackAsync rollbacks specified compute snapshot in async mode
|
||||
func (c Compute) SnapshotRollbackAsync(ctx context.Context, req SnapshotRollbackRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperSnapshotRollbackRequest{
|
||||
SnapshotRollbackRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/snapshotRollback"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -19,6 +19,12 @@ type StartRequest struct {
|
||||
AltBootID uint64 `url:"altBootId,omitempty" json:"altBootId,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperStartRequest struct {
|
||||
StartRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Start starts compute
|
||||
func (c Compute) Start(ctx context.Context, req StartRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -26,9 +32,14 @@ func (c Compute) Start(ctx context.Context, req StartRequest) (bool, error) {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperStartRequest{
|
||||
StartRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/start"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -40,3 +51,25 @@ func (c Compute) Start(ctx context.Context, req StartRequest) (bool, error) {
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// StartAsync starts compute with AsyncMode
|
||||
func (c Compute) StartAsync(ctx context.Context, req StartRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperStartRequest{
|
||||
StartRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/start"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -19,6 +19,12 @@ type StopRequest struct {
|
||||
Force bool `url:"force,omitempty" json:"force,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperStopRequest struct {
|
||||
StopRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Stop stops compute
|
||||
func (c Compute) Stop(ctx context.Context, req StopRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -26,9 +32,14 @@ func (c Compute) Stop(ctx context.Context, req StopRequest) (bool, error) {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperStopRequest{
|
||||
StopRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/stop"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -40,3 +51,25 @@ func (c Compute) Stop(ctx context.Context, req StopRequest) (bool, error) {
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// StopAsync stops compute with AsyncMode
|
||||
func (c Compute) StopAsync(ctx context.Context, req StopRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperStopRequest{
|
||||
StopRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/stop"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -69,6 +69,11 @@ type UpdateRequest struct {
|
||||
// The OS version that will be installed on the virtual machine
|
||||
// Required: false
|
||||
OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"`
|
||||
|
||||
// Clock type for the VM
|
||||
// Required: false
|
||||
// Default: null
|
||||
Clock string `url:"clock,omitempty" json:"clock,omitempty"`
|
||||
}
|
||||
|
||||
// Update updates some properties of the compute
|
||||
|
||||
@@ -11,8 +11,8 @@ type ItemDisk struct {
|
||||
// Account name
|
||||
AccountName string `json:"accountName"`
|
||||
|
||||
// BLK Discard
|
||||
BLKDiscard bool `json:"blkdiscard"`
|
||||
// Discard
|
||||
Discard string `json:"discard"`
|
||||
|
||||
// Block size of disk
|
||||
BlockSize string `json:"block_size"`
|
||||
@@ -20,6 +20,9 @@ type ItemDisk struct {
|
||||
// Computes
|
||||
Computes map[string]string `json:"computes"`
|
||||
|
||||
// Computes read only
|
||||
ComputesReadOnly map[string]bool `json:"computes_read_only"`
|
||||
|
||||
//Created by
|
||||
CreatedBy string `json:"createdBy"`
|
||||
|
||||
@@ -166,8 +169,8 @@ type ItemDiskUnattached struct {
|
||||
// Access Control List
|
||||
ACL map[string]interface{} `json:"acl"`
|
||||
|
||||
// BLK Discard
|
||||
BLKDiscard bool `json:"blkdiscard"`
|
||||
// Discard
|
||||
Discard string `json:"discard"`
|
||||
|
||||
// Block size of disk
|
||||
BlockSize string `json:"block_size"`
|
||||
@@ -399,8 +402,8 @@ type RecordDisk struct {
|
||||
// Account name
|
||||
AccountName string `json:"accountName"`
|
||||
|
||||
// BLK Discard
|
||||
BLKDiscard bool `json:"blkdiscard"`
|
||||
// Discard
|
||||
Discard string `json:"discard"`
|
||||
|
||||
// Block size of disk
|
||||
BlockSize string `json:"block_size"`
|
||||
@@ -408,6 +411,9 @@ type RecordDisk struct {
|
||||
// Computes
|
||||
Computes map[string]string `json:"computes"`
|
||||
|
||||
// Computes read only
|
||||
ComputesReadOnly map[string]bool `json:"computes_read_only"`
|
||||
|
||||
// Created by
|
||||
CreatedBy string `json:"createdBy"`
|
||||
|
||||
|
||||
@@ -13,6 +13,9 @@ type ItemExtNet struct {
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Free IPs
|
||||
FreeIPs uint64 `json:"freeIps"`
|
||||
}
|
||||
|
||||
// Extend information about external network
|
||||
|
||||
@@ -19,9 +19,8 @@ type CreateVirtualRequest struct {
|
||||
TargetID uint64 `url:"targetId" json:"targetId" validate:"required"`
|
||||
|
||||
// AccountID to make the virtual image exclusive
|
||||
// Required: false
|
||||
// Default: 0
|
||||
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
|
||||
}
|
||||
|
||||
// CreateVirtual creates virtual image
|
||||
|
||||
@@ -28,7 +28,7 @@ type ListRequest struct {
|
||||
|
||||
// Find by type
|
||||
// Required: false
|
||||
TypeImage string `url:"typeImage,omitempty" json:"typeImage,omitempty"`
|
||||
TypeImage []string `url:"typeImage,omitempty" json:"typeImage,omitempty"`
|
||||
|
||||
// Find by image size
|
||||
// Required: false
|
||||
|
||||
@@ -149,6 +149,9 @@ type RecordImage struct {
|
||||
// Link to
|
||||
LinkTo uint64 `json:"linkTo"`
|
||||
|
||||
// Links to
|
||||
LinksTo []uint64 `json:"linksTo"`
|
||||
|
||||
// Milestones
|
||||
Milestones uint64 `json:"milestones"`
|
||||
|
||||
|
||||
@@ -48,9 +48,9 @@ type Interface struct {
|
||||
// Required: false
|
||||
SDNSegmentID string `url:"sdn_segment_id,omitempty" json:"sdn_segment_id,omitempty"`
|
||||
|
||||
// SDN Object Group ID
|
||||
// SDN Object Group IDs
|
||||
// Required: false
|
||||
SDNObjectGroupID string `url:"sdn_object_group_id,omitempty" json:"sdn_object_group_id,omitempty"`
|
||||
SDNObjectGroupIDs []string `url:"sdn_object_group_ids,omitempty" json:"sdn_object_group_ids,omitempty"`
|
||||
|
||||
// SDN Logical Port Display Name
|
||||
// Required: false
|
||||
@@ -69,6 +69,7 @@ type Interface struct {
|
||||
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
|
||||
|
||||
// Flag indicating whether security groups are enabled for this interface
|
||||
// Not applicable to netType VFNIC, TRUNK, or SDN
|
||||
// Required: false
|
||||
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
|
||||
|
||||
@@ -217,6 +218,15 @@ type CreateRequest struct {
|
||||
// Zone ID
|
||||
// Required: false
|
||||
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
|
||||
|
||||
// CPU alignment profile name
|
||||
// Required: false
|
||||
CPUAlignmentProfile string `url:"cpu_alignment_profile,omitempty" json:"cpu_alignment_profile,omitempty"`
|
||||
|
||||
// Clock type for the VM
|
||||
// Required: false
|
||||
// Default: default
|
||||
Clock string `url:"clock,omitempty" json:"clock,omitempty"`
|
||||
}
|
||||
|
||||
// GetRAM returns RAM field values
|
||||
@@ -244,7 +254,7 @@ func (k KVMX86) Create(ctx context.Context, req CreateRequest) (uint64, error) {
|
||||
|
||||
var interfaces []string
|
||||
|
||||
if req.Interfaces != nil && len(req.Interfaces) != 0 {
|
||||
if len(req.Interfaces) != 0 {
|
||||
interfaces = make([]string, 0, len(req.Interfaces))
|
||||
|
||||
for i := range req.Interfaces {
|
||||
@@ -261,7 +271,7 @@ func (k KVMX86) Create(ctx context.Context, req CreateRequest) (uint64, error) {
|
||||
|
||||
var dataDisks []string
|
||||
|
||||
if req.DataDisks != nil && len(req.DataDisks) != 0 {
|
||||
if len(req.DataDisks) != 0 {
|
||||
dataDisks = make([]string, 0, len(req.DataDisks))
|
||||
|
||||
for i := range req.DataDisks {
|
||||
|
||||
@@ -115,6 +115,15 @@ type CreateBlankRequest struct {
|
||||
// The OS version that will be installed on the virtual machine
|
||||
// Required: false
|
||||
OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"`
|
||||
|
||||
// CPU alignment profile name
|
||||
// Required: false
|
||||
CPUAlignmentProfile string `url:"cpu_alignment_profile,omitempty" json:"cpu_alignment_profile,omitempty"`
|
||||
|
||||
// Clock type for the VM
|
||||
// Required: false
|
||||
// Default: default
|
||||
Clock string `url:"clock,omitempty" json:"clock,omitempty"`
|
||||
}
|
||||
|
||||
// GetRAM returns RAM field values
|
||||
@@ -142,7 +151,7 @@ func (k KVMX86) CreateBlank(ctx context.Context, req CreateBlankRequest) (uint64
|
||||
|
||||
var interfaces []string
|
||||
|
||||
if req.Interfaces != nil && len(req.Interfaces) != 0 {
|
||||
if len(req.Interfaces) != 0 {
|
||||
interfaces = make([]string, 0, len(req.Interfaces))
|
||||
|
||||
for i := range req.Interfaces {
|
||||
@@ -159,7 +168,7 @@ func (k KVMX86) CreateBlank(ctx context.Context, req CreateBlankRequest) (uint64
|
||||
|
||||
var dataDisks []string
|
||||
|
||||
if req.DataDisks != nil && len(req.DataDisks) != 0 {
|
||||
if len(req.DataDisks) != 0 {
|
||||
dataDisks = make([]string, 0, len(req.DataDisks))
|
||||
|
||||
for i := range req.DataDisks {
|
||||
|
||||
@@ -16,22 +16,22 @@ type HighlyAvailableRequest struct {
|
||||
}
|
||||
|
||||
// HighlyAvailable makes load balancer highly available
|
||||
func (l LB) HighlyAvailable(ctx context.Context, req HighlyAvailableRequest) (uint64, error) {
|
||||
func (l LB) HighlyAvailable(ctx context.Context, req HighlyAvailableRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudapi/lb/makeHighlyAvailable"
|
||||
|
||||
res, err := l.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseUint(string(res), 10, 64)
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
|
||||
@@ -34,6 +34,12 @@ type ItemLocation struct {
|
||||
|
||||
// Support of SDN
|
||||
SDNSupport bool `json:"sdn_support"`
|
||||
|
||||
// Is Zero Access enabled
|
||||
ZeroAccessEnabled bool `json:"zeroaccess_enabled"`
|
||||
|
||||
// Is BRO enabled
|
||||
BROEnabled bool `json:"bro_enabled"`
|
||||
}
|
||||
|
||||
// List of locations
|
||||
|
||||
@@ -81,7 +81,7 @@ type RecordResourceGroup struct {
|
||||
CPUAllocationParameter string `json:"cpu_allocation_parameter"`
|
||||
|
||||
// CPU allocation ratio
|
||||
CPUAllocationRatio float64 `json:"cpu_allocation_ratio"`
|
||||
CPUAllocationRatio uint64 `json:"cpu_allocation_ratio"`
|
||||
|
||||
// Created by
|
||||
CreatedBy string `json:"createdBy"`
|
||||
@@ -180,7 +180,7 @@ type ItemResourceGroup struct {
|
||||
CPUAllocationParameter string `json:"cpu_allocation_parameter"`
|
||||
|
||||
// CPU allocation ratio
|
||||
CPUAllocationRatio float64 `json:"cpu_allocation_ratio"`
|
||||
CPUAllocationRatio uint64 `json:"cpu_allocation_ratio"`
|
||||
|
||||
// Created by
|
||||
CreatedBy string `json:"createdBy"`
|
||||
|
||||
8
pkg/cloudapi/vgpu.go
Normal file
8
pkg/cloudapi/vgpu.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package cloudapi
|
||||
|
||||
import "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/vgpu"
|
||||
|
||||
// Accessing the VGPU method group
|
||||
func (ca *CloudAPI) VGPU() *vgpu.VGPU {
|
||||
return vgpu.New(ca.client)
|
||||
}
|
||||
10
pkg/cloudapi/vgpu/ids.go
Normal file
10
pkg/cloudapi/vgpu/ids.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package vgpu
|
||||
|
||||
// IDs gets array of VGPU IDs from ListVGPU struct
|
||||
func (l ListVGPU) IDs() []uint64 {
|
||||
res := make([]uint64, 0, len(l.Data))
|
||||
for _, v := range l.Data {
|
||||
res = append(res, v.ID)
|
||||
}
|
||||
return res
|
||||
}
|
||||
88
pkg/cloudapi/vgpu/list.go
Normal file
88
pkg/cloudapi/vgpu/list.go
Normal file
@@ -0,0 +1,88 @@
|
||||
package vgpu
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// ListRequest struct to get list of VGPU
|
||||
type ListRequest struct {
|
||||
// Find by id
|
||||
// Required: false
|
||||
ByID uint64 `url:"by_id,omitempty" json:"by_id,omitempty"`
|
||||
|
||||
// Find by vgpu status
|
||||
// Required: false
|
||||
Status string `url:"status,omitempty" json:"status,omitempty"`
|
||||
|
||||
// Find by vgpu type
|
||||
// Required: false
|
||||
Type string `url:"type,omitempty" json:"type,omitempty"`
|
||||
|
||||
// Find by vgpu mode
|
||||
// Required: false
|
||||
Mode string `url:"mode,omitempty" json:"mode,omitempty"`
|
||||
|
||||
// Find by id resgroup
|
||||
// Required: false
|
||||
RGID uint64 `url:"rgId,omitempty" json:"rgId,omitempty"`
|
||||
|
||||
// Find by account id
|
||||
// Required: false
|
||||
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
|
||||
|
||||
// Find by compute id
|
||||
// Required: false
|
||||
ComputeID uint64 `url:"computeId,omitempty" json:"computeId,omitempty"`
|
||||
|
||||
// Find by pgpu id
|
||||
// Required: false
|
||||
PGPUID uint64 `url:"pgpuId,omitempty" json:"pgpuId,omitempty"`
|
||||
|
||||
// Sort by one of supported fields, format +|-(field)
|
||||
// Required: false
|
||||
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
|
||||
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
// Page size
|
||||
// Required: false
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list of all VGPU as a ListVGPU struct
|
||||
func (v VGPU) List(ctx context.Context, req ListRequest) (*ListVGPU, error) {
|
||||
|
||||
res, err := v.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := ListVGPU{}
|
||||
|
||||
err = json.Unmarshal(res, &list)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of all VGPU as an array of bytes
|
||||
func (v VGPU) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudapi/vgpu/list"
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
69
pkg/cloudapi/vgpu/models.go
Normal file
69
pkg/cloudapi/vgpu/models.go
Normal file
@@ -0,0 +1,69 @@
|
||||
package vgpu
|
||||
|
||||
type ItemVGPU struct {
|
||||
// Account ID
|
||||
AccountID uint64 `json:"accountId"`
|
||||
|
||||
// Created time
|
||||
CreatedTime uint64 `json:"createdTime"`
|
||||
|
||||
// Deleted time
|
||||
DeletedTime uint64 `json:"deletedTime"`
|
||||
|
||||
//Grid ID
|
||||
GID uint64 `json:"gid"`
|
||||
|
||||
// GUID
|
||||
GUID uint64 `json:"guid"`
|
||||
|
||||
// VGPU ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Last claimed by
|
||||
LastClaimedBy uint64 `json:"lastClaimedBy"`
|
||||
|
||||
// Last update time
|
||||
LastUpdateTime uint64 `json:"lastUpdateTime"`
|
||||
|
||||
// Mode
|
||||
Mode string `json:"mode"`
|
||||
|
||||
// Bus number
|
||||
BusNumber int `json:"bus_number"`
|
||||
|
||||
// PCI Slot
|
||||
PCISlot int `json:"pciSlot"`
|
||||
|
||||
// PGPUID
|
||||
PGPUID uint64 `json:"pgpuid"`
|
||||
|
||||
// Profile ID
|
||||
ProfileID uint64 `json:"profileId"`
|
||||
|
||||
// RAM
|
||||
RAM uint64 `json:"ram"`
|
||||
|
||||
// Reference ID
|
||||
ReferenceID string `json:"referenceId"`
|
||||
|
||||
// RGID
|
||||
RGID uint64 `json:"rgId"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Type
|
||||
Type string `json:"type"`
|
||||
|
||||
// VMID
|
||||
VMID uint64 `json:"vmid"`
|
||||
}
|
||||
|
||||
// List of VGPU
|
||||
type ListVGPU struct {
|
||||
// Data
|
||||
Data []ItemVGPU `json:"data"`
|
||||
|
||||
// Entry count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
43
pkg/cloudapi/vgpu/serialize.go
Normal file
43
pkg/cloudapi/vgpu/serialize.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package vgpu
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/serialization"
|
||||
)
|
||||
|
||||
// Serialize returns JSON-serialized []byte. Used as a wrapper over json.Marshal and json.MarshalIndent functions.
|
||||
//
|
||||
// In order to serialize with indent make sure to follow these guidelines:
|
||||
// - First argument -> prefix
|
||||
// - Second argument -> indent
|
||||
func (l ListVGPU) Serialize(params ...string) (serialization.Serialized, error) {
|
||||
if len(l.Data) == 0 {
|
||||
return []byte{}, nil
|
||||
}
|
||||
|
||||
if len(params) > 1 {
|
||||
prefix := params[0]
|
||||
indent := params[1]
|
||||
|
||||
return json.MarshalIndent(l, prefix, indent)
|
||||
}
|
||||
|
||||
return json.Marshal(l)
|
||||
}
|
||||
|
||||
// Serialize returns JSON-serialized []byte. Used as a wrapper over json.Marshal and json.MarshalIndent functions.
|
||||
//
|
||||
// In order to serialize with indent make sure to follow these guidelines:
|
||||
// - First argument -> prefix
|
||||
// - Second argument -> indent
|
||||
func (i ItemVGPU) Serialize(params ...string) (serialization.Serialized, error) {
|
||||
if len(params) > 1 {
|
||||
prefix := params[0]
|
||||
indent := params[1]
|
||||
|
||||
return json.MarshalIndent(i, prefix, indent)
|
||||
}
|
||||
|
||||
return json.Marshal(i)
|
||||
}
|
||||
15
pkg/cloudapi/vgpu/vgpu.go
Normal file
15
pkg/cloudapi/vgpu/vgpu.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package vgpu
|
||||
|
||||
import "repository.basistech.ru/BASIS/decort-golang-sdk/interfaces"
|
||||
|
||||
// Structure for creating request to VGPU
|
||||
type VGPU struct {
|
||||
client interfaces.Caller
|
||||
}
|
||||
|
||||
// Builder for VGPU endpoints
|
||||
func New(client interfaces.Caller) *VGPU {
|
||||
return &VGPU{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,11 @@ type CreateInAccountRequest struct {
|
||||
// Zone ID
|
||||
// Required: false
|
||||
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
|
||||
|
||||
// Enable security groups for VINS
|
||||
// Required: false
|
||||
// Default: false
|
||||
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||
}
|
||||
|
||||
type wrapperCreateRequestInAcc struct {
|
||||
|
||||
@@ -51,6 +51,11 @@ type CreateInRGRequest struct {
|
||||
// Zone ID
|
||||
// Required: false
|
||||
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
|
||||
|
||||
// Enable security groups for VINS
|
||||
// Required: false
|
||||
// Default: false
|
||||
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||
}
|
||||
|
||||
type wrapperCreateRequestInRG struct {
|
||||
|
||||
@@ -2,7 +2,7 @@ package zone
|
||||
|
||||
// FilterByID returns ListZones with specified ID.
|
||||
func (list ListZones) FilterByID(id uint64) ListZones {
|
||||
predicate := func(izone RecordZone) bool {
|
||||
predicate := func(izone ItemZone) bool {
|
||||
return izone.ID == id
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ func (list ListZones) FilterByID(id uint64) ListZones {
|
||||
|
||||
// FilterByName returns ListZones with specified Name.
|
||||
func (list ListZones) FilterByName(name string) ListZones {
|
||||
predicate := func(izone RecordZone) bool {
|
||||
predicate := func(izone ItemZone) bool {
|
||||
return izone.Name == name
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ func (list ListZones) FilterByName(name string) ListZones {
|
||||
|
||||
// FilterByStatus returns ListZones with specified Status.
|
||||
func (list ListZones) FilterByStatus(status string) ListZones {
|
||||
predicate := func(izone RecordZone) bool {
|
||||
predicate := func(izone ItemZone) bool {
|
||||
return izone.Status == status
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ func (list ListZones) FilterByStatus(status string) ListZones {
|
||||
}
|
||||
|
||||
// FilterFunc allows filtering ListZones based on a user-specified predicate.
|
||||
func (list ListZones) FilterFunc(predicate func(RecordZone) bool) ListZones {
|
||||
func (list ListZones) FilterFunc(predicate func(ItemZone) bool) ListZones {
|
||||
var result ListZones
|
||||
|
||||
for _, item := range list.Data {
|
||||
@@ -42,11 +42,11 @@ func (list ListZones) FilterFunc(predicate func(RecordZone) bool) ListZones {
|
||||
return result
|
||||
}
|
||||
|
||||
// FindOne returns first found RecordZone
|
||||
// FindOne returns first found ItemZone
|
||||
// If none was found, returns an empty struct.
|
||||
func (list ListZones) FindOne() RecordZone {
|
||||
func (list ListZones) FindOne() ItemZone {
|
||||
if list.EntryCount == 0 {
|
||||
return RecordZone{}
|
||||
return ItemZone{}
|
||||
}
|
||||
|
||||
return list.Data[0]
|
||||
|
||||
@@ -3,7 +3,7 @@ package zone
|
||||
import "testing"
|
||||
|
||||
var zones = ListZones{
|
||||
Data: []RecordZone{
|
||||
Data: []ItemZone{
|
||||
|
||||
{
|
||||
ID: 2,
|
||||
@@ -76,7 +76,7 @@ func TestFilterByStatus(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFilterFunc(t *testing.T) {
|
||||
actual := zones.FilterFunc(func(ien RecordZone) bool {
|
||||
actual := zones.FilterFunc(func(ien ItemZone) bool {
|
||||
return ien.Deletable == true
|
||||
})
|
||||
|
||||
|
||||
@@ -1,11 +1,23 @@
|
||||
package zone
|
||||
|
||||
// CPU alignment profile
|
||||
type CpuAlignmentProfile struct {
|
||||
// Profile name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Vendor
|
||||
Vendor string `json:"vendor"`
|
||||
|
||||
// Model
|
||||
Model string `json:"model"`
|
||||
}
|
||||
|
||||
type ListZones struct {
|
||||
// Entry count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
|
||||
// Data
|
||||
Data []RecordZone `json:"data"`
|
||||
Data []ItemZone `json:"data"`
|
||||
}
|
||||
|
||||
// Detailed information about the zone record
|
||||
@@ -63,4 +75,112 @@ type RecordZone struct {
|
||||
|
||||
// List of associated VINS IDs
|
||||
VinsIDs []uint64 `json:"vinsIds"`
|
||||
|
||||
// DRS
|
||||
DRS bool `json:"drs"`
|
||||
|
||||
// DRS UID
|
||||
DRSUID string `json:"drs_uid"`
|
||||
|
||||
// App ID
|
||||
AppID string `json:"app_id"`
|
||||
|
||||
// Decort URL
|
||||
DecortURL string `json:"decort_url"`
|
||||
|
||||
// DRS Name
|
||||
DRSName string `json:"drs_name"`
|
||||
|
||||
// SSO URL
|
||||
SSOURL string `json:"sso_url"`
|
||||
|
||||
// SSO type
|
||||
SSOType string `json:"sso_type"`
|
||||
|
||||
// Ping address
|
||||
PingAddr string `json:"ping_addr"`
|
||||
|
||||
// Broadcast address
|
||||
BroadcastAddr string `json:"broadcast_addr"`
|
||||
|
||||
// Skip ssl verify
|
||||
SSLSkipVerify bool `json:"ssl_skip_verify"`
|
||||
|
||||
// Domain
|
||||
Domain string `json:"domain"`
|
||||
|
||||
// CPU alignment profiles
|
||||
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
|
||||
}
|
||||
|
||||
// A zone item from a list
|
||||
type ItemZone struct {
|
||||
// App ID
|
||||
AppID string `json:"app_id"`
|
||||
|
||||
// If true, all nodes belonging to the given zone will be marked for autostart
|
||||
AutoStart bool `json:"autostart"`
|
||||
|
||||
// Created timestamp
|
||||
CreatedTime uint64 `json:"createdTime"`
|
||||
|
||||
// Decort URL
|
||||
DecortURL string `json:"decort_url"`
|
||||
|
||||
// Deletable flag
|
||||
Deletable bool `json:"deletable"`
|
||||
|
||||
// Description
|
||||
Description string `json:"description"`
|
||||
|
||||
// DRS
|
||||
DRS bool `json:"drs"`
|
||||
|
||||
// DRS Name
|
||||
DRSName string `json:"drs_name"`
|
||||
|
||||
// DRS UID
|
||||
DRSUID string `json:"drs_uid"`
|
||||
|
||||
// GID
|
||||
GID uint64 `json:"gid"`
|
||||
|
||||
// GUID
|
||||
GUID uint64 `json:"guid"`
|
||||
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
|
||||
// List of associated Node IDs
|
||||
NodeIDs []uint64 `json:"nodeIds"`
|
||||
|
||||
// SSO URL
|
||||
SSOURL string `json:"sso_url"`
|
||||
|
||||
// SSO type
|
||||
SSOType string `json:"sso_type"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Updated timestamp
|
||||
UpdatedTime uint64 `json:"updatedTime"`
|
||||
|
||||
// Ping address
|
||||
PingAddr string `json:"ping_addr"`
|
||||
|
||||
// Broadcast address
|
||||
BroadcastAddr string `json:"broadcast_addr"`
|
||||
|
||||
// Skip ssl verify
|
||||
SSLSkipVerify bool `json:"ssl_skip_verify"`
|
||||
|
||||
// Domain
|
||||
Domain string `json:"domain"`
|
||||
|
||||
// CPU alignment profiles
|
||||
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ type InfoAccount struct {
|
||||
CPUAllocationParameter string `json:"cpu_allocation_parameter"`
|
||||
|
||||
// CPU allocation ratio
|
||||
CPUAllocationRatio float64 `json:"cpu_allocation_ratio"`
|
||||
CPUAllocationRatio uint64 `json:"cpu_allocation_ratio"`
|
||||
|
||||
// Created by
|
||||
CreatedBy string `json:"createdBy"`
|
||||
|
||||
@@ -18,6 +18,11 @@ type AbortSharedSnapshotMergeRequest struct {
|
||||
Label string `url:"label" json:"label" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperAbortSharedSnapshotMergeRequest struct {
|
||||
AbortSharedSnapshotMergeRequest
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// AbortSharedSnapshotMerge shared snapshots merge abort
|
||||
func (c Compute) AbortSharedSnapshotMerge(ctx context.Context, req AbortSharedSnapshotMergeRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -25,9 +30,36 @@ func (c Compute) AbortSharedSnapshotMerge(ctx context.Context, req AbortSharedSn
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperAbortSharedSnapshotMergeRequest{
|
||||
AbortSharedSnapshotMergeRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/abort_shared_snapshot_merge"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
// AbortSharedSnapshotMergeAsync shared snapshots merge abort in async mode
|
||||
func (c Compute) AbortSharedSnapshotMergeAsync(ctx context.Context, req AbortSharedSnapshotMergeRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperAbortSharedSnapshotMergeRequest{
|
||||
AbortSharedSnapshotMergeRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/abort_shared_snapshot_merge"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -15,6 +15,12 @@ type CDEjectRequest struct {
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperCDEjectRequest struct {
|
||||
CDEjectRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// CDEject ejects CD image to compute's CD-ROM
|
||||
func (c Compute) CDEject(ctx context.Context, req CDEjectRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -22,9 +28,14 @@ func (c Compute) CDEject(ctx context.Context, req CDEjectRequest) (bool, error)
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperCDEjectRequest{
|
||||
CDEjectRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/cdEject"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -36,3 +47,25 @@ func (c Compute) CDEject(ctx context.Context, req CDEjectRequest) (bool, error)
|
||||
|
||||
return result, err
|
||||
}
|
||||
|
||||
// CDEjectAsync ejects CD image to compute's CD-ROM with AsyncMode
|
||||
func (c Compute) CDEjectAsync(ctx context.Context, req CDEjectRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperCDEjectRequest{
|
||||
CDEjectRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/cdEject"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -18,6 +18,12 @@ type CDInsertRequest struct {
|
||||
CDROMID uint64 `url:"cdromId" json:"cdromId" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperCDInsertRequest struct {
|
||||
CDInsertRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// CDInsert inserts new CD image to compute's CD-ROM
|
||||
func (c Compute) CDInsert(ctx context.Context, req CDInsertRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -25,12 +31,39 @@ func (c Compute) CDInsert(ctx context.Context, req CDInsertRequest) (bool, error
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperCDInsertRequest{
|
||||
CDInsertRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/cdInsert"
|
||||
|
||||
_, err = c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
_, err = c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// CDInsertAsync inserts new CD image to compute's CD-ROM with AsyncMode
|
||||
func (c Compute) CDInsertAsync(ctx context.Context, req CDInsertRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperCDInsertRequest{
|
||||
CDInsertRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/cdInsert"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -31,6 +31,12 @@ type ChangeIPRequest struct {
|
||||
IPAddr string `url:"ip_addr" json:"ip_addr" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperChangeIPRequest struct {
|
||||
ChangeIPRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// ChangeIP change reserved IP for compute instance
|
||||
func (c Compute) ChangeIP(ctx context.Context, req ChangeIPRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -38,9 +44,14 @@ func (c Compute) ChangeIP(ctx context.Context, req ChangeIPRequest) (bool, error
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperChangeIPRequest{
|
||||
ChangeIPRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/changeIp"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -52,3 +63,25 @@ func (c Compute) ChangeIP(ctx context.Context, req ChangeIPRequest) (bool, error
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ChangeIPAsync change reserved IP for compute instance with AsyncMode
|
||||
func (c Compute) ChangeIPAsync(ctx context.Context, req ChangeIPRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperChangeIPRequest{
|
||||
ChangeIPRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/changeIp"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -3,8 +3,9 @@ package compute
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// ChangeLinkStateRequest struct for changing link state
|
||||
@@ -23,6 +24,12 @@ type ChangeLinkStateRequest struct {
|
||||
State string `url:"state" json:"state" validate:"required,interfaceState"`
|
||||
}
|
||||
|
||||
type wrapperChangeLinkStateRequest struct {
|
||||
ChangeLinkStateRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// ChangeLinkState changes the status link virtual of compute
|
||||
func (c Compute) ChangeLinkState(ctx context.Context, req ChangeLinkStateRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -30,9 +37,14 @@ func (c Compute) ChangeLinkState(ctx context.Context, req ChangeLinkStateRequest
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperChangeLinkStateRequest{
|
||||
ChangeLinkStateRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/changeLinkState"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -41,5 +53,28 @@ func (c Compute) ChangeLinkState(ctx context.Context, req ChangeLinkStateRequest
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ChangeLinkStateAsync changes the status link virtual of compute with AsyncMode
|
||||
func (c Compute) ChangeLinkStateAsync(ctx context.Context, req ChangeLinkStateRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperChangeLinkStateRequest{
|
||||
ChangeLinkStateRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/changeLinkState"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,12 @@ type ChangeMTURequest struct {
|
||||
MTU uint64 `url:"mtu" json:"mtu" validate:"required" validate:"omitempty,mtu"`
|
||||
}
|
||||
|
||||
type wrapperChangeMTURequest struct {
|
||||
ChangeMTURequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// ChangeMTU change MTU for compute instance
|
||||
func (c Compute) ChangeMTU(ctx context.Context, req ChangeMTURequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -30,9 +36,14 @@ func (c Compute) ChangeMTU(ctx context.Context, req ChangeMTURequest) (bool, err
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperChangeMTURequest{
|
||||
ChangeMTURequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/change_mtu"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -44,3 +55,25 @@ func (c Compute) ChangeMTU(ctx context.Context, req ChangeMTURequest) (bool, err
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ChangeMTUAsync change MTU for compute instance with AsyncMode
|
||||
func (c Compute) ChangeMTUAsync(ctx context.Context, req ChangeMTURequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperChangeMTURequest{
|
||||
ChangeMTURequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/change_mtu"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -27,6 +27,12 @@ type ChangeSecGroupsRequest struct {
|
||||
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||
}
|
||||
|
||||
type wrapperChangeSecGroupsRequest struct {
|
||||
ChangeSecGroupsRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// ChangeSecGroups changes security groups for compute
|
||||
func (c Compute) ChangeSecGroups(ctx context.Context, req ChangeSecGroupsRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -34,9 +40,14 @@ func (c Compute) ChangeSecGroups(ctx context.Context, req ChangeSecGroupsRequest
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperChangeSecGroupsRequest{
|
||||
ChangeSecGroupsRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/change_security_groups"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -48,3 +59,25 @@ func (c Compute) ChangeSecGroups(ctx context.Context, req ChangeSecGroupsRequest
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ChangeSecGroupsAsync changes security groups for compute with AsyncMode
|
||||
func (c Compute) ChangeSecGroupsAsync(ctx context.Context, req ChangeSecGroupsRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperChangeSecGroupsRequest{
|
||||
ChangeSecGroupsRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/change_security_groups"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -44,6 +44,12 @@ type CloneRequest struct {
|
||||
SEPID uint64 `url:"sep_id" json:"sep_id"`
|
||||
}
|
||||
|
||||
type wrapperCloneRequest struct {
|
||||
CloneRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
|
||||
}
|
||||
|
||||
// Clone clones compute instance
|
||||
func (c Compute) Clone(ctx context.Context, req CloneRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -51,9 +57,36 @@ func (c Compute) Clone(ctx context.Context, req CloneRequest) (string, error) {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperCloneRequest{
|
||||
CloneRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/clone"
|
||||
|
||||
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
// CloneAsync clones compute instance with AsyncMode
|
||||
func (c Compute) CloneAsync(ctx context.Context, req CloneRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperCloneRequest{
|
||||
CloneRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/clone"
|
||||
|
||||
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -19,6 +19,12 @@ type CreateTemplateRequest struct {
|
||||
Name string `url:"name" json:"name" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperCreateTemplateRequest struct {
|
||||
CreateTemplateRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// CreateTemplate create template from compute instance
|
||||
func (c Compute) CreateTemplate(ctx context.Context, req CreateTemplateRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -26,9 +32,14 @@ func (c Compute) CreateTemplate(ctx context.Context, req CreateTemplateRequest)
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperCreateTemplateRequest{
|
||||
CreateTemplateRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/createTemplate"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -37,3 +48,25 @@ func (c Compute) CreateTemplate(ctx context.Context, req CreateTemplateRequest)
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// CreateTemplateAsync create template from compute instance with AsyncMode
|
||||
func (c Compute) CreateTemplateAsync(ctx context.Context, req CreateTemplateRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperCreateTemplateRequest{
|
||||
CreateTemplateRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/createTemplate"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,12 @@ type DeleteRequest struct {
|
||||
DetachDisks bool `url:"detachDisks,omitempty" json:"detachDisks,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperDeleteRequest struct {
|
||||
DeleteRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Delete deletes compute
|
||||
func (c Compute) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -30,9 +36,14 @@ func (c Compute) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDeleteRequest{
|
||||
DeleteRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/delete"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -44,3 +55,25 @@ func (c Compute) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DeleteAsync deletes compute with AsyncMode
|
||||
func (c Compute) DeleteAsync(ctx context.Context, req DeleteRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDeleteRequest{
|
||||
DeleteRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/delete"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
39
pkg/cloudbroker/compute/delete_cpu_alignment_profile.go
Normal file
39
pkg/cloudbroker/compute/delete_cpu_alignment_profile.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// DeleteCPUAlignmentProfileRequest struct to delete CPU alignment profile for computes
|
||||
type DeleteCPUAlignmentProfileRequest struct {
|
||||
// IDs of the compute instances
|
||||
// Required: true
|
||||
ComputeIDs []uint64 `url:"compute_ids" json:"compute_ids" validate:"min=1"`
|
||||
}
|
||||
|
||||
// DeleteCPUAlignmentProfile deletes CPU alignment profile for computes
|
||||
func (c Compute) DeleteCPUAlignmentProfile(ctx context.Context, req DeleteCPUAlignmentProfileRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/delete_cpu_alignment_profile"
|
||||
|
||||
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@@ -15,6 +15,12 @@ type DisableRequest struct {
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperDisableRequest struct {
|
||||
DisableRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Disable disables compute
|
||||
func (c Compute) Disable(ctx context.Context, req DisableRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -22,9 +28,14 @@ func (c Compute) Disable(ctx context.Context, req DisableRequest) (bool, error)
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDisableRequest{
|
||||
DisableRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/disable"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -36,3 +47,25 @@ func (c Compute) Disable(ctx context.Context, req DisableRequest) (bool, error)
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DisableAsync disables compute with AsyncMode
|
||||
func (c Compute) DisableAsync(ctx context.Context, req DisableRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDisableRequest{
|
||||
DisableRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/disable"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -56,9 +56,19 @@ type DiskAddRequest struct {
|
||||
// Required: false
|
||||
Cache string `url:"cache,omitempty" json:"cache,omitempty"`
|
||||
|
||||
// BLK Discard
|
||||
// Discard
|
||||
// Required: false
|
||||
BLKDiscard interface{} `url:"blkdiscard,omitempty" json:"blkdiscard,omitempty" validate:"omitempty,isBool"`
|
||||
Discard string `url:"discard,omitempty" json:"discard,omitempty"`
|
||||
|
||||
// Mount disk in read-only mode
|
||||
// Required: false
|
||||
ReadOnly bool `url:"read_only,omitempty" json:"read_only,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperDiskAddRequest struct {
|
||||
DiskAddRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// DiskAdd creates new disk and attach to compute
|
||||
@@ -68,9 +78,14 @@ func (c Compute) DiskAdd(ctx context.Context, req DiskAddRequest) (uint64, error
|
||||
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskAddRequest{
|
||||
DiskAddRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/diskAdd"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -82,3 +97,25 @@ func (c Compute) DiskAdd(ctx context.Context, req DiskAddRequest) (uint64, error
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DiskAddAsync creates new disk and attach to compute with AsyncMode
|
||||
func (c Compute) DiskAddAsync(ctx context.Context, req DiskAddRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskAddRequest{
|
||||
DiskAddRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/diskAdd"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -25,6 +25,16 @@ type DiskAttachRequest struct {
|
||||
// Desired bus number (hex string, e.g. "0x03")
|
||||
// Required: false
|
||||
BusNumber string `url:"bus_number,omitempty" json:"bus_number,omitempty"`
|
||||
|
||||
// Mount disk in read-only mode
|
||||
// Required: false
|
||||
ReadOnly bool `url:"read_only,omitempty" json:"read_only,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperDiskAttachRequest struct {
|
||||
DiskAttachRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// DiskAttach attach disk to compute
|
||||
@@ -34,9 +44,14 @@ func (c Compute) DiskAttach(ctx context.Context, req DiskAttachRequest) (bool, e
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskAttachRequest{
|
||||
DiskAttachRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/diskAttach"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -48,3 +63,25 @@ func (c Compute) DiskAttach(ctx context.Context, req DiskAttachRequest) (bool, e
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DiskAttachAsync attach disk to compute with AsyncMode
|
||||
func (c Compute) DiskAttachAsync(ctx context.Context, req DiskAttachRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskAttachRequest{
|
||||
DiskAttachRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/diskAttach"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,12 @@ type DiskDelRequest struct {
|
||||
Permanently bool `url:"permanently" json:"permanently"`
|
||||
}
|
||||
|
||||
type wrapperDiskDelRequest struct {
|
||||
DiskDelRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// DiskDel deletes disk and detaches it from compute
|
||||
func (c Compute) DiskDel(ctx context.Context, req DiskDelRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -30,9 +36,14 @@ func (c Compute) DiskDel(ctx context.Context, req DiskDelRequest) (bool, error)
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskDelRequest{
|
||||
DiskDelRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/diskDel"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -44,3 +55,25 @@ func (c Compute) DiskDel(ctx context.Context, req DiskDelRequest) (bool, error)
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DiskDelAsync deletes disk and detaches it from compute with AsyncMode
|
||||
func (c Compute) DiskDelAsync(ctx context.Context, req DiskDelRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskDelRequest{
|
||||
DiskDelRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/diskDel"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -19,6 +19,12 @@ type DiskDetachRequest struct {
|
||||
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperDiskDetachRequest struct {
|
||||
DiskDetachRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// DiskDetach detaches disk from compute
|
||||
func (c Compute) DiskDetach(ctx context.Context, req DiskDetachRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -26,9 +32,14 @@ func (c Compute) DiskDetach(ctx context.Context, req DiskDetachRequest) (bool, e
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskDetachRequest{
|
||||
DiskDetachRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/diskDetach"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -40,3 +51,25 @@ func (c Compute) DiskDetach(ctx context.Context, req DiskDetachRequest) (bool, e
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DiskDetachAsync detaches disk from compute with AsyncMode
|
||||
func (c Compute) DiskDetachAsync(ctx context.Context, req DiskDetachRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskDetachRequest{
|
||||
DiskDetachRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/diskDetach"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,12 @@ type DiskQOSRequest struct {
|
||||
Limits string `url:"limits" json:"limits" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperDiskQOSRequest struct {
|
||||
DiskQOSRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// DiskQOS changes QOS of the disk
|
||||
func (c Compute) DiskQOS(ctx context.Context, req DiskQOSRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -30,9 +36,14 @@ func (c Compute) DiskQOS(ctx context.Context, req DiskQOSRequest) (bool, error)
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskQOSRequest{
|
||||
DiskQOSRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/diskQos"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -44,3 +55,25 @@ func (c Compute) DiskQOS(ctx context.Context, req DiskQOSRequest) (bool, error)
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DiskQOSAsync changes QOS of the disk with AsyncMode
|
||||
func (c Compute) DiskQOSAsync(ctx context.Context, req DiskQOSRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskQOSRequest{
|
||||
DiskQOSRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/diskQos"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,12 @@ type DiskResizeRequest struct {
|
||||
Size uint64 `url:"size" json:"size" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperDiskResizeRequest struct {
|
||||
DiskResizeRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// DiskResize changes disk size
|
||||
func (c Compute) DiskResize(ctx context.Context, req DiskResizeRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -30,9 +36,14 @@ func (c Compute) DiskResize(ctx context.Context, req DiskResizeRequest) (bool, e
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskResizeRequest{
|
||||
DiskResizeRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/diskResize"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -44,3 +55,25 @@ func (c Compute) DiskResize(ctx context.Context, req DiskResizeRequest) (bool, e
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DiskResizeAsync changes disk size with AsyncMode
|
||||
func (c Compute) DiskResizeAsync(ctx context.Context, req DiskResizeRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskResizeRequest{
|
||||
DiskResizeRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/diskResize"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,12 @@ type DiskSwitchToReplicationRequest struct {
|
||||
StopReplication bool `url:"stopReplication" json:"stopReplication"`
|
||||
}
|
||||
|
||||
type wrapperDiskSwitchToReplicationRequest struct {
|
||||
DiskSwitchToReplicationRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// DiskSwitchToReplication switches disk to it's replication
|
||||
func (c Compute) DiskSwitchToReplication(ctx context.Context, req DiskSwitchToReplicationRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -30,9 +36,14 @@ func (c Compute) DiskSwitchToReplication(ctx context.Context, req DiskSwitchToRe
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskSwitchToReplicationRequest{
|
||||
DiskSwitchToReplicationRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/diskSwitchToReplication"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -44,3 +55,25 @@ func (c Compute) DiskSwitchToReplication(ctx context.Context, req DiskSwitchToRe
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DiskSwitchToReplicationAsync switches disk to it's replication with AsyncMode
|
||||
func (c Compute) DiskSwitchToReplicationAsync(ctx context.Context, req DiskSwitchToReplicationRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperDiskSwitchToReplicationRequest{
|
||||
DiskSwitchToReplicationRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/diskSwitchToReplication"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
46
pkg/cloudbroker/compute/get_cpu_alignment_profile.go
Normal file
46
pkg/cloudbroker/compute/get_cpu_alignment_profile.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// GetCPUAlignmentProfileRequest struct to get CPU alignment profile for compute
|
||||
type GetCPUAlignmentProfileRequest struct {
|
||||
// ID of the compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
|
||||
}
|
||||
|
||||
// GetCPUAlignmentProfile gets CPU alignment profile for compute
|
||||
func (c Compute) GetCPUAlignmentProfile(ctx context.Context, req GetCPUAlignmentProfileRequest) (*CPUAlignmentProfile, error) {
|
||||
res, err := c.GetCPUAlignmentProfileRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := CPUAlignmentProfile{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetCPUAlignmentProfileRaw gets CPU alignment profile for compute as an array of bytes
|
||||
func (c Compute) GetCPUAlignmentProfileRaw(ctx context.Context, req GetCPUAlignmentProfileRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/get_cpu_alignment_profile"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodGet, url, req)
|
||||
return res, err
|
||||
}
|
||||
@@ -15,6 +15,12 @@ type GuestAgentDisableRequest struct {
|
||||
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperGuestAgentDisableRequest struct {
|
||||
GuestAgentDisableRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Disable guest agent at a specific compute
|
||||
func (c Compute) GuestAgentDisable(ctx context.Context, req GuestAgentDisableRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -22,9 +28,14 @@ func (c Compute) GuestAgentDisable(ctx context.Context, req GuestAgentDisableReq
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperGuestAgentDisableRequest{
|
||||
GuestAgentDisableRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/guest_agent_disable"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -36,3 +47,25 @@ func (c Compute) GuestAgentDisable(ctx context.Context, req GuestAgentDisableReq
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GuestAgentDisableAsync disables guest agent at a specific compute with AsyncMode
|
||||
func (c Compute) GuestAgentDisableAsync(ctx context.Context, req GuestAgentDisableRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperGuestAgentDisableRequest{
|
||||
GuestAgentDisableRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/guest_agent_disable"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -15,6 +15,12 @@ type GuestAgentEnableRequest struct {
|
||||
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperGuestAgentEnableRequest struct {
|
||||
GuestAgentEnableRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Enable guest agent at a specific compute
|
||||
func (c Compute) GuestAgentEnable(ctx context.Context, req GuestAgentEnableRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -22,9 +28,14 @@ func (c Compute) GuestAgentEnable(ctx context.Context, req GuestAgentEnableReque
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperGuestAgentEnableRequest{
|
||||
GuestAgentEnableRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/guest_agent_enable"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -36,3 +47,25 @@ func (c Compute) GuestAgentEnable(ctx context.Context, req GuestAgentEnableReque
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GuestAgentEnableAsync enables guest agent at a specific compute with AsyncMode
|
||||
func (c Compute) GuestAgentEnableAsync(ctx context.Context, req GuestAgentEnableRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperGuestAgentEnableRequest{
|
||||
GuestAgentEnableRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/guest_agent_enable"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,12 @@ type GuestAgentExecuteRequest struct {
|
||||
Arguments string `url:"arguments" json:"arguments" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperGuestAgentExecuteRequest struct {
|
||||
GuestAgentExecuteRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Execute guest agent command
|
||||
func (c Compute) GuestAgentExecuteRequest(ctx context.Context, req GuestAgentExecuteRequest) (map[string]interface{}, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -30,9 +36,14 @@ func (c Compute) GuestAgentExecuteRequest(ctx context.Context, req GuestAgentExe
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperGuestAgentExecuteRequest{
|
||||
GuestAgentExecuteRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/guest_agent_execute"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -46,3 +57,25 @@ func (c Compute) GuestAgentExecuteRequest(ctx context.Context, req GuestAgentExe
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GuestAgentExecuteRequestAsync executes guest agent command with AsyncMode
|
||||
func (c Compute) GuestAgentExecuteRequestAsync(ctx context.Context, req GuestAgentExecuteRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperGuestAgentExecuteRequest{
|
||||
GuestAgentExecuteRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/guest_agent_execute"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -15,6 +15,12 @@ type GuestAgentFeatureUpdateRequest struct {
|
||||
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperGuestAgentFeatureUpdateRequest struct {
|
||||
GuestAgentFeatureUpdateRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Feature update guest agent
|
||||
func (c Compute) GuestAgentFeatureUpdate(ctx context.Context, req GuestAgentFeatureUpdateRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -22,9 +28,14 @@ func (c Compute) GuestAgentFeatureUpdate(ctx context.Context, req GuestAgentFeat
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperGuestAgentFeatureUpdateRequest{
|
||||
GuestAgentFeatureUpdateRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/guest_agent_feature_update"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -36,3 +47,25 @@ func (c Compute) GuestAgentFeatureUpdate(ctx context.Context, req GuestAgentFeat
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GuestAgentFeatureUpdateAsync feature updates guest agent with AsyncMode
|
||||
func (c Compute) GuestAgentFeatureUpdateAsync(ctx context.Context, req GuestAgentFeatureUpdateRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperGuestAgentFeatureUpdateRequest{
|
||||
GuestAgentFeatureUpdateRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/guest_agent_feature_update"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -19,6 +19,12 @@ type MassDeleteRequest struct {
|
||||
Permanently bool `url:"permanently,omitempty" json:"permanently,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperMassDeleteRequest struct {
|
||||
MassDeleteRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// MassDelete starts jobs to delete several computes
|
||||
func (c Compute) MassDelete(ctx context.Context, req MassDeleteRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -26,9 +32,14 @@ func (c Compute) MassDelete(ctx context.Context, req MassDeleteRequest) (bool, e
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperMassDeleteRequest{
|
||||
MassDeleteRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/massDelete"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -40,3 +51,25 @@ func (c Compute) MassDelete(ctx context.Context, req MassDeleteRequest) (bool, e
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// MassDeleteAsync starts jobs to delete several computes with AsyncMode
|
||||
func (c Compute) MassDeleteAsync(ctx context.Context, req MassDeleteRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperMassDeleteRequest{
|
||||
MassDeleteRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/massDelete"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -15,6 +15,12 @@ type MassRebootRequest struct {
|
||||
ComputeIDs []uint64 `url:"computeIds" json:"computeIds" validate:"min=1"`
|
||||
}
|
||||
|
||||
type wrapperMassRebootRequest struct {
|
||||
MassRebootRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// MassReboot starts jobs to reboot several computes
|
||||
func (c Compute) MassReboot(ctx context.Context, req MassRebootRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -22,9 +28,14 @@ func (c Compute) MassReboot(ctx context.Context, req MassRebootRequest) (bool, e
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperMassRebootRequest{
|
||||
MassRebootRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/massReboot"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -36,3 +47,25 @@ func (c Compute) MassReboot(ctx context.Context, req MassRebootRequest) (bool, e
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// MassRebootAsync starts jobs to reboot several computes with AsyncMode
|
||||
func (c Compute) MassRebootAsync(ctx context.Context, req MassRebootRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperMassRebootRequest{
|
||||
MassRebootRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/massReboot"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -15,6 +15,12 @@ type MassStartRequest struct {
|
||||
ComputeIDs []uint64 `url:"computeIds" json:"computeIds" validate:"min=1"`
|
||||
}
|
||||
|
||||
type wrapperMassStartRequest struct {
|
||||
MassStartRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// MassStart starts jobs to start several computes
|
||||
func (c Compute) MassStart(ctx context.Context, req MassStartRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -22,9 +28,14 @@ func (c Compute) MassStart(ctx context.Context, req MassStartRequest) (bool, err
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperMassStartRequest{
|
||||
MassStartRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/massStart"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -36,3 +47,25 @@ func (c Compute) MassStart(ctx context.Context, req MassStartRequest) (bool, err
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// MassStartAsync starts jobs to start several computes with AsyncMode
|
||||
func (c Compute) MassStartAsync(ctx context.Context, req MassStartRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperMassStartRequest{
|
||||
MassStartRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/massStart"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user