diff --git a/CHANGELOG.md b/CHANGELOG.md
index c2f1624..2cdcafb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,4 @@
-## Version 1.14.11
+## 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,12 +7,176 @@
Все методы группы `.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
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BGOS-876 | Вычисляемое поле `FreeIPs` в структуру ответа `ItemExtNet` в cloudapi/extnet |
+
+#### grid
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| 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
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| 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
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| 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
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BGOS-896 | Обязательное поле `ID` в структуру запроса `UpdateAddress` в sdn/logical_port |
+
+#### SDN netobjgroups
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BGOS-884 | Опциональное поле `Type` в структуру запроса `ListRequest` в sdn/netobjgroups |
+
### Изменено
+#### account
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BGOS-887 | Тип поля `CPUAllocationRatio` с `float64` на `uint64` в структуре ответа `RecordAccount` в cloudapi/account |
+| BGOS-887 | Тип поля `CPUAllocationRatio` с `float64` на `uint64` в структуре ответа `InfoAccount` в cloudbroker/account |
+
#### 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
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BGOS-870 | Тип поля `BLKDiscard` с `bool` на `string` и переименование в `Discard` в структурах ответа `RecordDisk`, `ItemDisk` и `ItemDiskUnattached` в cloudapi/disks |
+| BGOS-870 | Тип поля `BLKDiscard` с `bool` на `string` и переименование в `Discard` в структуре ответа `InfoDisk` в cloudbroker/disks |
+| BGOS-870 | Тип поля `BLKDiscard` с `bool` на `string` и переименование в `Discard` в структурах запросов `CreateRequest` и `UpdateRequest` в cloudbroker/disks |
+| BGOS-881 | Поле `StoragePolicyID` c опционального на обязательное в структуре запроса `MigrateRequest` в cloudbroker/disks |
+
+#### grid
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BGOS-888 | Тип поля `Ratio` с `float64` на `uint64` в структурах запросов `SetCPUAllocationRatioRequest`, `SetCPUAllocationRatioForVMRequest` и `SetMemAllocationRatioRequest` в cloudbroker/grid |
+
+#### image
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BGOS-860 | Тип ответа метода `MultiImageExport` со `string` на `uint64` в cloudbroker/image |
+| BGOS-869 | Тип вычисляемого поля `AccountID` с опционального на обязательный в структуре `CreateVirtualRequest` в cloudapi/image |
+| BGOS-878 | Тип поля `TypeImage` в структуре запроса `ListRequest` с `string` на `[]string` в cloudbroker/image и cloudapi/image |
+
+#### kvmx86
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BGOS-870 | Тип поля `BLKDiscard` с `bool` на `string` и переименование в `Discard` в структуре ответа `DataDisk` в cloudbroker/kvmx86 |
+| BGOS-870 | Тип поля `BootDiskBLKDiscard` с `bool` на `string` и переименование в `BootDiskDiscard` в структурах запросов `CreateRequest`, `CreateBlankRequest` и `MassCreateRequest` в cloudbroker/kvmx86 |
+| BGOS-893 | Тип поля `SDNObjectGroupID` с `string` на `[]string` и переименование в `SDNObjectGroupIDs` в структуре `Interface` в cloudapi/kvmx86 и cloudbroker/kvmx86 |
+| BGOS-893 | Тип поля `SDNObjectGroupID` с `string` на `[]string` и переименование в `SDNObjectGroupIDs` в структуре `InterfaceMassCreate` в cloudbroker/kvmx86 |
+
+#### node
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| 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 |
+
+#### resmon
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BGOS-868 | Тип поля `EndTime` с обязательного на опциональное в структурах запроса `GetByNodeRequest`, `GetByNodesRequest` `GetByGRIDRequest`, `GetByComputeRequest` и `GetByComputesRequest` в cloudbroker/resmon |
+
+#### rg
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| 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
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BGOS-891 | Тип поля `Password` с опционального на обязательный в структуре запроса `CreateRequest` в cloudbroker/user |
+
+#### SDN logicalports
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| 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 |
### Исправлено
@@ -20,3 +184,16 @@
| Идентификатор
задачи | Описание |
| --- | --- |
| BGOS-871 | Тип поля `Config` в структуре запроса `wrapperUpdateRequest` с `[]string` на `string` в cloudbroker/vfpool |
+
+### Удалено
+
+#### grid
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BGOS-888 | Вычисляемые поля `CKey` и `Meta` из структуры ответа `RecordGrid` в cloudbroker/grid |
+
+#### user
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BGOS-861 | Значение по умолчанию опционального поля `Password` в структуре запроса `CreateRequest` в cloudbroker/user |
+| BGOS-875 | Опциональное поле `Password` из структуры ответа `ItemUser` в cloudbroker/user |
diff --git a/README.md b/README.md
index 22126b7..47cc1cd 100644
--- a/README.md
+++ b/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 версии платформы
## Оглавление
@@ -570,7 +571,6 @@ func main() {
- `.PCIDevice()` - для работы с `PCIDevice`
- `.Prometheus()` - для работы с `Prometheus`
- `.Resmon()` - для работы с `Resmon`
- - `.ResourceOptimizer()` - для работы с `ResourceOptimizer`
- `.RG()` - для работы с `RG`
- `.SecurityGroup()` - для работы с `Security Group`
- `.SEP()` - для работы с `SEP`
diff --git a/internal/constants/constants.go b/internal/constants/constants.go
index c21520f..737c781 100644
--- a/internal/constants/constants.go
+++ b/internal/constants/constants.go
@@ -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": "-",
diff --git a/internal/validators/custom.go b/internal/validators/custom.go
index f2a4c6d..7a92a55 100644
--- a/internal/validators/custom.go
+++ b/internal/validators/custom.go
@@ -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
+}
diff --git a/internal/validators/validator.go b/internal/validators/validator.go
index 38c26da..5ad2545 100644
--- a/internal/validators/validator.go
+++ b/internal/validators/validator.go
@@ -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
}
diff --git a/pkg/cloudapi/account/models.go b/pkg/cloudapi/account/models.go
index 1c548d7..0df8a28 100644
--- a/pkg/cloudapi/account/models.go
+++ b/pkg/cloudapi/account/models.go
@@ -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"`
diff --git a/pkg/cloudapi/compute/abort_shared_snapshot_merge.go b/pkg/cloudapi/compute/abort_shared_snapshot_merge.go
index fce0d51..24775c3 100644
--- a/pkg/cloudapi/compute/abort_shared_snapshot_merge.go
+++ b/pkg/cloudapi/compute/abort_shared_snapshot_merge.go
@@ -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
}
diff --git a/pkg/cloudapi/compute/cd_eject.go b/pkg/cloudapi/compute/cd_eject.go
index 5563a7e..3ff27bd 100644
--- a/pkg/cloudapi/compute/cd_eject.go
+++ b/pkg/cloudapi/compute/cd_eject.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/cd_insert.go b/pkg/cloudapi/compute/cd_insert.go
index 548c4b2..7b1c6b6 100644
--- a/pkg/cloudapi/compute/cd_insert.go
+++ b/pkg/cloudapi/compute/cd_insert.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/change_ip.go b/pkg/cloudapi/compute/change_ip.go
index cd9e992..c119521 100644
--- a/pkg/cloudapi/compute/change_ip.go
+++ b/pkg/cloudapi/compute/change_ip.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/change_link_state.go b/pkg/cloudapi/compute/change_link_state.go
index 86c74f0..07e4584 100644
--- a/pkg/cloudapi/compute/change_link_state.go
+++ b/pkg/cloudapi/compute/change_link_state.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/change_mtu.go b/pkg/cloudapi/compute/change_mtu.go
index 13829de..cb93e7b 100644
--- a/pkg/cloudapi/compute/change_mtu.go
+++ b/pkg/cloudapi/compute/change_mtu.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/change_secutity_group.go b/pkg/cloudapi/compute/change_secutity_group.go
index 442878c..1c8e060 100644
--- a/pkg/cloudapi/compute/change_secutity_group.go
+++ b/pkg/cloudapi/compute/change_secutity_group.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/clone.go b/pkg/cloudapi/compute/clone.go
index 6bb036a..8286ea1 100644
--- a/pkg/cloudapi/compute/clone.go
+++ b/pkg/cloudapi/compute/clone.go
@@ -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
}
diff --git a/pkg/cloudapi/compute/delete.go b/pkg/cloudapi/compute/delete.go
index a087b3d..963eac6 100644
--- a/pkg/cloudapi/compute/delete.go
+++ b/pkg/cloudapi/compute/delete.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/delete_cpu_alignment_profile.go b/pkg/cloudapi/compute/delete_cpu_alignment_profile.go
new file mode 100644
index 0000000..5196dec
--- /dev/null
+++ b/pkg/cloudapi/compute/delete_cpu_alignment_profile.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/disable.go b/pkg/cloudapi/compute/disable.go
index 9503563..2d3b24d 100644
--- a/pkg/cloudapi/compute/disable.go
+++ b/pkg/cloudapi/compute/disable.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/disk_add.go b/pkg/cloudapi/compute/disk_add.go
index 436fda2..01baee9 100644
--- a/pkg/cloudapi/compute/disk_add.go
+++ b/pkg/cloudapi/compute/disk_add.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/disk_attach.go b/pkg/cloudapi/compute/disk_attach.go
index 9b18375..f59c502 100644
--- a/pkg/cloudapi/compute/disk_attach.go
+++ b/pkg/cloudapi/compute/disk_attach.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/disk_del.go b/pkg/cloudapi/compute/disk_del.go
index 09cd88d..843ddc0 100644
--- a/pkg/cloudapi/compute/disk_del.go
+++ b/pkg/cloudapi/compute/disk_del.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/disk_detach.go b/pkg/cloudapi/compute/disk_detach.go
index 651047a..0dd3084 100644
--- a/pkg/cloudapi/compute/disk_detach.go
+++ b/pkg/cloudapi/compute/disk_detach.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/disk_qos.go b/pkg/cloudapi/compute/disk_qos.go
index 8583c7e..ef97569 100644
--- a/pkg/cloudapi/compute/disk_qos.go
+++ b/pkg/cloudapi/compute/disk_qos.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/disk_resize.go b/pkg/cloudapi/compute/disk_resize.go
index f9d0fd0..d4676a3 100644
--- a/pkg/cloudapi/compute/disk_resize.go
+++ b/pkg/cloudapi/compute/disk_resize.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/disk_switch_to_replication.go b/pkg/cloudapi/compute/disk_switch_to_replication.go
index 82e141d..fc4d207 100644
--- a/pkg/cloudapi/compute/disk_switch_to_replication.go
+++ b/pkg/cloudapi/compute/disk_switch_to_replication.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/get_cpu_alignment_profile.go b/pkg/cloudapi/compute/get_cpu_alignment_profile.go
new file mode 100644
index 0000000..cb6a3b3
--- /dev/null
+++ b/pkg/cloudapi/compute/get_cpu_alignment_profile.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/guest_agent_disable.go b/pkg/cloudapi/compute/guest_agent_disable.go
index c709baf..9d0435c 100644
--- a/pkg/cloudapi/compute/guest_agent_disable.go
+++ b/pkg/cloudapi/compute/guest_agent_disable.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/guest_agent_enable.go b/pkg/cloudapi/compute/guest_agent_enable.go
index dc3eaa9..9a68df0 100644
--- a/pkg/cloudapi/compute/guest_agent_enable.go
+++ b/pkg/cloudapi/compute/guest_agent_enable.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/guest_agent_execute.go b/pkg/cloudapi/compute/guest_agent_execute.go
index fde7cf3..ed35613 100644
--- a/pkg/cloudapi/compute/guest_agent_execute.go
+++ b/pkg/cloudapi/compute/guest_agent_execute.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/guest_agent_feature_update.go b/pkg/cloudapi/compute/guest_agent_feature_update.go
index 7150be7..fd3318c 100644
--- a/pkg/cloudapi/compute/guest_agent_feature_update.go
+++ b/pkg/cloudapi/compute/guest_agent_feature_update.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/migrate_to_zone.go b/pkg/cloudapi/compute/migrate_to_zone.go
index bab15a1..7ab05fb 100644
--- a/pkg/cloudapi/compute/migrate_to_zone.go
+++ b/pkg/cloudapi/compute/migrate_to_zone.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/models.go b/pkg/cloudapi/compute/models.go
index 143434d..4bd21b9 100644
--- a/pkg/cloudapi/compute/models.go
+++ b/pkg/cloudapi/compute/models.go
@@ -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
diff --git a/pkg/cloudapi/compute/move_to_rg.go b/pkg/cloudapi/compute/move_to_rg.go
index 592483a..bc1699e 100644
--- a/pkg/cloudapi/compute/move_to_rg.go
+++ b/pkg/cloudapi/compute/move_to_rg.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/net_attach.go b/pkg/cloudapi/compute/net_attach.go
index 3ddd062..412a15f 100644
--- a/pkg/cloudapi/compute/net_attach.go
+++ b/pkg/cloudapi/compute/net_attach.go
@@ -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
@@ -83,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)
@@ -90,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
}
@@ -106,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
+}
diff --git a/pkg/cloudapi/compute/net_detach.go b/pkg/cloudapi/compute/net_detach.go
index 411debe..ac53039 100644
--- a/pkg/cloudapi/compute/net_detach.go
+++ b/pkg/cloudapi/compute/net_detach.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/pause.go b/pkg/cloudapi/compute/pause.go
index c93adef..facb656 100644
--- a/pkg/cloudapi/compute/pause.go
+++ b/pkg/cloudapi/compute/pause.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/pfw_add.go b/pkg/cloudapi/compute/pfw_add.go
index 7a89ccd..421ad9c 100644
--- a/pkg/cloudapi/compute/pfw_add.go
+++ b/pkg/cloudapi/compute/pfw_add.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/pfw_del.go b/pkg/cloudapi/compute/pfw_del.go
index 13ec81f..e712868 100644
--- a/pkg/cloudapi/compute/pfw_del.go
+++ b/pkg/cloudapi/compute/pfw_del.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/pin_to_node.go b/pkg/cloudapi/compute/pin_to_node.go
index 6152976..7d4a67a 100644
--- a/pkg/cloudapi/compute/pin_to_node.go
+++ b/pkg/cloudapi/compute/pin_to_node.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/power_cycle.go b/pkg/cloudapi/compute/power_cycle.go
index b457138..6b5b380 100644
--- a/pkg/cloudapi/compute/power_cycle.go
+++ b/pkg/cloudapi/compute/power_cycle.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/reboot.go b/pkg/cloudapi/compute/reboot.go
index a2e86e2..fa478ef 100644
--- a/pkg/cloudapi/compute/reboot.go
+++ b/pkg/cloudapi/compute/reboot.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/redeploy.go b/pkg/cloudapi/compute/redeploy.go
index 84d4bd7..ea291af 100644
--- a/pkg/cloudapi/compute/redeploy.go
+++ b/pkg/cloudapi/compute/redeploy.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/reset.go b/pkg/cloudapi/compute/reset.go
index 3297e59..3ff9d12 100644
--- a/pkg/cloudapi/compute/reset.go
+++ b/pkg/cloudapi/compute/reset.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/resize.go b/pkg/cloudapi/compute/resize.go
index 3626838..bf12f32 100644
--- a/pkg/cloudapi/compute/resize.go
+++ b/pkg/cloudapi/compute/resize.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/restore.go b/pkg/cloudapi/compute/restore.go
index 04bc504..80311d8 100644
--- a/pkg/cloudapi/compute/restore.go
+++ b/pkg/cloudapi/compute/restore.go
@@ -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
}
diff --git a/pkg/cloudapi/compute/resume.go b/pkg/cloudapi/compute/resume.go
index f8754db..8e86c7b 100644
--- a/pkg/cloudapi/compute/resume.go
+++ b/pkg/cloudapi/compute/resume.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/set_cpu_alignment_profile.go b/pkg/cloudapi/compute/set_cpu_alignment_profile.go
new file mode 100644
index 0000000..7c93b18
--- /dev/null
+++ b/pkg/cloudapi/compute/set_cpu_alignment_profile.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/snapshot_create.go b/pkg/cloudapi/compute/snapshot_create.go
index 691ad40..8a09b80 100644
--- a/pkg/cloudapi/compute/snapshot_create.go
+++ b/pkg/cloudapi/compute/snapshot_create.go
@@ -20,18 +20,33 @@ type SnapshotCreateRequest struct {
// Maximum length: 36 characters
// Required: true
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
}
@@ -40,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
+}
diff --git a/pkg/cloudapi/compute/snapshot_rollback.go b/pkg/cloudapi/compute/snapshot_rollback.go
index 0c74591..091f74e 100644
--- a/pkg/cloudapi/compute/snapshot_rollback.go
+++ b/pkg/cloudapi/compute/snapshot_rollback.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/start.go b/pkg/cloudapi/compute/start.go
index 511836b..dae3c0c 100644
--- a/pkg/cloudapi/compute/start.go
+++ b/pkg/cloudapi/compute/start.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/stop.go b/pkg/cloudapi/compute/stop.go
index 0205ba1..aadf692 100644
--- a/pkg/cloudapi/compute/stop.go
+++ b/pkg/cloudapi/compute/stop.go
@@ -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
+}
diff --git a/pkg/cloudapi/compute/update.go b/pkg/cloudapi/compute/update.go
index 3d33b97..99cecec 100644
--- a/pkg/cloudapi/compute/update.go
+++ b/pkg/cloudapi/compute/update.go
@@ -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
diff --git a/pkg/cloudapi/disks/models.go b/pkg/cloudapi/disks/models.go
index 00fa370..cd2ab3e 100644
--- a/pkg/cloudapi/disks/models.go
+++ b/pkg/cloudapi/disks/models.go
@@ -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"`
diff --git a/pkg/cloudapi/extnet/models.go b/pkg/cloudapi/extnet/models.go
index b7a7e9d..a525908 100644
--- a/pkg/cloudapi/extnet/models.go
+++ b/pkg/cloudapi/extnet/models.go
@@ -13,6 +13,9 @@ type ItemExtNet struct {
// Status
Status string `json:"status"`
+
+ // Free IPs
+ FreeIPs uint64 `json:"freeIps"`
}
// Extend information about external network
diff --git a/pkg/cloudapi/image/create_virtual.go b/pkg/cloudapi/image/create_virtual.go
index 629130d..c86a454 100644
--- a/pkg/cloudapi/image/create_virtual.go
+++ b/pkg/cloudapi/image/create_virtual.go
@@ -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
diff --git a/pkg/cloudapi/image/list.go b/pkg/cloudapi/image/list.go
index 87d9211..f466b81 100644
--- a/pkg/cloudapi/image/list.go
+++ b/pkg/cloudapi/image/list.go
@@ -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
diff --git a/pkg/cloudapi/kvmx86/create.go b/pkg/cloudapi/kvmx86/create.go
index cc12c10..af27baa 100644
--- a/pkg/cloudapi/kvmx86/create.go
+++ b/pkg/cloudapi/kvmx86/create.go
@@ -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
@@ -218,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
@@ -245,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 {
@@ -262,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 {
diff --git a/pkg/cloudapi/kvmx86/create_blank.go b/pkg/cloudapi/kvmx86/create_blank.go
index 22e3596..d39881d 100644
--- a/pkg/cloudapi/kvmx86/create_blank.go
+++ b/pkg/cloudapi/kvmx86/create_blank.go
@@ -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 {
diff --git a/pkg/cloudapi/rg/models.go b/pkg/cloudapi/rg/models.go
index c6bca70..4988e95 100644
--- a/pkg/cloudapi/rg/models.go
+++ b/pkg/cloudapi/rg/models.go
@@ -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"`
diff --git a/pkg/cloudapi/zone/models.go b/pkg/cloudapi/zone/models.go
index 5d56fbd..bffd048 100644
--- a/pkg/cloudapi/zone/models.go
+++ b/pkg/cloudapi/zone/models.go
@@ -1,5 +1,17 @@
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"`
@@ -96,6 +108,9 @@ type RecordZone struct {
// Domain
Domain string `json:"domain"`
+
+ // CPU alignment profiles
+ CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
}
// A zone item from a list
@@ -165,4 +180,7 @@ type ItemZone struct {
// Domain
Domain string `json:"domain"`
+
+ // CPU alignment profiles
+ CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
}
diff --git a/pkg/cloudbroker/account/models.go b/pkg/cloudbroker/account/models.go
index 850cc76..e748623 100644
--- a/pkg/cloudbroker/account/models.go
+++ b/pkg/cloudbroker/account/models.go
@@ -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"`
diff --git a/pkg/cloudbroker/compute/abort_shared_snapshot_merge.go b/pkg/cloudbroker/compute/abort_shared_snapshot_merge.go
index 89c5dfa..7840f96 100644
--- a/pkg/cloudbroker/compute/abort_shared_snapshot_merge.go
+++ b/pkg/cloudbroker/compute/abort_shared_snapshot_merge.go
@@ -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
}
diff --git a/pkg/cloudbroker/compute/cd_eject.go b/pkg/cloudbroker/compute/cd_eject.go
index a7af57b..e5c4a2a 100644
--- a/pkg/cloudbroker/compute/cd_eject.go
+++ b/pkg/cloudbroker/compute/cd_eject.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/cd_insert.go b/pkg/cloudbroker/compute/cd_insert.go
index d592654..28bd246 100644
--- a/pkg/cloudbroker/compute/cd_insert.go
+++ b/pkg/cloudbroker/compute/cd_insert.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/change_ip.go b/pkg/cloudbroker/compute/change_ip.go
index 9fad21a..f37f03b 100644
--- a/pkg/cloudbroker/compute/change_ip.go
+++ b/pkg/cloudbroker/compute/change_ip.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/change_link_state.go b/pkg/cloudbroker/compute/change_link_state.go
index 5082709..bf877a3 100644
--- a/pkg/cloudbroker/compute/change_link_state.go
+++ b/pkg/cloudbroker/compute/change_link_state.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/change_mtu.go b/pkg/cloudbroker/compute/change_mtu.go
index 6ebdd7f..1486624 100644
--- a/pkg/cloudbroker/compute/change_mtu.go
+++ b/pkg/cloudbroker/compute/change_mtu.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/change_secutity_group.go b/pkg/cloudbroker/compute/change_secutity_group.go
index c1f56d3..8f5b6b2 100644
--- a/pkg/cloudbroker/compute/change_secutity_group.go
+++ b/pkg/cloudbroker/compute/change_secutity_group.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/clone.go b/pkg/cloudbroker/compute/clone.go
index bb10ae2..633428e 100644
--- a/pkg/cloudbroker/compute/clone.go
+++ b/pkg/cloudbroker/compute/clone.go
@@ -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
}
diff --git a/pkg/cloudbroker/compute/create_template.go b/pkg/cloudbroker/compute/create_template.go
index 49d023e..d3883ae 100644
--- a/pkg/cloudbroker/compute/create_template.go
+++ b/pkg/cloudbroker/compute/create_template.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/delete.go b/pkg/cloudbroker/compute/delete.go
index 0f91703..d63dd8d 100644
--- a/pkg/cloudbroker/compute/delete.go
+++ b/pkg/cloudbroker/compute/delete.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/delete_cpu_alignment_profile.go b/pkg/cloudbroker/compute/delete_cpu_alignment_profile.go
new file mode 100644
index 0000000..ad8ab90
--- /dev/null
+++ b/pkg/cloudbroker/compute/delete_cpu_alignment_profile.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/disable.go b/pkg/cloudbroker/compute/disable.go
index eb7b4ee..8d36e49 100644
--- a/pkg/cloudbroker/compute/disable.go
+++ b/pkg/cloudbroker/compute/disable.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/disk_add.go b/pkg/cloudbroker/compute/disk_add.go
index 2a3f984..1bac6ad 100644
--- a/pkg/cloudbroker/compute/disk_add.go
+++ b/pkg/cloudbroker/compute/disk_add.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/disk_attach.go b/pkg/cloudbroker/compute/disk_attach.go
index 05ed72d..9ef2727 100644
--- a/pkg/cloudbroker/compute/disk_attach.go
+++ b/pkg/cloudbroker/compute/disk_attach.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/disk_del.go b/pkg/cloudbroker/compute/disk_del.go
index d50cd29..4399fcb 100644
--- a/pkg/cloudbroker/compute/disk_del.go
+++ b/pkg/cloudbroker/compute/disk_del.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/disk_detach.go b/pkg/cloudbroker/compute/disk_detach.go
index ab35bf3..1ad29ee 100644
--- a/pkg/cloudbroker/compute/disk_detach.go
+++ b/pkg/cloudbroker/compute/disk_detach.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/disk_qos.go b/pkg/cloudbroker/compute/disk_qos.go
index 91589a3..63af8fe 100644
--- a/pkg/cloudbroker/compute/disk_qos.go
+++ b/pkg/cloudbroker/compute/disk_qos.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/disk_resize.go b/pkg/cloudbroker/compute/disk_resize.go
index 9c8b1f2..5c135f8 100644
--- a/pkg/cloudbroker/compute/disk_resize.go
+++ b/pkg/cloudbroker/compute/disk_resize.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/disk_switch_to_replication.go b/pkg/cloudbroker/compute/disk_switch_to_replication.go
index 41b5886..056585f 100644
--- a/pkg/cloudbroker/compute/disk_switch_to_replication.go
+++ b/pkg/cloudbroker/compute/disk_switch_to_replication.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/get_cpu_alignment_profile.go b/pkg/cloudbroker/compute/get_cpu_alignment_profile.go
new file mode 100644
index 0000000..79886c9
--- /dev/null
+++ b/pkg/cloudbroker/compute/get_cpu_alignment_profile.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/guest_agent_disable.go b/pkg/cloudbroker/compute/guest_agent_disable.go
index f7e4475..5218228 100644
--- a/pkg/cloudbroker/compute/guest_agent_disable.go
+++ b/pkg/cloudbroker/compute/guest_agent_disable.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/guest_agent_enable.go b/pkg/cloudbroker/compute/guest_agent_enable.go
index c0e545f..c082103 100644
--- a/pkg/cloudbroker/compute/guest_agent_enable.go
+++ b/pkg/cloudbroker/compute/guest_agent_enable.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/guest_agent_execute.go b/pkg/cloudbroker/compute/guest_agent_execute.go
index d2710cb..c4c3bb6 100644
--- a/pkg/cloudbroker/compute/guest_agent_execute.go
+++ b/pkg/cloudbroker/compute/guest_agent_execute.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/guest_agent_feature_update.go b/pkg/cloudbroker/compute/guest_agent_feature_update.go
index 01a7aa2..8c6b623 100644
--- a/pkg/cloudbroker/compute/guest_agent_feature_update.go
+++ b/pkg/cloudbroker/compute/guest_agent_feature_update.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/mass_delete.go b/pkg/cloudbroker/compute/mass_delete.go
index 44c126b..3668232 100644
--- a/pkg/cloudbroker/compute/mass_delete.go
+++ b/pkg/cloudbroker/compute/mass_delete.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/mass_reboot.go b/pkg/cloudbroker/compute/mass_reboot.go
index d3652ac..d9e9c17 100644
--- a/pkg/cloudbroker/compute/mass_reboot.go
+++ b/pkg/cloudbroker/compute/mass_reboot.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/mass_start.go b/pkg/cloudbroker/compute/mass_start.go
index 00ff1a6..e099ba2 100644
--- a/pkg/cloudbroker/compute/mass_start.go
+++ b/pkg/cloudbroker/compute/mass_start.go
@@ -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
+}
diff --git a/pkg/cloudbroker/compute/mass_stop.go b/pkg/cloudbroker/compute/mass_stop.go
index 775c585..20047fd 100644
--- a/pkg/cloudbroker/compute/mass_stop.go
+++ b/pkg/cloudbroker/compute/mass_stop.go
@@ -19,6 +19,12 @@ type MassStopRequest struct {
Force bool `url:"force,omitempty" json:"force,omitempty"`
}
+type wrapperMassStopRequest struct {
+ MassStopRequest
+
+ AsyncMode bool `url:"asyncMode"`
+}
+
// MassStop starts jobs to stop several computes
func (c Compute) MassStop(ctx context.Context, req MassStopRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -26,9 +32,14 @@ func (c Compute) MassStop(ctx context.Context, req MassStopRequest) (bool, error
return false, validators.ValidationErrors(validators.GetErrors(err))
}
+ reqWrapped := wrapperMassStopRequest{
+ MassStopRequest: req,
+ AsyncMode: false,
+ }
+
url := "/cloudbroker/compute/massStop"
- 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) MassStop(ctx context.Context, req MassStopRequest) (bool, error
return result, nil
}
+
+// MassStopAsync starts jobs to stop several computes with AsyncMode
+func (c Compute) MassStopAsync(ctx context.Context, req MassStopRequest) (string, error) {
+ err := validators.ValidateRequest(req)
+ if err != nil {
+ return "", validators.ValidationErrors(validators.GetErrors(err))
+ }
+
+ reqWrapped := wrapperMassStopRequest{
+ MassStopRequest: req,
+ AsyncMode: true,
+ }
+
+ url := "/cloudbroker/compute/massStop"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/migrate_abort.go b/pkg/cloudbroker/compute/migrate_abort.go
index 3104daa..8465602 100644
--- a/pkg/cloudbroker/compute/migrate_abort.go
+++ b/pkg/cloudbroker/compute/migrate_abort.go
@@ -15,6 +15,12 @@ type MigrateAbortRequest struct {
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
}
+type wrapperMigrateAbortRequest struct {
+ MigrateAbortRequest
+
+ AsyncMode bool `url:"asyncMode"`
+}
+
// MigrateAbort aborts compute migration
func (c Compute) MigrateAbort(ctx context.Context, req MigrateAbortRequest) (string, error) {
err := validators.ValidateRequest(req)
@@ -22,9 +28,14 @@ func (c Compute) MigrateAbort(ctx context.Context, req MigrateAbortRequest) (str
return "", validators.ValidationErrors(validators.GetErrors(err))
}
+ reqWrapped := wrapperMigrateAbortRequest{
+ MigrateAbortRequest: req,
+ AsyncMode: false,
+ }
+
url := "/cloudbroker/compute/migrate_abort"
- 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
}
@@ -33,3 +44,25 @@ func (c Compute) MigrateAbort(ctx context.Context, req MigrateAbortRequest) (str
return result, nil
}
+
+// MigrateAbortAsync aborts compute migration with AsyncMode
+func (c Compute) MigrateAbortAsync(ctx context.Context, req MigrateAbortRequest) (string, error) {
+ err := validators.ValidateRequest(req)
+ if err != nil {
+ return "", validators.ValidationErrors(validators.GetErrors(err))
+ }
+
+ reqWrapped := wrapperMigrateAbortRequest{
+ MigrateAbortRequest: req,
+ AsyncMode: true,
+ }
+
+ url := "/cloudbroker/compute/migrate_abort"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/migrate_storage_abort.go b/pkg/cloudbroker/compute/migrate_storage_abort.go
index 6392e36..20cbf01 100644
--- a/pkg/cloudbroker/compute/migrate_storage_abort.go
+++ b/pkg/cloudbroker/compute/migrate_storage_abort.go
@@ -3,7 +3,7 @@ package compute
import (
"context"
"net/http"
- "strings"
+ "strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
@@ -20,21 +20,57 @@ type MigrateStorageAbortRequest struct {
StatusCheck bool `url:"statusCheck" json:"statusCheck"`
}
+type wrapperMigrateStorageAbortRequest struct {
+ MigrateStorageAbortRequest
+
+ AsyncMode bool `url:"asyncMode"`
+}
+
// MigrateStorageAbort aborts complex compute migration job
-func (c Compute) MigrateStorageAbort(ctx context.Context, req MigrateStorageAbortRequest) (string, error) {
+func (c Compute) MigrateStorageAbort(ctx context.Context, req MigrateStorageAbortRequest) (bool, error) {
+ err := validators.ValidateRequest(req)
+ if err != nil {
+ return false, validators.ValidationErrors(validators.GetErrors(err))
+ }
+
+ reqWrapped := wrapperMigrateStorageAbortRequest{
+ MigrateStorageAbortRequest: req,
+ AsyncMode: false,
+ }
+
+ url := "/cloudbroker/compute/migrateStorageAbort"
+
+ 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
+}
+
+// MigrateStorageAbortAsync aborts complex compute migration job with AsyncMode
+func (c Compute) MigrateStorageAbortAsync(ctx context.Context, req MigrateStorageAbortRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
+ reqWrapped := wrapperMigrateStorageAbortRequest{
+ MigrateStorageAbortRequest: req,
+ AsyncMode: true,
+ }
+
url := "/cloudbroker/compute/migrateStorageAbort"
- 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
}
- result := strings.ReplaceAll(string(res), "\"", "")
-
- return result, nil
+ return string(res), nil
}
diff --git a/pkg/cloudbroker/compute/migrate_storage_clean_up.go b/pkg/cloudbroker/compute/migrate_storage_clean_up.go
index 07522e7..8a81709 100644
--- a/pkg/cloudbroker/compute/migrate_storage_clean_up.go
+++ b/pkg/cloudbroker/compute/migrate_storage_clean_up.go
@@ -3,7 +3,7 @@ package compute
import (
"context"
"net/http"
- "strings"
+ "strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
@@ -15,23 +15,59 @@ type MigrateStorageCleanUpRequest struct {
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
}
+type wrapperMigrateStorageCleanUpRequest struct {
+ MigrateStorageCleanUpRequest
+
+ AsyncMode bool `url:"asyncMode"`
+}
+
// MigrateStorageCleanUp cleanup resources after finished (success of failed) complex compute migration.
// If the migration was successful, then old disks will be removed, else new (target) disks will be removed.
// Do it wisely!
-func (c Compute) MigrateStorageCleanUp(ctx context.Context, req MigrateStorageCleanUpRequest) (string, error) {
+func (c Compute) MigrateStorageCleanUp(ctx context.Context, req MigrateStorageCleanUpRequest) (bool, error) {
+ err := validators.ValidateRequest(req)
+ if err != nil {
+ return false, validators.ValidationErrors(validators.GetErrors(err))
+ }
+
+ reqWrapped := wrapperMigrateStorageCleanUpRequest{
+ MigrateStorageCleanUpRequest: req,
+ AsyncMode: false,
+ }
+
+ url := "/cloudbroker/compute/migrateStorageCleanup"
+
+ 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
+}
+
+// MigrateStorageCleanUpAsync cleanup resources after finished migration with AsyncMode
+func (c Compute) MigrateStorageCleanUpAsync(ctx context.Context, req MigrateStorageCleanUpRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
+ reqWrapped := wrapperMigrateStorageCleanUpRequest{
+ MigrateStorageCleanUpRequest: req,
+ AsyncMode: true,
+ }
+
url := "/cloudbroker/compute/migrateStorageCleanup"
- 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
}
- result := strings.ReplaceAll(string(res), "\"", "")
-
- return result, nil
+ return string(res), nil
}
diff --git a/pkg/cloudbroker/compute/migrate_to_zone.go b/pkg/cloudbroker/compute/migrate_to_zone.go
index 0d5095c..d674f1c 100644
--- a/pkg/cloudbroker/compute/migrate_to_zone.go
+++ b/pkg/cloudbroker/compute/migrate_to_zone.go
@@ -19,16 +19,27 @@ type MigrateToZoneRequest struct {
ZoneID uint64 `url:"zoneId" json:"zoneId" validate:"required"`
}
-// MoveToZone moves compute to new zone
+type wrapperMigrateToZoneRequest struct {
+ MigrateToZoneRequest
+
+ AsyncMode bool `url:"asyncMode"`
+}
+
+// MigrateToZone moves compute to new zone
func (c Compute) MigrateToZone(ctx context.Context, req MigrateToZoneRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
+ reqWrapped := wrapperMigrateToZoneRequest{
+ MigrateToZoneRequest: req,
+ AsyncMode: false,
+ }
+
url := "/cloudbroker/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 new 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 := "/cloudbroker/compute/migrateToZone"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/models.go b/pkg/cloudbroker/compute/models.go
index a1ce1de..2d489d7 100644
--- a/pkg/cloudbroker/compute/models.go
+++ b/pkg/cloudbroker/compute/models.go
@@ -67,6 +67,9 @@ type ListACL []ItemACL
// Main information about snapshot
type ItemSnapshot struct {
+ // Compute info
+ Compute RecordCompute `json:"compute"`
+
// List of disk IDs
Disks []uint64 `json:"disks"`
@@ -76,6 +79,9 @@ type ItemSnapshot struct {
// Label
Label string `json:"label"`
+ // Memory dump image ID
+ MemoryDumpImage uint64 `json:"memory_dump_image"`
+
// Timestamp
Timestamp uint64 `json:"timestamp"`
}
@@ -391,8 +397,8 @@ type ItemDisk struct {
// Access Control List
ACL ItemACL `json:"acl"`
- // BLK Discard
- BLKDiscard bool `json:"blkdiscard"`
+ // Discard
+ Discard string `json:"discard"`
// Block Size
BlockSize string `json:"block_size"`
@@ -546,6 +552,9 @@ type ItemDisk struct {
// UpdatedTime
UpdatedTime uint64 `json:"updatedTime"`
+
+ // Read-only
+ ReadOnly bool `json:"read_only"`
}
type ItemReplication struct {
@@ -723,6 +732,9 @@ type InfoCompute struct {
// Clone reference
CloneReference uint64 `json:"cloneReference"`
+ // Clock
+ Clock string `json:"clock"`
+
// List clone IDs
Clones []uint64 `json:"clones"`
@@ -825,6 +837,9 @@ type InfoCompute struct {
// PreferredCPU
PreferredCPU []int64 `json:"preferredCpu"`
+ // CPU alignment profile
+ CPUAlignmentProfile CPUAlignmentProfile `json:"cpu_alignment_profile"`
+
// Qemu_quest
QemuQuest QemuQuest `json:"qemu_guest"`
@@ -912,6 +927,12 @@ type QemuQuest struct {
User string `json:"user"`
}
+type CPUAlignmentProfile struct {
+ Model string `json:"model"`
+ Name string `json:"name"`
+ Vendor string `json:"vendor"`
+}
+
// Information about libvirt settings
type LibvirtSettings struct {
// TX mode
@@ -986,6 +1007,9 @@ type RecordCompute struct {
// Clone reference
CloneReference uint64 `json:"cloneReference"`
+ // Clock
+ Clock string `json:"clock"`
+
// List clone IDs
Clones []uint64 `json:"clones"`
@@ -1115,6 +1139,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"`
@@ -1307,6 +1334,9 @@ type InfoDisk struct {
// SEP ID
SepID int64 `json:"sepId"`
+
+ // Read-only
+ ReadOnly bool `json:"read_only"`
}
// List computes
diff --git a/pkg/cloudbroker/compute/move_to_rg.go b/pkg/cloudbroker/compute/move_to_rg.go
index 38e6d31..cd57152 100644
--- a/pkg/cloudbroker/compute/move_to_rg.go
+++ b/pkg/cloudbroker/compute/move_to_rg.go
@@ -34,16 +34,27 @@ 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) Validate(ctx context.Context, req MoveToRGRequest) (bool, error) {
+func (c Compute) MoveToRG(ctx context.Context, req MoveToRGRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
+ reqWrapped := wrapperMoveToRGRequest{
+ MoveToRGRequest: req,
+ AsyncMode: false,
+ }
+
url := "/cloudbroker/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) Validate(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 := "/cloudbroker/compute/moveToRg"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/net_attach.go b/pkg/cloudbroker/compute/net_attach.go
index dd66d4b..8960894 100644
--- a/pkg/cloudbroker/compute/net_attach.go
+++ b/pkg/cloudbroker/compute/net_attach.go
@@ -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
@@ -83,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)
@@ -90,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 := "/cloudbroker/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
}
@@ -106,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 := "/cloudbroker/compute/netAttach"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/net_detach.go b/pkg/cloudbroker/compute/net_detach.go
index ccddaa1..6b40d51 100644
--- a/pkg/cloudbroker/compute/net_detach.go
+++ b/pkg/cloudbroker/compute/net_detach.go
@@ -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 := "/cloudbroker/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 := "/cloudbroker/compute/netDetach"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/net_qos.go b/pkg/cloudbroker/compute/net_qos.go
index b187ad9..0dfc117 100644
--- a/pkg/cloudbroker/compute/net_qos.go
+++ b/pkg/cloudbroker/compute/net_qos.go
@@ -38,6 +38,12 @@ type NetQOSRequest struct {
EgressRate uint64 `url:"egress_rate,omitempty" json:"egress_rate,omitempty"`
}
+type wrapperNetQOSRequest struct {
+ NetQOSRequest
+
+ AsyncMode bool `url:"asyncMode"`
+}
+
// NetQOS updates compute interfaces QOS
func (c Compute) NetQOS(ctx context.Context, req NetQOSRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -45,9 +51,14 @@ func (c Compute) NetQOS(ctx context.Context, req NetQOSRequest) (bool, error) {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
+ reqWrapped := wrapperNetQOSRequest{
+ NetQOSRequest: req,
+ AsyncMode: false,
+ }
+
url := "/cloudbroker/compute/netQos"
- 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
}
@@ -59,3 +70,25 @@ func (c Compute) NetQOS(ctx context.Context, req NetQOSRequest) (bool, error) {
return result, nil
}
+
+// NetQOSAsync updates compute interfaces QOS with AsyncMode
+func (c Compute) NetQOSAsync(ctx context.Context, req NetQOSRequest) (string, error) {
+ err := validators.ValidateRequest(req)
+ if err != nil {
+ return "", validators.ValidationErrors(validators.GetErrors(err))
+ }
+
+ reqWrapped := wrapperNetQOSRequest{
+ NetQOSRequest: req,
+ AsyncMode: true,
+ }
+
+ url := "/cloudbroker/compute/netQos"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/pause.go b/pkg/cloudbroker/compute/pause.go
index e4957c7..bbedf5e 100644
--- a/pkg/cloudbroker/compute/pause.go
+++ b/pkg/cloudbroker/compute/pause.go
@@ -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 := "/cloudbroker/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 := "/cloudbroker/compute/pause"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/pfw_add.go b/pkg/cloudbroker/compute/pfw_add.go
index 44e2659..d9b05c9 100644
--- a/pkg/cloudbroker/compute/pfw_add.go
+++ b/pkg/cloudbroker/compute/pfw_add.go
@@ -35,6 +35,12 @@ type PFWAddRequest struct {
Proto string `url:"proto" json:"proto" validate:"proto"`
}
+type wrapperPFWAddRequest struct {
+ PFWAddRequest
+
+ AsyncMode bool `url:"asyncMode"`
+}
+
// PFWAdd adds port forward rule
func (c Compute) PFWAdd(ctx context.Context, req PFWAddRequest) (uint64, error) {
err := validators.ValidateRequest(req)
@@ -42,9 +48,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 := "/cloudbroker/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
}
@@ -56,3 +67,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 := "/cloudbroker/compute/pfwAdd"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/pfw_del.go b/pkg/cloudbroker/compute/pfw_del.go
index e5afe4b..1d76394 100644
--- a/pkg/cloudbroker/compute/pfw_del.go
+++ b/pkg/cloudbroker/compute/pfw_del.go
@@ -38,6 +38,12 @@ type PFWDelRequest struct {
Proto string `url:"proto,omitempty" json:"proto,omitempty" validate:"omitempty,proto"`
}
+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)
@@ -45,9 +51,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 := "/cloudbroker/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
}
@@ -59,3 +70,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 := "/cloudbroker/compute/pfwDel"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/pin_to_node.go b/pkg/cloudbroker/compute/pin_to_node.go
index ef55c0d..e78c38a 100644
--- a/pkg/cloudbroker/compute/pin_to_node.go
+++ b/pkg/cloudbroker/compute/pin_to_node.go
@@ -28,6 +28,12 @@ type PinToNodeRequest struct {
AutoStart bool `url:"autoStart" json:"autoStart"`
}
+type wrapperPinToNodeRequest struct {
+ PinToNodeRequest
+
+ AsyncMode bool `url:"asyncMode"`
+}
+
// PinToNode pins compute to current node
func (c Compute) PinToNode(ctx context.Context, req PinToNodeRequest) (uint64, error) {
err := validators.ValidateRequest(req)
@@ -35,9 +41,14 @@ func (c Compute) PinToNode(ctx context.Context, req PinToNodeRequest) (uint64, e
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
+ reqWrapped := wrapperPinToNodeRequest{
+ PinToNodeRequest: req,
+ AsyncMode: false,
+ }
+
url := "/cloudbroker/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 0, err
}
@@ -49,3 +60,25 @@ func (c Compute) PinToNode(ctx context.Context, req PinToNodeRequest) (uint64, e
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 := "/cloudbroker/compute/pin_to_node"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/power_cycle.go b/pkg/cloudbroker/compute/power_cycle.go
index 7c25360..6b40182 100644
--- a/pkg/cloudbroker/compute/power_cycle.go
+++ b/pkg/cloudbroker/compute/power_cycle.go
@@ -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 := "/cloudbroker/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 := "/cloudbroker/compute/powerCycle"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/raise_down.go b/pkg/cloudbroker/compute/raise_down.go
index 53f1d78..fa300c7 100644
--- a/pkg/cloudbroker/compute/raise_down.go
+++ b/pkg/cloudbroker/compute/raise_down.go
@@ -6,11 +6,17 @@ import (
"strconv"
)
+type wrapperRaiseDownRequest struct {
+ AsyncMode bool `url:"asyncMode"`
+}
+
// RaiseDown starting all computes in "DOWN" tech status
func (c Compute) RaiseDown(ctx context.Context) (bool, error) {
+ reqWrapped := wrapperRaiseDownRequest{AsyncMode: false}
+
url := "/cloudbroker/compute/raiseDown"
- res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, nil)
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -22,3 +28,17 @@ func (c Compute) RaiseDown(ctx context.Context) (bool, error) {
return result, nil
}
+
+// RaiseDownAsync starting all computes in "DOWN" tech status with AsyncMode
+func (c Compute) RaiseDownAsync(ctx context.Context) (string, error) {
+ reqWrapped := wrapperRaiseDownRequest{AsyncMode: true}
+
+ url := "/cloudbroker/compute/raiseDown"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/reboot.go b/pkg/cloudbroker/compute/reboot.go
index 7b174a9..98f8717 100644
--- a/pkg/cloudbroker/compute/reboot.go
+++ b/pkg/cloudbroker/compute/reboot.go
@@ -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 := "/cloudbroker/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 := "/cloudbroker/compute/reboot"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/redeploy.go b/pkg/cloudbroker/compute/redeploy.go
index 6bf4014..b83246a 100644
--- a/pkg/cloudbroker/compute/redeploy.go
+++ b/pkg/cloudbroker/compute/redeploy.go
@@ -47,6 +47,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)
@@ -54,9 +60,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 := "/cloudbroker/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
}
@@ -68,3 +79,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 := "/cloudbroker/compute/redeploy"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/reset.go b/pkg/cloudbroker/compute/reset.go
index 194f8dd..9074f99 100644
--- a/pkg/cloudbroker/compute/reset.go
+++ b/pkg/cloudbroker/compute/reset.go
@@ -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 := "/cloudbroker/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 := "/cloudbroker/compute/reset"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/resize.go b/pkg/cloudbroker/compute/resize.go
index a50268c..b54dcbd 100644
--- a/pkg/cloudbroker/compute/resize.go
+++ b/pkg/cloudbroker/compute/resize.go
@@ -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 := "/cloudbroker/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 := "/cloudbroker/compute/resize"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/restore.go b/pkg/cloudbroker/compute/restore.go
index 1310866..1e252c0 100644
--- a/pkg/cloudbroker/compute/restore.go
+++ b/pkg/cloudbroker/compute/restore.go
@@ -15,6 +15,12 @@ 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) (bool, error) {
err := validators.ValidateRequest(req)
@@ -22,9 +28,14 @@ func (c Compute) Restore(ctx context.Context, req RestoreRequest) (bool, error)
return false, validators.ValidationErrors(validators.GetErrors(err))
}
+ reqWrapped := wrapperRestoreRequest{
+ RestoreRequest: req,
+ AsyncMode: false,
+ }
+
url := "/cloudbroker/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 false, err
}
@@ -36,3 +47,25 @@ func (c Compute) Restore(ctx context.Context, req RestoreRequest) (bool, error)
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 := "/cloudbroker/compute/restore"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/resume.go b/pkg/cloudbroker/compute/resume.go
index eff98c1..dd89a95 100644
--- a/pkg/cloudbroker/compute/resume.go
+++ b/pkg/cloudbroker/compute/resume.go
@@ -15,6 +15,12 @@ type ResumeRequest struct {
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
}
+type wrapperResumeRequest struct {
+ ResumeRequest
+
+ AsyncMode bool `url:"asyncMode"`
+}
+
// Resume resumes 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 := "/cloudbroker/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 := "/cloudbroker/compute/resume"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/set_cpu_alignment_profile.go b/pkg/cloudbroker/compute/set_cpu_alignment_profile.go
new file mode 100644
index 0000000..8fb4d84
--- /dev/null
+++ b/pkg/cloudbroker/compute/set_cpu_alignment_profile.go
@@ -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 := "/cloudbroker/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
+}
diff --git a/pkg/cloudbroker/compute/snapshot_create.go b/pkg/cloudbroker/compute/snapshot_create.go
index fc969db..8ac720f 100644
--- a/pkg/cloudbroker/compute/snapshot_create.go
+++ b/pkg/cloudbroker/compute/snapshot_create.go
@@ -20,6 +20,16 @@ type SnapshotCreateRequest struct {
// Maximum length: 36 characters
// Required: true
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"`
+}
+
+type wrapperSnapshotCreateRequest struct {
+ SnapshotCreateRequest
+ AsyncMode bool `url:"asyncMode"`
}
// SnapshotCreate creates compute snapshot
@@ -29,9 +39,14 @@ func (c Compute) SnapshotCreate(ctx context.Context, req SnapshotCreateRequest)
return "", validators.ValidationErrors(validators.GetErrors(err))
}
+ reqWrapped := wrapperSnapshotCreateRequest{
+ SnapshotCreateRequest: req,
+ AsyncMode: false,
+ }
+
url := "/cloudbroker/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
}
@@ -40,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 := "/cloudbroker/compute/snapshotCreate"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/snapshot_rollback.go b/pkg/cloudbroker/compute/snapshot_rollback.go
index b72cb91..d76867c 100644
--- a/pkg/cloudbroker/compute/snapshot_rollback.go
+++ b/pkg/cloudbroker/compute/snapshot_rollback.go
@@ -17,6 +17,20 @@ 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"`
+
+ // ID of the node to rollback on
+ // Required: false
+ NodeID uint64 `url:"node_id,omitempty" json:"node_id,omitempty"`
+}
+
+type wrapperSnapshotRollbackRequest struct {
+ SnapshotRollbackRequest
+ AsyncMode bool `url:"asyncMode"`
}
// SnapshotRollback rollbacks specified compute snapshot
@@ -26,9 +40,14 @@ func (c Compute) SnapshotRollback(ctx context.Context, req SnapshotRollbackReque
return false, validators.ValidationErrors(validators.GetErrors(err))
}
+ reqWrapped := wrapperSnapshotRollbackRequest{
+ SnapshotRollbackRequest: req,
+ AsyncMode: false,
+ }
+
url := "/cloudbroker/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 +59,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 := "/cloudbroker/compute/snapshotRollback"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/start.go b/pkg/cloudbroker/compute/start.go
index 804a79d..aeeb3dd 100644
--- a/pkg/cloudbroker/compute/start.go
+++ b/pkg/cloudbroker/compute/start.go
@@ -23,6 +23,12 @@ type StartRequest struct {
NodeID uint64 `url:"node_id,omitempty" json:"node_id,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)
@@ -30,9 +36,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 := "/cloudbroker/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
}
@@ -44,3 +55,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 := "/cloudbroker/compute/start"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/stop.go b/pkg/cloudbroker/compute/stop.go
index 06b1d02..3747b84 100644
--- a/pkg/cloudbroker/compute/stop.go
+++ b/pkg/cloudbroker/compute/stop.go
@@ -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 := "/cloudbroker/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 := "/cloudbroker/compute/stop"
+
+ res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
+ if err != nil {
+ return "", err
+ }
+
+ return string(res), nil
+}
diff --git a/pkg/cloudbroker/compute/update.go b/pkg/cloudbroker/compute/update.go
index 81804c4..2dbc48c 100644
--- a/pkg/cloudbroker/compute/update.go
+++ b/pkg/cloudbroker/compute/update.go
@@ -73,6 +73,11 @@ type UpdateRequest struct {
// Priority weight of the compute: higher value means higher priority and later migration
// Required: false
Weight uint64 `url:"weight,omitempty" json:"weight,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
diff --git a/pkg/cloudbroker/disks/create.go b/pkg/cloudbroker/disks/create.go
index 13caed9..d6f33de 100644
--- a/pkg/cloudbroker/disks/create.go
+++ b/pkg/cloudbroker/disks/create.go
@@ -42,9 +42,9 @@ type CreateRequest 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"`
}
// Create creates a disk
diff --git a/pkg/cloudbroker/disks/migrate.go b/pkg/cloudbroker/disks/migrate.go
index 60ac9a2..b990b1c 100644
--- a/pkg/cloudbroker/disks/migrate.go
+++ b/pkg/cloudbroker/disks/migrate.go
@@ -21,9 +21,9 @@ type MigrateRequest struct {
// Required: true
PoolName string `url:"pool_name" json:"pool_name" validate:"required"`
- // ID if the storage policy
- // Required: false
- StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"`
+ // ID of the storage policy
+ // Required: true
+ StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
}
// Move moves disk to another sep, pool and storage policy
diff --git a/pkg/cloudbroker/disks/models.go b/pkg/cloudbroker/disks/models.go
index 59d25c0..1a4c973 100644
--- a/pkg/cloudbroker/disks/models.go
+++ b/pkg/cloudbroker/disks/models.go
@@ -53,8 +53,8 @@ type InfoDisk struct {
// Access Control Control
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"`
@@ -65,6 +65,9 @@ type InfoDisk struct {
// Computes
Computes map[string]string `json:"computes"`
+ // Computes read only
+ ComputesReadOnly map[string]bool `json:"computes_read_only"`
+
// Created time
CreatedTime uint64 `json:"createdTime"`
diff --git a/pkg/cloudbroker/disks/update.go b/pkg/cloudbroker/disks/update.go
index a329501..44d4e7f 100644
--- a/pkg/cloudbroker/disks/update.go
+++ b/pkg/cloudbroker/disks/update.go
@@ -18,9 +18,9 @@ type UpdateRequest 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"`
// Block size of disk
// Required: false
diff --git a/pkg/cloudbroker/grid/models.go b/pkg/cloudbroker/grid/models.go
index 4a4d8ca..2c8642d 100644
--- a/pkg/cloudbroker/grid/models.go
+++ b/pkg/cloudbroker/grid/models.go
@@ -46,6 +46,9 @@ type RecordResource struct {
// Number of GPU
GPU uint64 `json:"gpu"`
+ // Policies
+ Policies map[string]PolicyUsage `json:"policies"`
+
// Number of RAM
RAM uint64 `json:"ram"`
@@ -62,14 +65,17 @@ type DiskUsage struct {
DiskSizeMax float64 `json:"disksizemax"`
}
+// Policy usage details
+type PolicyUsage struct {
+ // Disk usage
+ DiskUsage
+
+ // SEPs
+ SEPs map[string]map[string]DiskUsage `json:"seps"`
+}
+
// Detailed information about grid
type RecordGrid struct {
- // CKey
- CKey string `json:"_ckey"`
-
- // Meta
- Meta []interface{} `json:"_meta"`
-
// AuthBroker
AuthBroker []interface{} `json:"authBroker"`
@@ -97,6 +103,9 @@ type RecordGrid struct {
// SDN support
SDNSupport bool `json:"sdn_support"`
+ // Is Zero Access enabled
+ ZeroAccessEnabled bool `json:"zeroaccess_enabled"`
+
// Is BRO enabled
BROEnabled bool `json:"bro_enabled"`
}
@@ -166,6 +175,15 @@ type RecordSettingsGrid struct {
//Cleanup retention period
CleanupRetentionPeriod uint64 `json:"cleanupRetentionPeriod"`
+ // CPU allocation ratio
+ CPUAllocationRatio uint64 `json:"cpu_allocation_ratio"`
+
+ // CPU allocation ratio for VMs
+ CPUAllocationRatioVM uint64 `json:"cpu_allocation_ratio_vm"`
+
+ // Custom backup path
+ CustomBackupPath []string `json:"custom_backup_path"`
+
//Docker registry
DockerRegistry DockerRegistry `json:"docker_registry"`
@@ -178,6 +196,9 @@ type RecordSettingsGrid struct {
//Healthcheck notifications
HealthcheckNotifications HealthcheckNotifications `json:"healthcheck_notifications"`
+ // Interface generation scheme
+ InterfaceGenerationScheme string `json:"interface_generation_scheme"`
+
//k8s cleanup enabled
K8sCleanupEnabled bool `json:"k8s_cleanup_enabled"`
@@ -187,12 +208,21 @@ type RecordSettingsGrid struct {
//Location url
LocationURL string `json:"location_url"`
+ // MAC address prefix
+ MACAddressPrefix string `json:"mac_address_prefix"`
+
//Net QOS
NetQOS NetQOS `json:"net_qos"`
//Networks
Networks string `json:"networks"`
+ // Node self stop timer uptime monitor
+ NodeSelfStopTimerUptimeMonitor uint64 `json:"nodeSelfStopTimerUptimeMonitor"`
+
+ // Node self stop uptime monitor
+ NodeSelfStopUptimeMonitor bool `json:"nodeSelfStopUptimeMonitor"`
+
//Prometheus
Prometheus Prometheus `json:"prometheus"`
diff --git a/pkg/cloudbroker/grid/set_cpu_allocation_ratio.go b/pkg/cloudbroker/grid/set_cpu_allocation_ratio.go
index fbdc5c8..07c870b 100644
--- a/pkg/cloudbroker/grid/set_cpu_allocation_ratio.go
+++ b/pkg/cloudbroker/grid/set_cpu_allocation_ratio.go
@@ -16,7 +16,7 @@ type SetCPUAllocationRatioRequest struct {
// Allocation ratio
// Required: true
- Ratio float64 `url:"ratio" json:"ratio" validate:"required"`
+ Ratio uint64 `url:"ratio" json:"ratio" validate:"required"`
}
// SetCPUAllocationRatio sets CPU allocation ratio
diff --git a/pkg/cloudbroker/grid/set_cpu_allocation_ratio_for_vm.go b/pkg/cloudbroker/grid/set_cpu_allocation_ratio_for_vm.go
index 84a7ca3..a7769a9 100644
--- a/pkg/cloudbroker/grid/set_cpu_allocation_ratio_for_vm.go
+++ b/pkg/cloudbroker/grid/set_cpu_allocation_ratio_for_vm.go
@@ -15,7 +15,7 @@ type SetCPUAllocationRatioForVMRequest struct {
// Default CPU allocation ratio for computes
// Required: true
- Ratio float64 `url:"ratio" json:"ratio" validate:"required"`
+ Ratio uint64 `url:"ratio" json:"ratio" validate:"required"`
}
// SetCPUAllocationRatioForVM sets CPU allocation ratio for computes
diff --git a/pkg/cloudbroker/grid/set_mem_allocation_ratio.go b/pkg/cloudbroker/grid/set_mem_allocation_ratio.go
index df15335..1bcecee 100644
--- a/pkg/cloudbroker/grid/set_mem_allocation_ratio.go
+++ b/pkg/cloudbroker/grid/set_mem_allocation_ratio.go
@@ -16,7 +16,7 @@ type SetMemAllocationRatioRequest struct {
// Allocation ratio
// Required: true
- Ratio float64 `url:"ratio" json:"ratio" validate:"required"`
+ Ratio uint64 `url:"ratio" json:"ratio" validate:"required"`
}
// SetMemAllocationRatio sets memory allocation ratio
diff --git a/pkg/cloudbroker/image/list.go b/pkg/cloudbroker/image/list.go
index 713ef65..830279b 100644
--- a/pkg/cloudbroker/image/list.go
+++ b/pkg/cloudbroker/image/list.go
@@ -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
diff --git a/pkg/cloudbroker/image/multi_image_export.go b/pkg/cloudbroker/image/multi_image_export.go
index af96074..d4ba82f 100644
--- a/pkg/cloudbroker/image/multi_image_export.go
+++ b/pkg/cloudbroker/image/multi_image_export.go
@@ -24,22 +24,22 @@ type MultiImageExportRequest struct {
}
// MultiImageExport copies a physical image from multi image to the specified pool
-func (i Image) MultiImageExport(ctx context.Context, req MultiImageExportRequest) (bool, error) {
+func (i Image) MultiImageExport(ctx context.Context, req MultiImageExportRequest) (uint64, error) {
err := validators.ValidateRequest(req)
if err != nil {
- return false, validators.ValidationErrors(validators.GetErrors(err))
+ return 0, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/image/multi_image_export"
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
- return false, err
+ return 0, err
}
- result, err := strconv.ParseBool(string(res))
+ result, err := strconv.ParseUint(string(res), 10, 64)
if err != nil {
- return false, err
+ return 0, err
}
return result, nil
diff --git a/pkg/cloudbroker/kvmx86/create.go b/pkg/cloudbroker/kvmx86/create.go
index 837e8a1..c7c2f44 100644
--- a/pkg/cloudbroker/kvmx86/create.go
+++ b/pkg/cloudbroker/kvmx86/create.go
@@ -63,9 +63,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
@@ -112,9 +112,9 @@ type DataDisk 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"`
}
// CreateRequest struct to create KVM x86 VM
@@ -233,14 +233,23 @@ type CreateRequest struct {
// Required: false
BootDiskCache string `url:"boot_disk_cache,omitempty" json:"boot_disk_cache,omitempty"`
- // Boot Disk BLK Discard
+ // Boot Disk Discard
// Required: false
- BootDiskBLKDiscard interface{} `url:"boot_disk_blkdiscard,omitempty" json:"boot_disk_blkdiscard,omitempty" validate:"omitempty,isBool"`
+ BootDiskDiscard string `url:"boot_disk_discard,omitempty" json:"boot_disk_discard,omitempty"`
// Priority weight of the VM: higher value means higher priority and later migration
// Required: false
// Default: 1
Weight uint64 `url:"weight,omitempty" json:"weight,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
@@ -268,7 +277,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 {
@@ -285,7 +294,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 {
diff --git a/pkg/cloudbroker/kvmx86/create_blank.go b/pkg/cloudbroker/kvmx86/create_blank.go
index d114112..4d15bfa 100644
--- a/pkg/cloudbroker/kvmx86/create_blank.go
+++ b/pkg/cloudbroker/kvmx86/create_blank.go
@@ -120,14 +120,23 @@ type CreateBlankRequest struct {
// Required: false
BootDiskCache string `url:"boot_disk_cache,omitempty" json:"boot_disk_cache,omitempty"`
- // Boot Disk BLK Discard
+ // Boot Disk Discard
// Required: false
- BootDiskBLKDiscard interface{} `url:"boot_disk_blkdiscard" json:"boot_disk_blkdiscard" validate:"omitempty,isBool"`
+ BootDiskDiscard string `url:"boot_disk_discard,omitempty" json:"boot_disk_discard,omitempty"`
// Priority weight of the VM: higher value means higher priority and later migration
// Required: false
// Default: 1
Weight uint64 `url:"weight,omitempty" json:"weight,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
@@ -155,7 +164,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 {
@@ -172,7 +181,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 {
diff --git a/pkg/cloudbroker/kvmx86/mass_create.go b/pkg/cloudbroker/kvmx86/mass_create.go
index a8f04b3..11c0e30 100644
--- a/pkg/cloudbroker/kvmx86/mass_create.go
+++ b/pkg/cloudbroker/kvmx86/mass_create.go
@@ -57,9 +57,9 @@ type InterfaceMassCreate 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
@@ -158,14 +158,23 @@ type MassCreateRequest struct {
// Required: false
BootDiskCache string `url:"boot_disk_cache,omitempty" json:"boot_disk_cache,omitempty"`
- // Boot Disk BLK Discard
+ // Boot Disk Discard
// Required: false
- BootDiskBLKDiscard interface{} `url:"boot_disk_blkdiscard" json:"boot_disk_blkdiscard" validate:"omitempty,isBool"`
+ BootDiskDiscard string `url:"boot_disk_discard,omitempty" json:"boot_disk_discard,omitempty"`
// Priority weight of the VM: higher value means higher priority and later migration
// Required: false
// Default: 1
Weight uint64 `url:"weight,omitempty" json:"weight,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"`
}
type asyncWrapperMassCreateRequest struct {
@@ -198,7 +207,7 @@ func (k KVMX86) MassCreate(ctx context.Context, req MassCreateRequest) ([]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 {
@@ -215,7 +224,7 @@ func (k KVMX86) MassCreate(ctx context.Context, req MassCreateRequest) ([]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 {
@@ -262,7 +271,7 @@ func (k KVMX86) MassCreateAsync(ctx context.Context, req MassCreateRequest) (str
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 {
@@ -279,7 +288,7 @@ func (k KVMX86) MassCreateAsync(ctx context.Context, req MassCreateRequest) (str
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 {
diff --git a/pkg/cloudbroker/node/get_network_info.go b/pkg/cloudbroker/node/get_network_info.go
new file mode 100644
index 0000000..e2f13f8
--- /dev/null
+++ b/pkg/cloudbroker/node/get_network_info.go
@@ -0,0 +1,46 @@
+package node
+
+import (
+ "context"
+ "encoding/json"
+ "net/http"
+
+ "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
+)
+
+// GetNetworkInfoRequest struct to get network information of a node
+type GetNetworkInfoRequest struct {
+ // Node ID
+ // Required: true
+ NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
+}
+
+// GetNetworkInfo gets network information of a node as a RecordNodeNetworkInfo struct
+func (n Node) GetNetworkInfo(ctx context.Context, req GetNetworkInfoRequest) (*RecordNodeNetworkInfo, error) {
+ res, err := n.GetNetworkInfoRaw(ctx, req)
+ if err != nil {
+ return nil, err
+ }
+
+ info := RecordNodeNetworkInfo{}
+
+ err = json.Unmarshal(res, &info)
+ if err != nil {
+ return nil, err
+ }
+
+ return &info, nil
+}
+
+// GetNetworkInfoRaw gets network information of a node as an array of bytes
+func (n Node) GetNetworkInfoRaw(ctx context.Context, req GetNetworkInfoRequest) ([]byte, error) {
+ err := validators.ValidateRequest(req)
+ if err != nil {
+ return nil, validators.ValidationErrors(validators.GetErrors(err))
+ }
+
+ url := "/cloudbroker/node/get_network_info"
+
+ res, err := n.client.DecortApiCall(ctx, http.MethodGet, url, req)
+ return res, err
+}
diff --git a/pkg/cloudbroker/node/get_pci_devices.go b/pkg/cloudbroker/node/get_pci_devices.go
new file mode 100644
index 0000000..e829c00
--- /dev/null
+++ b/pkg/cloudbroker/node/get_pci_devices.go
@@ -0,0 +1,62 @@
+package node
+
+import (
+ "context"
+ "encoding/json"
+ "net/http"
+
+ "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
+)
+
+// GetPCIDevicesRequest struct to get list of PCI devices on a node
+type GetPCIDevicesRequest struct {
+ // Node ID
+ // Required: true
+ NodeID uint64 `url:"nid" json:"nid" validate:"required"`
+
+ // Search string
+ // Required: false
+ Search string `url:"search,omitempty" json:"search,omitempty"`
+
+ // Sort by one of supported fields, format +|-(field)
+ // Required: false
+ SortBy string `url:"sort_by,omitempty" json:"sort_by,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"`
+}
+
+// GetPCIDevices gets list of PCI devices on a node as a ListPCIDevices struct
+func (n Node) GetPCIDevices(ctx context.Context, req GetPCIDevicesRequest) (*ListPCIDevices, error) {
+ res, err := n.GetPCIDevicesRaw(ctx, req)
+ if err != nil {
+ return nil, err
+ }
+
+ list := ListPCIDevices{}
+
+ err = json.Unmarshal(res, &list)
+ if err != nil {
+ return nil, err
+ }
+
+ return &list, nil
+}
+
+// GetPCIDevicesRaw gets list of PCI devices on a node as an array of bytes
+func (n Node) GetPCIDevicesRaw(ctx context.Context, req GetPCIDevicesRequest) ([]byte, error) {
+ err := validators.ValidateRequest(req)
+ if err != nil {
+ return nil, validators.ValidationErrors(validators.GetErrors(err))
+ }
+
+ url := "/cloudbroker/node/get_pci_devices"
+
+ res, err := n.client.DecortApiCall(ctx, http.MethodGet, url, req)
+ return res, err
+}
diff --git a/pkg/cloudbroker/node/models.go b/pkg/cloudbroker/node/models.go
index 1185041..e35e502 100644
--- a/pkg/cloudbroker/node/models.go
+++ b/pkg/cloudbroker/node/models.go
@@ -9,7 +9,7 @@ type RecordNode struct {
CpuInfo CpuInfo `json:"cpuInfo"`
// CPU Allocation Ratio
- CPUAllocationRatio float64 `json:"cpu_allocation_ratio"`
+ CPUAllocationRatio uint64 `json:"cpu_allocation_ratio"`
// DPDK info
DPDK DPDK `json:"dpdk"`
@@ -27,7 +27,7 @@ type RecordNode struct {
IsolatedCpus []interface{} `json:"isolatedCpus"`
// MemAllocationRatio
- MemAllocationRatio float64 `json:"mem_allocation_ratio"`
+ MemAllocationRatio uint64 `json:"mem_allocation_ratio"`
// Name
Name string `json:"name"`
@@ -120,7 +120,7 @@ type FreeResourcesInfo struct {
RAM float64 `json:"RAM"`
// VCPU
- VCPU float64 `json:"vCPUs"`
+ VCPU uint64 `json:"vCPUs"`
}
// Resources Info
@@ -303,10 +303,10 @@ type ItemNode struct {
OldCompatLVMID uint64 `json:"old_compat_lvm_id"`
// CPU Allocation ratio
- CPUAllocationRatio float64 `json:"cpu_allocation_ratio"`
+ CPUAllocationRatio uint64 `json:"cpu_allocation_ratio"`
// MemAllocationRatio
- MemAllocationRatio float64 `json:"mem_allocation_ratio"`
+ MemAllocationRatio uint64 `json:"mem_allocation_ratio"`
// Packages
Packages map[string]PackageInfo `json:"packages"`
@@ -319,6 +319,9 @@ type ItemNode struct {
// AutoStart Count
AutoStartCount uint64 `json:"autostart_count"`
+
+ // PCI devices attached to the node
+ PCIDevices []ItemPCIDevice `json:"pci_devices"`
}
type PackageInfo struct {
@@ -350,9 +353,36 @@ type ItemMemory struct {
// 1G
OneG uint64 `json:"1G"`
+ // 1G available
+ OneGAvailable uint64 `json:"1G_available"`
+
+ // 1G free
+ OneGFree uint64 `json:"1G_free"`
+
+ // 1G reserved
+ OneGReserved uint64 `json:"1G_reserved"`
+
+ // 1G used
+ OneGUsed uint64 `json:"1G_used"`
+
+ // 1G DPDK reserved
+ OneGDPDKReserved uint64 `json:"1G_dpdk_reserved"`
+
// 2M
TwoM uint64 `json:"2M"`
+ // 2M available
+ TwoMAvailable uint64 `json:"2M_available"`
+
+ // 2M free
+ TwoMFree uint64 `json:"2M_free"`
+
+ // 2M reserved
+ TwoMReserved uint64 `json:"2M_reserved"`
+
+ // 2M used
+ TwoMUsed uint64 `json:"2M_used"`
+
// Total
Total uint64 `json:"total"`
}
@@ -454,6 +484,54 @@ type Role struct {
Time uint64 `json:"time"`
}
+// PCI device info
+type ItemPCIDevice struct {
+ // Hardware path
+ HWPath string `json:"hw_path"`
+
+ // Current driver
+ CurrentDriver string `json:"current_driver"`
+
+ // NUMA node
+ NUMANode uint64 `json:"numa_node"`
+
+ // Product ID
+ ProductID string `json:"product_id"`
+
+ // Product name
+ ProductName string `json:"product_name"`
+
+ // Vendor ID
+ VendorID string `json:"vendor_id"`
+
+ // Vendor name
+ VendorName string `json:"vendor_name"`
+
+ // IOMMU group
+ IOMMUGroup uint64 `json:"iommu_group"`
+}
+
+// List of PCI devices
+type ListPCIDevices struct {
+ // Data
+ Data []ItemPCIDevice `json:"data"`
+
+ // Entry count
+ EntryCount uint64 `json:"entryCount"`
+}
+
+// Response for PCI device driver binding actions
+type RecordPCIDeviceDriver struct {
+ // Success
+ Success bool `json:"success"`
+
+ // Message
+ Message string `json:"message"`
+
+ // Result
+ Result interface{} `json:"result"`
+}
+
// Information about SSH Identity
type SSHIdentity struct {
//Host name of the client
@@ -465,3 +543,231 @@ type SSHIdentity struct {
//Array of SSH public keys of the client
PublicKeys []string `json:"public_keys"`
}
+
+// Full network configuration of a node
+type RecordNodeNetworkInfo struct {
+ // System-level information about all network interfaces on the node
+ SystemNetworksInfo map[string]SystemNetworkInfo `json:"system_networks_info"`
+
+ // Raw OVS ports data
+ OVSNetworksInfo []OVSNetworkInfo `json:"ovs_networks_info"`
+
+ // VM network interface connections
+ LibvirtNetworksInfo []LibvirtNetworkInfo `json:"libvirt_networks_info"`
+
+ // Assembled network topology of the node
+ Topology NetworkTopology `json:"topology"`
+}
+
+// System network interface
+type SystemNetworkInfo struct {
+ // MTU value
+ MTU uint64 `json:"mtu"`
+
+ // Interface link speed
+ Speed int64 `json:"speed"`
+
+ // Linux bridge ID
+ BridgeID string `json:"bridge_id"`
+
+ // Bridge port ID
+ BPortID string `json:"bport_id"`
+
+ // MAC address
+ MAC string `json:"mac"`
+}
+
+// OVS port information
+type OVSNetworkInfo struct {
+ // Bridge name
+ BridgeName string `json:"bridge_name"`
+
+ // Bridge tag
+ BridgeTag string `json:"bridge_tag"`
+
+ // Interface UUID
+ InterfaceUUID string `json:"interface_uuid"`
+
+ // Interface type
+ InterfaceType string `json:"interface_type"`
+
+ // Interface name
+ InterfaceName string `json:"interface_name"`
+
+ // Interface MTU value
+ InterfaceMTU uint64 `json:"interface_mtu"`
+
+ // Interface IP address
+ InterfaceIP string `json:"interface_ip"`
+
+ // Interface MAC address
+ InterfaceMAC string `json:"interface_mac"`
+
+ // Interface peer name
+ InterfacePeer string `json:"interface_peer"`
+}
+
+// VM network interface connection
+type LibvirtNetworkInfo struct {
+ // VM name
+ VMName string `json:"vm_name"`
+
+ // Host-side interface name used by the VM
+ Interface string `json:"interface"`
+
+ // Interface type
+ InterfaceType string `json:"interface_type"`
+
+ // Name of the bridge the VM interface is attached to
+ InterfaceSource string `json:"interface_source"`
+}
+
+// Assembled network topology of the node
+type NetworkTopology struct {
+ // Map of all network interfaces by name with their topology details and connections
+ Interfaces map[string]TopologyInterface `json:"interfaces"`
+}
+
+// Interface and its role in the network topology
+type TopologyInterface struct {
+ // Interface type
+ Type string `json:"type"`
+
+ // Interface MTU value
+ MTU uint64 `json:"mtu"`
+
+ // Interface link speed
+ Speed int64 `json:"speed"`
+
+ // Connections to VMs and to bridges
+ Connections TopologyInterfaceConnections `json:"connections"`
+
+ // VLANs associated with the interface
+ VLANs []string `json:"vlans"`
+
+ // Linux bridge ID
+ BridgeID string `json:"bridge_id"`
+
+ // Port configuration of this bridge
+ BridgeInfo *TopologyBridgeInfo `json:"bridge_info"`
+
+ // Peer bridges connected to this bridge via patch ports
+ BridgeConnections []TopologyBridgeRef `json:"bridge_connections"`
+
+ // Names of interfaces attached to this bridge as ports
+ ConnectedInterfaces []string `json:"connected_interfaces"`
+
+ // Peer interface name
+ Peer string `json:"peer"`
+
+ // OVS UUID
+ UUID string `json:"uuid"`
+}
+
+// Lists what is connected to this interface
+type TopologyInterfaceConnections struct {
+ // VMs connected to this interface
+ VMs []TopologyVMConnection `json:"vms"`
+
+ // Bridges this interface is attached to
+ Bridges []TopologyBridgeAttachment `json:"bridges"`
+}
+
+// VM connected to a bridge or interface
+type TopologyVMConnection struct {
+ // VM name
+ Name string `json:"name"`
+
+ // Host-side interface name
+ VMInterface string `json:"vm_interface"`
+
+ // VM interface type
+ VMInterfaceType string `json:"vm_interface_type"`
+
+ // Connection type
+ ConnectionType string `json:"connection_type"`
+
+ // Via bridge
+ ViaBridge string `json:"via_bridge"`
+}
+
+// How interface is attached to a bridge
+type TopologyBridgeAttachment struct {
+ // Bridge name
+ Name string `json:"name"`
+
+ // Bridge type
+ Type string `json:"type"`
+
+ // Attachment method
+ Via string `json:"via"`
+
+ // Port details
+ PortInfo *TopologyPortInfo `json:"port_info"`
+
+ // Linux bridge port ID
+ BPortID string `json:"bport_id"`
+}
+
+// Bridge port entry
+type TopologyPortInfo struct {
+ // Port name
+ Name string `json:"name"`
+
+ // Port type
+ Type string `json:"type"`
+
+ // MTU value
+ MTU uint64 `json:"mtu"`
+
+ // VLAN tag
+ VLAN string `json:"vlan"`
+
+ // OVS UUID of the port
+ UUID string `json:"uuid"`
+}
+
+// OVS bridge port configuration
+type TopologyBridgeInfo struct {
+ // Bridge type
+ Type string `json:"type"`
+
+ // List of ports on this bridge
+ Ports []TopologyBridgePort `json:"ports"`
+}
+
+// Port on an OVS bridge
+type TopologyBridgePort struct {
+ // Port name
+ Name string `json:"name"`
+
+ // Port type
+ Type string `json:"type"`
+
+ // MTU value
+ MTU uint64 `json:"mtu"`
+
+ // VLAN tag
+ VLAN string `json:"vlan"`
+
+ // UUID
+ UUID string `json:"uuid"`
+
+ // IP address
+ IP string `json:"ip"`
+
+ // MAC address
+ MAC string `json:"mac"`
+}
+
+// Peer bridge connected via a patch port
+type TopologyBridgeRef struct {
+ // Name of the peer bridge
+ Name string `json:"name"`
+
+ // Name of the patch port used to connect to the peer bridge
+ Via string `json:"via"`
+
+ // VLAN tag on the patch connection
+ VLAN string `json:"vlan"`
+}
diff --git a/pkg/cloudbroker/node/pci_device_driver_to_kernel.go b/pkg/cloudbroker/node/pci_device_driver_to_kernel.go
new file mode 100644
index 0000000..d85962a
--- /dev/null
+++ b/pkg/cloudbroker/node/pci_device_driver_to_kernel.go
@@ -0,0 +1,45 @@
+package node
+
+import (
+ "context"
+ "encoding/json"
+ "net/http"
+
+ "repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
+ "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
+)
+
+// PCIDeviceDriverToKernelRequest struct to bind PCI device driver to kernel
+type PCIDeviceDriverToKernelRequest struct {
+ // Node ID
+ // Required: true
+ NodeID uint64 `url:"nid" json:"nid" validate:"required"`
+
+ // Hardware path of the PCI device, e.g. 0000:81:00.0
+ // Required: true
+ HWPath string `url:"hw_path" json:"hw_path" validate:"required,pciDeviceHWPath"`
+}
+
+// PCIDeviceDriverToKernel binds PCI device driver to kernel
+func (n Node) PCIDeviceDriverToKernel(ctx context.Context, req PCIDeviceDriverToKernelRequest) (*RecordPCIDeviceDriver, error) {
+ err := validators.ValidateRequest(req)
+ if err != nil {
+ return nil, validators.ValidationErrors(validators.GetErrors(err))
+ }
+
+ url := "/cloudbroker/node/pci_device_driver_to_kernel"
+
+ res, err := n.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
+ if err != nil {
+ return nil, err
+ }
+
+ result := RecordPCIDeviceDriver{}
+
+ err = json.Unmarshal(res, &result)
+ if err != nil {
+ return nil, err
+ }
+
+ return &result, nil
+}
diff --git a/pkg/cloudbroker/node/pci_device_driver_to_vfio.go b/pkg/cloudbroker/node/pci_device_driver_to_vfio.go
new file mode 100644
index 0000000..c02f383
--- /dev/null
+++ b/pkg/cloudbroker/node/pci_device_driver_to_vfio.go
@@ -0,0 +1,50 @@
+package node
+
+import (
+ "context"
+ "encoding/json"
+ "net/http"
+
+ "repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
+ "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
+)
+
+// PCIDeviceDriverToVFIORequest struct to bind PCI device driver to VFIO
+type PCIDeviceDriverToVFIORequest struct {
+ // Node ID
+ // Required: true
+ NodeID uint64 `url:"nid" json:"nid" validate:"required"`
+
+ // Hardware path of the PCI device, e.g. 0000:81:00.0
+ // Required: true
+ HWPath string `url:"hw_path" json:"hw_path" validate:"required,pciDeviceHWPath"`
+
+ // Driver binding mode
+ // Required: true
+ // Possible values: safe, unsafe
+ Mode string `url:"mode" json:"mode" validate:"required,oneof=safe unsafe"`
+}
+
+// PCIDeviceDriverToVFIO binds PCI device driver to VFIO
+func (n Node) PCIDeviceDriverToVFIO(ctx context.Context, req PCIDeviceDriverToVFIORequest) (*RecordPCIDeviceDriver, error) {
+ err := validators.ValidateRequest(req)
+ if err != nil {
+ return nil, validators.ValidationErrors(validators.GetErrors(err))
+ }
+
+ url := "/cloudbroker/node/pci_device_driver_to_vfio"
+
+ res, err := n.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
+ if err != nil {
+ return nil, err
+ }
+
+ result := RecordPCIDeviceDriver{}
+
+ err = json.Unmarshal(res, &result)
+ if err != nil {
+ return nil, err
+ }
+
+ return &result, nil
+}
diff --git a/pkg/cloudbroker/node/set_cpu_allocation_ratio.go b/pkg/cloudbroker/node/set_cpu_allocation_ratio.go
index 312d59d..ad88f71 100644
--- a/pkg/cloudbroker/node/set_cpu_allocation_ratio.go
+++ b/pkg/cloudbroker/node/set_cpu_allocation_ratio.go
@@ -2,6 +2,7 @@ package node
import (
"context"
+ "encoding/json"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
@@ -15,22 +16,29 @@ type SetCpuAllocationRatioRequest struct {
// Allocation ratio (zero or positive value)
// Required: true
- Ratio float64 `url:"ratio" json:"ratio" validate:"required"`
+ Ratio uint64 `url:"ratio" json:"ratio" validate:"required"`
}
// SetCpuAllocationRatio set CPU allocation ratio
-func (i Node) SetCpuAllocationRatio(ctx context.Context, req SetCpuAllocationRatioRequest) error {
+func (i Node) SetCpuAllocationRatio(ctx context.Context, req SetCpuAllocationRatioRequest) (*ItemNode, error) {
err := validators.ValidateRequest(req)
if err != nil {
- return validators.ValidationErrors(validators.GetErrors(err))
+ return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/node/set_cpu_allocation_ratio"
- _, err = i.client.DecortApiCall(ctx, http.MethodPost, url, req)
+ res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
- return err
+ return nil, err
}
- return nil
+ info := ItemNode{}
+
+ err = json.Unmarshal(res, &info)
+ if err != nil {
+ return nil, err
+ }
+
+ return &info, nil
}
diff --git a/pkg/cloudbroker/node/set_mem_allocation_ratio.go b/pkg/cloudbroker/node/set_mem_allocation_ratio.go
index 38d732f..6dd8606 100644
--- a/pkg/cloudbroker/node/set_mem_allocation_ratio.go
+++ b/pkg/cloudbroker/node/set_mem_allocation_ratio.go
@@ -2,6 +2,7 @@ package node
import (
"context"
+ "encoding/json"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
@@ -15,22 +16,29 @@ type SetMemAllocationRatioRequest struct {
// Allocation ratio (zero or positive value)
// Required: true
- Ratio float64 `url:"ratio" json:"ratio" validate:"required"`
+ Ratio uint64 `url:"ratio" json:"ratio" validate:"required"`
}
// SetMemAllocationRatio set memory allocation ratio
-func (i Node) SetMemAllocationRatio(ctx context.Context, req SetMemAllocationRatioRequest) error {
+func (i Node) SetMemAllocationRatio(ctx context.Context, req SetMemAllocationRatioRequest) (*ItemNode, error) {
err := validators.ValidateRequest(req)
if err != nil {
- return validators.ValidationErrors(validators.GetErrors(err))
+ return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/node/set_mem_allocation_ratio"
- _, err = i.client.DecortApiCall(ctx, http.MethodPost, url, req)
+ res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
- return err
+ return nil, err
}
- return nil
+ info := ItemNode{}
+
+ err = json.Unmarshal(res, &info)
+ if err != nil {
+ return nil, err
+ }
+
+ return &info, nil
}
diff --git a/pkg/cloudbroker/resmon/get_by_compute.go b/pkg/cloudbroker/resmon/get_by_compute.go
index 03a0e10..1cab0fa 100644
--- a/pkg/cloudbroker/resmon/get_by_compute.go
+++ b/pkg/cloudbroker/resmon/get_by_compute.go
@@ -18,7 +18,7 @@ type GetByComputeRequest struct {
StartTime uint64 `url:"starttime,omitempty" json:"starttime,omitempty"`
// End of time period - unixtime
- // Required: true
+ // Required: false
EndTime uint64 `url:"endtime,omitempty" json:"endtime,omitempty"`
}
diff --git a/pkg/cloudbroker/resmon/get_by_computes.go b/pkg/cloudbroker/resmon/get_by_computes.go
index 1b82736..395a772 100644
--- a/pkg/cloudbroker/resmon/get_by_computes.go
+++ b/pkg/cloudbroker/resmon/get_by_computes.go
@@ -14,7 +14,7 @@ type GetByComputesRequest struct {
StartTime uint64 `url:"starttime,omitempty" json:"starttime,omitempty"`
// End of time period - unixtime
- // Required: true
+ // Required: false
EndTime uint64 `url:"endtime,omitempty" json:"endtime,omitempty"`
}
diff --git a/pkg/cloudbroker/resmon/get_by_grid.go b/pkg/cloudbroker/resmon/get_by_grid.go
index c7515b2..7073076 100644
--- a/pkg/cloudbroker/resmon/get_by_grid.go
+++ b/pkg/cloudbroker/resmon/get_by_grid.go
@@ -14,7 +14,7 @@ type GetByGRIDRequest struct {
StartTime uint64 `url:"starttime,omitempty" json:"starttime,omitempty"`
// End of time period - unixtime
- // Required: true
+ // Required: false
EndTime uint64 `url:"endtime,omitempty" json:"endtime,omitempty"`
}
diff --git a/pkg/cloudbroker/resmon/get_by_node.go b/pkg/cloudbroker/resmon/get_by_node.go
index fff8996..a79640e 100644
--- a/pkg/cloudbroker/resmon/get_by_node.go
+++ b/pkg/cloudbroker/resmon/get_by_node.go
@@ -18,7 +18,7 @@ type GetByNodeRequest struct {
StartTime uint64 `url:"starttime,omitempty" json:"starttime,omitempty"`
// End of time period - unixtime
- // Required: true
+ // Required: false
EndTime uint64 `url:"endtime,omitempty" json:"endtime,omitempty"`
}
diff --git a/pkg/cloudbroker/resmon/get_by_nodes.go b/pkg/cloudbroker/resmon/get_by_nodes.go
index 17cb5af..3424125 100644
--- a/pkg/cloudbroker/resmon/get_by_nodes.go
+++ b/pkg/cloudbroker/resmon/get_by_nodes.go
@@ -14,7 +14,7 @@ type GetByNodesRequest struct {
StartTime uint64 `url:"starttime,omitempty" json:"starttime,omitempty"`
// End of time period - unixtime
- // Required: true
+ // Required: false
EndTime uint64 `url:"endtime,omitempty" json:"endtime,omitempty"`
}
diff --git a/pkg/cloudbroker/rg/models.go b/pkg/cloudbroker/rg/models.go
index 3326d1d..241577f 100644
--- a/pkg/cloudbroker/rg/models.go
+++ b/pkg/cloudbroker/rg/models.go
@@ -152,7 +152,7 @@ type ItemRG 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"`
diff --git a/pkg/cloudbroker/rg/set_cpu_allocation_ratio.go b/pkg/cloudbroker/rg/set_cpu_allocation_ratio.go
index 48473b2..18a839c 100644
--- a/pkg/cloudbroker/rg/set_cpu_allocation_ratio.go
+++ b/pkg/cloudbroker/rg/set_cpu_allocation_ratio.go
@@ -15,7 +15,7 @@ type SetCPUAllocationRatioRequest struct {
// CPU allocation ratio, i.e. one pCPU = ratio*vCPU
// Required: true
- Ratio float64 `url:"ratio" json:"ratio" validate:"required"`
+ Ratio uint64 `url:"ratio" json:"ratio" validate:"required"`
}
// SetCPUAllocationRatio sets CPU allocation ratio
diff --git a/pkg/cloudbroker/sep/add_pool.go b/pkg/cloudbroker/sep/add_pool.go
index 78d69c9..f7c1dc3 100644
--- a/pkg/cloudbroker/sep/add_pool.go
+++ b/pkg/cloudbroker/sep/add_pool.go
@@ -16,7 +16,7 @@ type AddPoolRequest struct {
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
// Pool structure which contains fields such as "name", "usage_limit", "types", "system", "accessAccountIds", "accessResGroupIds". Added fields for other pool types: Des, Ovs - "uris" list of "ip, port".
- // Dorado, Tatlin no additional fields required. Hitachi - "id", "snapshotable", "snapshot_pool_id", "minLdevId", "maxLdevId", "clone_technology". Shared - "description", "wwns", "allocate_type", "stripes", "metadata_size", "metadatatalun". Local - "description", "node_consumer", "block_disk".
+ // Dorado, Tatlin - "vdisk_discard". Hitachi - "id", "snapshotable", "snapshot_pool_id", "minLdevId", "maxLdevId", "clone_technology", "vdisk_discard". Shared - "description", "wwns", "allocate_type", "stripes", "metadata_size", "metadatatalun", "vdisk_discard" Local - "description", "node_consumer", "block_disk".
// Required: true
Pool string `url:"pool" json:"pool" validate:"required"`
}
diff --git a/pkg/cloudbroker/sep/update.go b/pkg/cloudbroker/sep/update.go
new file mode 100644
index 0000000..0cfc059
--- /dev/null
+++ b/pkg/cloudbroker/sep/update.go
@@ -0,0 +1,48 @@
+package sep
+
+import (
+ "context"
+ "net/http"
+ "strconv"
+
+ "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
+)
+
+// UpdateRequest struct to update SEP object
+type UpdateRequest struct {
+ // ID of SEP to update
+ // Required: true
+ SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required,min=1"`
+
+ // New SEP name
+ // Required: false
+ // Default: null
+ SEPName string `url:"name,omitempty" json:"name,omitempty" validate:"omitempty,min=1,max=256,sepName"`
+
+ // New description
+ // Required: false
+ // Default: null
+ Description string `url:"description,omitempty" json:"description,omitempty" validate:"omitempty,max=4096,sepDescription"`
+}
+
+// Update updates SEP object
+func (s SEP) Update(ctx context.Context, req UpdateRequest) (bool, error) {
+ err := validators.ValidateRequest(req)
+ if err != nil {
+ return false, validators.ValidationErrors(validators.GetErrors(err))
+ }
+
+ url := "/cloudbroker/sep/update"
+
+ res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
+ if err != nil {
+ return false, err
+ }
+
+ result, err := strconv.ParseBool(string(res))
+ if err != nil {
+ return false, err
+ }
+
+ return result, nil
+}
diff --git a/pkg/cloudbroker/user/create.go b/pkg/cloudbroker/user/create.go
index 9a130c2..e41e054 100644
--- a/pkg/cloudbroker/user/create.go
+++ b/pkg/cloudbroker/user/create.go
@@ -18,9 +18,8 @@ type CreateRequest struct {
EmailAddress string `url:"emailaddress" json:"emailaddress" validate:"required"`
// Password of user
- // Required: false
- // Default: strongpassword
- Password string `url:"password,omitempty" json:"password,omitempty"`
+ // Required: true
+ Password string `url:"password" json:"password" validate:"required"`
// List of apiaccess groups this user belongs to.
// Required: false
diff --git a/pkg/cloudbroker/user/models.go b/pkg/cloudbroker/user/models.go
index 901be3a..78fde62 100644
--- a/pkg/cloudbroker/user/models.go
+++ b/pkg/cloudbroker/user/models.go
@@ -54,9 +54,6 @@ type ItemUser struct {
// Mobile
Mobile []interface{} `json:"mobile"`
- // Password
- Password string `json:"passwd"`
-
// Protected
Protected bool `json:"protected"`
diff --git a/pkg/cloudbroker/zone/add_cpu_alignment_profile.go b/pkg/cloudbroker/zone/add_cpu_alignment_profile.go
new file mode 100644
index 0000000..2137c9f
--- /dev/null
+++ b/pkg/cloudbroker/zone/add_cpu_alignment_profile.go
@@ -0,0 +1,51 @@
+package zone
+
+import (
+ "context"
+ "encoding/json"
+ "net/http"
+
+ "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
+)
+
+// AddCPUAlignmentProfileRequest struct to add CPU alignment profile to zone
+type AddCPUAlignmentProfileRequest struct {
+ // ID of zone
+ // Required: true
+ ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
+
+ // Hypervisor similarity in percentage
+ // Default: 70
+ // Required: false
+ HypervisorSimilarityInPercentage uint64 `url:"hypervisor_similarity_in_percentage,omitempty" json:"hypervisor_similarity_in_percentage,omitempty"`
+}
+
+// AddCPUAlignmentProfile adds CPU alignment profile to zone
+func (e Zone) AddCPUAlignmentProfile(ctx context.Context, req AddCPUAlignmentProfileRequest) ([]CpuAlignmentProfile, error) {
+ res, err := e.AddCPUAlignmentProfileRaw(ctx, req)
+ if err != nil {
+ return nil, err
+ }
+
+ var profiles []CpuAlignmentProfile
+
+ err = json.Unmarshal(res, &profiles)
+ if err != nil {
+ return nil, err
+ }
+
+ return profiles, nil
+}
+
+// AddCPUAlignmentProfileRaw adds CPU alignment profile to zone and returns the result as an array of bytes
+func (e Zone) AddCPUAlignmentProfileRaw(ctx context.Context, req AddCPUAlignmentProfileRequest) ([]byte, error) {
+ err := validators.ValidateRequest(req)
+ if err != nil {
+ return nil, validators.ValidationErrors(validators.GetErrors(err))
+ }
+
+ url := "/cloudbroker/zone/add_cpu_alignment_profile"
+
+ res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
+ return res, err
+}
diff --git a/pkg/cloudbroker/zone/delete_cpu_alignment_profile.go b/pkg/cloudbroker/zone/delete_cpu_alignment_profile.go
new file mode 100644
index 0000000..468fe77
--- /dev/null
+++ b/pkg/cloudbroker/zone/delete_cpu_alignment_profile.go
@@ -0,0 +1,38 @@
+package zone
+
+import (
+ "context"
+ "net/http"
+ "strconv"
+
+ "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
+)
+
+// DeleteCPUAlignmentProfileRequest struct to delete CPU alignment profile from zone
+type DeleteCPUAlignmentProfileRequest struct {
+ // ID of zone
+ // Required: true
+ ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
+}
+
+// DeleteCPUAlignmentProfile deletes CPU alignment profile from zone
+func (e Zone) DeleteCPUAlignmentProfile(ctx context.Context, req DeleteCPUAlignmentProfileRequest) (bool, error) {
+ err := validators.ValidateRequest(req)
+ if err != nil {
+ return false, validators.ValidationErrors(validators.GetErrors(err))
+ }
+
+ url := "/cloudbroker/zone/delete_cpu_alignment_profile"
+
+ res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
+ if err != nil {
+ return false, err
+ }
+
+ result, err := strconv.ParseBool(string(res))
+ if err != nil {
+ return false, err
+ }
+
+ return result, nil
+}
diff --git a/pkg/cloudbroker/zone/get_cpu_alignment_profile.go b/pkg/cloudbroker/zone/get_cpu_alignment_profile.go
new file mode 100644
index 0000000..46b0315
--- /dev/null
+++ b/pkg/cloudbroker/zone/get_cpu_alignment_profile.go
@@ -0,0 +1,46 @@
+package zone
+
+import (
+ "context"
+ "encoding/json"
+ "net/http"
+
+ "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
+)
+
+// GetCPUAlignmentProfileRequest struct to get CPU alignment profile of zone
+type GetCPUAlignmentProfileRequest struct {
+ // ID of zone
+ // Required: true
+ ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
+}
+
+// GetCPUAlignmentProfile gets CPU alignment profile of zone
+func (e Zone) GetCPUAlignmentProfile(ctx context.Context, req GetCPUAlignmentProfileRequest) ([]CpuAlignmentProfile, error) {
+ res, err := e.GetCPUAlignmentProfileRaw(ctx, req)
+ if err != nil {
+ return nil, err
+ }
+
+ var profiles []CpuAlignmentProfile
+
+ err = json.Unmarshal(res, &profiles)
+ if err != nil {
+ return nil, err
+ }
+
+ return profiles, nil
+}
+
+// GetCPUAlignmentProfileRaw gets CPU alignment profile of zone as an array of bytes
+func (e Zone) GetCPUAlignmentProfileRaw(ctx context.Context, req GetCPUAlignmentProfileRequest) ([]byte, error) {
+ err := validators.ValidateRequest(req)
+ if err != nil {
+ return nil, validators.ValidationErrors(validators.GetErrors(err))
+ }
+
+ url := "/cloudbroker/zone/get_cpu_alignment_profile"
+
+ res, err := e.client.DecortApiCall(ctx, http.MethodGet, url, req)
+ return res, err
+}
diff --git a/pkg/cloudbroker/zone/list_cpu_alignment_profile.go b/pkg/cloudbroker/zone/list_cpu_alignment_profile.go
new file mode 100644
index 0000000..0aac742
--- /dev/null
+++ b/pkg/cloudbroker/zone/list_cpu_alignment_profile.go
@@ -0,0 +1,45 @@
+package zone
+
+import (
+ "context"
+ "encoding/json"
+ "net/http"
+
+ "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
+)
+
+// ListCPUAlignmentProfileRequest struct to list CPU alignment profiles
+type ListCPUAlignmentProfileRequest struct {
+ // ID of zone
+ // Required: false
+ ZoneID uint64 `url:"zone_id,omitempty" json:"zone_id,omitempty"`
+}
+
+// ListCPUAlignmentProfile gets list of CPU alignment profiles
+func (e Zone) ListCPUAlignmentProfile(ctx context.Context, req ListCPUAlignmentProfileRequest) (*ListCPUAlignmentProfiles, error) {
+ res, err := e.ListCPUAlignmentProfileRaw(ctx, req)
+ if err != nil {
+ return nil, err
+ }
+
+ list := ListCPUAlignmentProfiles{}
+
+ err = json.Unmarshal(res, &list)
+ if err != nil {
+ return nil, err
+ }
+
+ return &list, nil
+}
+
+// ListCPUAlignmentProfileRaw gets list of CPU alignment profiles as an array of bytes
+func (e Zone) ListCPUAlignmentProfileRaw(ctx context.Context, req ListCPUAlignmentProfileRequest) ([]byte, error) {
+ if err := validators.ValidateRequest(req); err != nil {
+ return nil, validators.ValidationErrors(validators.GetErrors(err))
+ }
+
+ url := "/cloudbroker/zone/list_cpu_alignment_profile"
+
+ res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
+ return res, err
+}
diff --git a/pkg/cloudbroker/zone/models.go b/pkg/cloudbroker/zone/models.go
index d79ce39..306c608 100644
--- a/pkg/cloudbroker/zone/models.go
+++ b/pkg/cloudbroker/zone/models.go
@@ -1,5 +1,65 @@
package zone
+// CPU alignment profile
+type CpuAlignmentProfile struct {
+ // Profile name
+ Name string `json:"name"`
+
+ // Vendor
+ Vendor string `json:"vendor"`
+
+ // Model
+ Model string `json:"model"`
+}
+
+// CPU alignment profile candidate
+type CpuAlignmentProfileCandidate struct {
+ // Profile name
+ Name string `json:"name"`
+
+ // Vendor
+ Vendor string `json:"vendor"`
+
+ // Model
+ Model string `json:"model"`
+
+ // Count
+ Count uint64 `json:"count"`
+
+ // Percentage
+ Percentage uint64 `json:"percentage"`
+
+ // Required count
+ RequiredCount uint64 `json:"required_count"`
+}
+
+// Response for test_cpu_alignment_profile
+type TestCPUAlignmentProfileResult struct {
+ // Profiles
+ Profiles []CpuAlignmentProfile `json:"profiles"`
+
+ // Candidates
+ Candidates []CpuAlignmentProfileCandidate `json:"candidates"`
+}
+
+// Item for list_cpu_alignment_profile response
+type ItemCPUAlignmentProfile struct {
+ // Zone ID
+ ZoneID uint64 `json:"zoneId"`
+
+ // CPU alignment profiles
+ CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
+}
+
+// Response for list_cpu_alignment_profile
+type ListCPUAlignmentProfiles struct {
+ // Entry count
+ EntryCount uint64 `json:"entryCount"`
+
+ // Data
+ Data []ItemCPUAlignmentProfile `json:"data"`
+}
+
type ListZones struct {
// Entry count
EntryCount uint64 `json:"entryCount"`
@@ -96,6 +156,9 @@ type RecordZone struct {
// Domain
Domain string `json:"domain"`
+
+ // CPU alignment profiles
+ CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
}
// A zone item from a list
@@ -165,4 +228,7 @@ type ItemZone struct {
// Domain
Domain string `json:"domain"`
+
+ // CPU alignment profiles
+ CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
}
diff --git a/pkg/cloudbroker/zone/test_cpu_alignment_profile.go b/pkg/cloudbroker/zone/test_cpu_alignment_profile.go
new file mode 100644
index 0000000..9d84e52
--- /dev/null
+++ b/pkg/cloudbroker/zone/test_cpu_alignment_profile.go
@@ -0,0 +1,51 @@
+package zone
+
+import (
+ "context"
+ "encoding/json"
+ "net/http"
+
+ "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
+)
+
+// TestCPUAlignmentProfileRequest struct to test CPU alignment profile for zone
+type TestCPUAlignmentProfileRequest struct {
+ // ID of zone
+ // Required: true
+ ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
+
+ // Hypervisor similarity in percentage
+ // Default: 70
+ // Required: false
+ HypervisorSimilarityInPercentage uint64 `url:"hypervisor_similarity_in_percentage,omitempty" json:"hypervisor_similarity_in_percentage,omitempty"`
+}
+
+// TestCPUAlignmentProfile tests CPU alignment profile for zone
+func (e Zone) TestCPUAlignmentProfile(ctx context.Context, req TestCPUAlignmentProfileRequest) (*TestCPUAlignmentProfileResult, error) {
+ res, err := e.TestCPUAlignmentProfileRaw(ctx, req)
+ if err != nil {
+ return nil, err
+ }
+
+ result := TestCPUAlignmentProfileResult{}
+
+ err = json.Unmarshal(res, &result)
+ if err != nil {
+ return nil, err
+ }
+
+ return &result, nil
+}
+
+// TestCPUAlignmentProfileRaw tests CPU alignment profile for zone and returns the result as an array of bytes
+func (e Zone) TestCPUAlignmentProfileRaw(ctx context.Context, req TestCPUAlignmentProfileRequest) ([]byte, error) {
+ err := validators.ValidateRequest(req)
+ if err != nil {
+ return nil, validators.ValidationErrors(validators.GetErrors(err))
+ }
+
+ url := "/cloudbroker/zone/test_cpu_alignment_profile"
+
+ res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
+ return res, err
+}
diff --git a/pkg/sdn/logicalports/create.go b/pkg/sdn/logicalports/create.go
index 48405ba..7d45800 100644
--- a/pkg/sdn/logicalports/create.go
+++ b/pkg/sdn/logicalports/create.go
@@ -81,8 +81,8 @@ type LogicalPortAddressRequest struct {
MAC string `url:"mac,omitempty" json:"mac,omitempty"`
// Is discovered. True or False
- // Required: false
- IsDiscovered interface{} `url:"is_discovered,omitempty" json:"is_discovered,omitempty" validate:"omitempty,isBool"`
+ // Required: true
+ IsDiscovered bool `url:"is_discovered" json:"is_discovered" validate:"required"`
}
// Create creates a logical port
diff --git a/pkg/sdn/logicalports/update.go b/pkg/sdn/logicalports/update.go
index 4025300..a825fb4 100644
--- a/pkg/sdn/logicalports/update.go
+++ b/pkg/sdn/logicalports/update.go
@@ -72,6 +72,10 @@ type UpdateRequest struct {
// UpdateAddress struct representing update address
type UpdateAddress struct {
+ // ID of the address
+ // Required: true
+ ID string `url:"id" json:"id" validate:"required"`
+
// IP address
// Required: true
IP string `url:"ip" json:"ip" validate:"required"`
@@ -81,16 +85,16 @@ type UpdateAddress struct {
IPType string `url:"ip_type" json:"ip_type" validate:"required,oneof=IPv4 IPv6"`
// Is discovered. True or False
- // Required: false
- IsDiscovered interface{} `url:"is_discovered,omitempty" json:"is_discovered,omitempty" validate:"omitempty,isBool"`
+ // Required: true
+ IsDiscovered bool `url:"is_discovered" json:"is_discovered" validate:"required"`
// Is primary. True or False
// Required: true
IsPrimary interface{} `url:"is_primary" json:"is_primary" validate:"required,isBool"`
// MAC address
- // Required: false
- MAC string `url:"mac,omitempty" json:"mac,omitempty"`
+ // Required: true
+ MAC string `url:"mac" json:"mac" validate:"required"`
}
// AddAddress struct representing add address
@@ -104,8 +108,8 @@ type AddAddress struct {
IPType string `url:"ip_type" json:"ip_type" validate:"required,oneof=IPv4 IPv6"`
// Is discovered. True or False
- // Required: false
- IsDiscovered interface{} `url:"is_discovered,omitempty" json:"is_discovered,omitempty" validate:"omitempty,isBool"`
+ // Required: true
+ IsDiscovered bool `url:"is_discovered" json:"is_discovered" validate:"required"`
// Is primary. True or False
// Required: true
diff --git a/pkg/sdn/netobjgroups/list.go b/pkg/sdn/netobjgroups/list.go
index 6c397e3..86537ff 100644
--- a/pkg/sdn/netobjgroups/list.go
+++ b/pkg/sdn/netobjgroups/list.go
@@ -49,6 +49,10 @@ type ListRequest struct {
// Sort order (asc/desc)
// Required: false
SortOrder string `url:"sort_order,omitempty" json:"sort_order,omitempty"`
+
+ // Filter by type
+ // Required: false
+ Type string `url:"type,omitempty" json:"type,omitempty"`
}
// List of address pools
diff --git a/tests/platform_upgrade/cloud_test.go b/tests/platform_upgrade/cloud_test.go
index 75d615f..0c7b8f9 100644
--- a/tests/platform_upgrade/cloud_test.go
+++ b/tests/platform_upgrade/cloud_test.go
@@ -130,6 +130,12 @@ func TestGetListCloudAPI(t *testing.T) {
t.Error(err)
}
getResult("Compute get", bytes, compute.RecordCompute{}, t)
+ // GetCPUAlignmentProfile
+ bytes, err = client.CloudAPI().Compute().GetCPUAlignmentProfileRaw(context.Background(), compute.GetCPUAlignmentProfileRequest{ComputeID: id})
+ if err != nil {
+ t.Error(err)
+ }
+ getResult("Compute get_cpu_alignment_profile", bytes, compute.CPUAlignmentProfile{}, t)
} else {
t.Errorf("Can not test Compute get because compute list is empty")
}
@@ -526,6 +532,12 @@ func TestGetListCloudbroker(t *testing.T) {
t.Error(err)
}
getResult("Compute get", bytes, compute_cb.RecordCompute{}, t)
+ // GetCPUAlignmentProfile
+ bytes, err = client.CloudBroker().Compute().GetCPUAlignmentProfileRaw(context.Background(), compute_cb.GetCPUAlignmentProfileRequest{ComputeID: id})
+ if err != nil {
+ t.Error(err)
+ }
+ getResult("Compute get_cpu_alignment_profile", bytes, compute_cb.CPUAlignmentProfile{}, t)
} else {
t.Errorf("Can not test Compute get because compute list is empty")
}
@@ -706,10 +718,28 @@ func TestGetListCloudbroker(t *testing.T) {
t.Error(err)
}
getResult("Node get", bytes, node_cb.RecordNode{}, t)
+ // GetNetworkInfo
+ bytes, err = client.CloudBroker().Node().GetNetworkInfoRaw(context.Background(), node_cb.GetNetworkInfoRequest{NodeID: id})
+ if err != nil {
+ t.Error(err)
+ }
+ getResult("Node get_network_info", bytes, node_cb.RecordNodeNetworkInfo{}, t)
} else {
t.Errorf("Can not test Node get because LB list is empty")
}
+ // Node GetPCIDevices
+ if len(listNode.Data) > 0 {
+ id := listNode.Data[0].ID
+ bytes, err = client.CloudBroker().Node().GetPCIDevicesRaw(context.Background(), node_cb.GetPCIDevicesRequest{NodeID: id})
+ if err != nil {
+ t.Error(err)
+ }
+ getResult("Node PCI devices list", bytes, node_cb.ListPCIDevices{}, t)
+ } else {
+ t.Errorf("Can not test Node GetPCIDevices because node list is empty")
+ }
+
// Pcidevice
// List
bytes, err = client.CloudBroker().PCIDevice().ListRaw(context.Background(), pcidevice_cb.ListRequest{})
@@ -868,9 +898,23 @@ func TestGetListCloudbroker(t *testing.T) {
t.Error(err)
}
getResult("Zone get", bytes, zone_cb.RecordZone{}, t)
+
+ // GetCPUAlignmentProfile
+ bytes, err = client.CloudBroker().Zone().GetCPUAlignmentProfileRaw(context.Background(), zone_cb.GetCPUAlignmentProfileRequest{ZoneID: id})
+ if err != nil {
+ t.Error(err)
+ }
+ getResult("Zone get_cpu_alignment_profile", bytes, []zone_cb.CpuAlignmentProfile{}, t)
} else {
t.Errorf("Can not test Zone get because Zones list is empty")
}
+
+ // ListCPUAlignmentProfile
+ bytes, err = client.CloudBroker().Zone().ListCPUAlignmentProfileRaw(context.Background(), zone_cb.ListCPUAlignmentProfileRequest{})
+ if err != nil {
+ t.Error(err)
+ }
+ getResult("Zone list_cpu_alignment_profile", bytes, zone_cb.ListCPUAlignmentProfiles{}, t)
}
// TestGetListSDNAPI tests platforms responses vs. json tags of golang structures in cloudapi get/list methods
diff --git a/tests/platform_upgrade/request_map.go b/tests/platform_upgrade/request_map.go
index 15918b9..b487dd2 100644
--- a/tests/platform_upgrade/request_map.go
+++ b/tests/platform_upgrade/request_map.go
@@ -167,6 +167,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
"/restmachine/cloudapi/compute/createTemplate": compute.CreateTemplateRequest{},
"/restmachine/cloudapi/compute/createTemplateFromBlank": compute.CreateTemplateFromBlankRequest{},
"/restmachine/cloudapi/compute/delete": compute.DeleteRequest{},
+ "/restmachine/cloudapi/compute/delete_cpu_alignment_profile": compute.DeleteCPUAlignmentProfileRequest{},
"/restmachine/cloudapi/compute/deleteCustomFields": compute.DeleteCustomFieldsRequest{},
"/restmachine/cloudapi/compute/detachGpu": compute.DetachGPURequest{},
"/restmachine/cloudapi/compute/detachPciDevice": compute.DetachPCIDeviceRequest{},
@@ -181,6 +182,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
"/restmachine/cloudapi/compute/diskResize": compute.DiskResizeRequest{},
"/restmachine/cloudapi/compute/enable": compute.EnableRequest{},
"/restmachine/cloudapi/compute/get": compute.GetRequest{},
+ "/restmachine/cloudapi/compute/get_cpu_alignment_profile": compute.GetCPUAlignmentProfileRequest{},
"/restmachine/cloudapi/compute/getAudits": compute.GetAuditsRequest{},
"/restmachine/cloudapi/compute/getConsoleUrl": compute.GetConsoleURLRequest{},
"/restmachine/cloudapi/compute/getCustomFields": compute.GetCustomFieldsRequest{},
@@ -204,6 +206,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
"/restmachine/cloudapi/compute/resize": compute.ResizeRequest{},
"/restmachine/cloudapi/compute/restore": compute.RestoreRequest{},
"/restmachine/cloudapi/compute/resume": compute.ResumeRequest{},
+ "/restmachine/cloudapi/compute/set_cpu_alignment_profile": compute.SetCPUAlignmentProfileRequest{},
"/restmachine/cloudapi/compute/setCustomFields": compute.SetCustomFieldsRequest{},
"/restmachine/cloudapi/compute/snapshotCreate": compute.SnapshotCreateRequest{},
"/restmachine/cloudapi/compute/snapshotDelete": compute.SnapshotDeleteRequest{},
@@ -584,6 +587,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
"/restmachine/cloudbroker/compute/createTemplate": compute_cb.CreateTemplateRequest{},
"/restmachine/cloudbroker/compute/createTemplateFromBlank": compute_cb.CreateTemplateFromBlankRequest{},
"/restmachine/cloudbroker/compute/delete": compute_cb.DeleteRequest{},
+ "/restmachine/cloudbroker/compute/delete_cpu_alignment_profile": compute_cb.DeleteCPUAlignmentProfileRequest{},
"/restmachine/cloudbroker/compute/deleteCustomFields": compute_cb.DeleteCustomFieldsRequest{},
"/restmachine/cloudbroker/compute/detachGpu": compute_cb.DetachGPURequest{},
"/restmachine/cloudbroker/compute/detachPciDevice": compute_cb.DetachPCIDeviceRequest{},
@@ -598,6 +602,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
"/restmachine/cloudbroker/compute/diskQos": compute_cb.DiskQOSRequest{},
"/restmachine/cloudbroker/compute/enable": compute_cb.EnableRequest{},
"/restmachine/cloudbroker/compute/get": compute_cb.GetRequest{},
+ "/restmachine/cloudbroker/compute/get_cpu_alignment_profile": compute_cb.GetCPUAlignmentProfileRequest{},
"/restmachine/cloudbroker/compute/getAudits": compute_cb.GetAuditsRequest{},
"/restmachine/cloudbroker/compute/getConsoleUrl": compute_cb.GetConsoleURLRequest{},
"/restmachine/cloudbroker/compute/getCustomFields": compute_cb.GetCustomFieldsRequest{},
@@ -633,6 +638,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
"/restmachine/cloudbroker/compute/resize": compute_cb.ResizeRequest{},
"/restmachine/cloudbroker/compute/restore": compute_cb.RestoreRequest{},
"/restmachine/cloudbroker/compute/resume": compute_cb.ResumeRequest{},
+ "/restmachine/cloudbroker/compute/set_cpu_alignment_profile": compute_cb.SetCPUAlignmentProfileRequest{},
"/restmachine/cloudbroker/compute/setCustomFields": compute_cb.SetCustomFieldsRequest{},
"/restmachine/cloudbroker/compute/snapshotCreate": compute_cb.SnapshotCreateRequest{},
"/restmachine/cloudbroker/compute/snapshotDelete": compute_cb.SnapshotDeleteRequest{},
@@ -880,28 +886,32 @@ func getRequestsMapCloudbroker() map[string]interface{} {
"/restmachine/cloudbroker/lb/migrateToZone": lb_cb.MigrateToZoneRequest{},
// node
- "/restmachine/cloudbroker/node/add_ssh_identity": node_cb.AddSSHIdentityRequest{},
- "/restmachine/cloudbroker/node/applyIpmiAction": node_cb.ApplyIpmiActionRequest{},
- "/restmachine/cloudbroker/node/consumption": node_cb.ConsumptionRequest{},
- "/restmachine/cloudbroker/node/decommission": node_cb.DecommissionRequest{},
- "/restmachine/cloudbroker/node/enable": node_cb.EnableRequest{},
- "/restmachine/cloudbroker/node/enableNodes": node_cb.EnableNodesRequest{},
- "/restmachine/cloudbroker/node/get": node_cb.GetRequest{},
- "/restmachine/cloudbroker/node/get_ssh_identity": node_cb.GetSSHIdentityRequest{},
- "/restmachine/cloudbroker/node/list": node_cb.ListRequest{},
- "/restmachine/cloudbroker/node/maintenance": node_cb.MaintenanceRequest{},
- "/restmachine/cloudbroker/node/restrict": node_cb.RestrictRequest{},
- "/restmachine/cloudbroker/node/setCoreIsolation": node_cb.SetCoreIsolationRequest{},
- "/restmachine/cloudbroker/node/setHugePages": node_cb.SetHugePagesRequest{},
- "/restmachine/cloudbroker/node/setsriovstatus": node_cb.SetSRIOVStatusRequest{},
- "/restmachine/cloudbroker/node/setVFsNumber": node_cb.SetVFsNumberRequest{},
- "/restmachine/cloudbroker/node/update": node_cb.UpdateRequest{},
- "/restmachine/cloudbroker/node/update_description": node_cb.UpdateDescriptionRequest{},
- "/restmachine/cloudbroker/node/setVFsParams": node_cb.SetVFsParamsRequest{},
- "/restmachine/cloudbroker/node/get_logical_cores_count": node_cb.GetLogicalCoresCountRequest{},
- "/restmachine/cloudbroker/node/set_cpu_allocation_ratio": node_cb.SetCpuAllocationRatioRequest{},
- "/restmachine/cloudbroker/node/set_mem_allocation_ratio": node_cb.SetMemAllocationRatioRequest{},
- "/restmachine/cloudbroker/node/autostart": node_cb.AutoStartRequest{},
+ "/restmachine/cloudbroker/node/add_ssh_identity": node_cb.AddSSHIdentityRequest{},
+ "/restmachine/cloudbroker/node/applyIpmiAction": node_cb.ApplyIpmiActionRequest{},
+ "/restmachine/cloudbroker/node/consumption": node_cb.ConsumptionRequest{},
+ "/restmachine/cloudbroker/node/decommission": node_cb.DecommissionRequest{},
+ "/restmachine/cloudbroker/node/enable": node_cb.EnableRequest{},
+ "/restmachine/cloudbroker/node/enableNodes": node_cb.EnableNodesRequest{},
+ "/restmachine/cloudbroker/node/get": node_cb.GetRequest{},
+ "/restmachine/cloudbroker/node/get_ssh_identity": node_cb.GetSSHIdentityRequest{},
+ "/restmachine/cloudbroker/node/list": node_cb.ListRequest{},
+ "/restmachine/cloudbroker/node/maintenance": node_cb.MaintenanceRequest{},
+ "/restmachine/cloudbroker/node/restrict": node_cb.RestrictRequest{},
+ "/restmachine/cloudbroker/node/setCoreIsolation": node_cb.SetCoreIsolationRequest{},
+ "/restmachine/cloudbroker/node/setHugePages": node_cb.SetHugePagesRequest{},
+ "/restmachine/cloudbroker/node/setsriovstatus": node_cb.SetSRIOVStatusRequest{},
+ "/restmachine/cloudbroker/node/setVFsNumber": node_cb.SetVFsNumberRequest{},
+ "/restmachine/cloudbroker/node/update": node_cb.UpdateRequest{},
+ "/restmachine/cloudbroker/node/update_description": node_cb.UpdateDescriptionRequest{},
+ "/restmachine/cloudbroker/node/setVFsParams": node_cb.SetVFsParamsRequest{},
+ "/restmachine/cloudbroker/node/get_logical_cores_count": node_cb.GetLogicalCoresCountRequest{},
+ "/restmachine/cloudbroker/node/set_cpu_allocation_ratio": node_cb.SetCpuAllocationRatioRequest{},
+ "/restmachine/cloudbroker/node/set_mem_allocation_ratio": node_cb.SetMemAllocationRatioRequest{},
+ "/restmachine/cloudbroker/node/autostart": node_cb.AutoStartRequest{},
+ "/restmachine/cloudbroker/node/get_network_info": node_cb.GetNetworkInfoRequest{},
+ "/restmachine/cloudbroker/node/get_pci_devices": node_cb.GetPCIDevicesRequest{},
+ "/restmachine/cloudbroker/node/pci_device_driver_to_vfio": node_cb.PCIDeviceDriverToVFIORequest{},
+ "/restmachine/cloudbroker/node/pci_device_driver_to_kernel": node_cb.PCIDeviceDriverToKernelRequest{},
// pcidevice
"/restmachine/cloudbroker/pcidevice/create": pcidevice_cb.CreateRequest{},
@@ -1100,14 +1110,19 @@ func getRequestsMapCloudbroker() map[string]interface{} {
"/restmachine/cloudbroker/vins/migrateToZone": vins_cb.MigrateToZoneRequest{},
// zone
- "/restmachine/cloudbroker/zone/get": zone_cb.GetRequest{},
- "/restmachine/cloudbroker/zone/list": zone_cb.ListRequest{},
- "/restmachine/cloudbroker/zone/create": zone_cb.CreateRequest{},
- "/restmachine/cloudbroker/zone/delete": zone_cb.DeleteRequest{},
- "/restmachine/cloudbroker/zone/update": zone_cb.UpdateRequest{},
- "/restmachine/cloudbroker/zone/addNode": zone_cb.AddNodeRequest{},
- "/restmachine/cloudbroker/zone/delNode": zone_cb.DelNodeRequest{},
- "/restmachine/cloudbroker/zone/node_autostart": zone_cb.NodeAutoStartRequest{},
+ "/restmachine/cloudbroker/zone/get": zone_cb.GetRequest{},
+ "/restmachine/cloudbroker/zone/list": zone_cb.ListRequest{},
+ "/restmachine/cloudbroker/zone/create": zone_cb.CreateRequest{},
+ "/restmachine/cloudbroker/zone/delete": zone_cb.DeleteRequest{},
+ "/restmachine/cloudbroker/zone/update": zone_cb.UpdateRequest{},
+ "/restmachine/cloudbroker/zone/addNode": zone_cb.AddNodeRequest{},
+ "/restmachine/cloudbroker/zone/delNode": zone_cb.DelNodeRequest{},
+ "/restmachine/cloudbroker/zone/node_autostart": zone_cb.NodeAutoStartRequest{},
+ "/restmachine/cloudbroker/zone/add_cpu_alignment_profile": zone_cb.AddCPUAlignmentProfileRequest{},
+ "/restmachine/cloudbroker/zone/delete_cpu_alignment_profile": zone_cb.DeleteCPUAlignmentProfileRequest{},
+ "/restmachine/cloudbroker/zone/get_cpu_alignment_profile": zone_cb.GetCPUAlignmentProfileRequest{},
+ "/restmachine/cloudbroker/zone/list_cpu_alignment_profile": zone_cb.ListCPUAlignmentProfileRequest{},
+ "/restmachine/cloudbroker/zone/test_cpu_alignment_profile": zone_cb.TestCPUAlignmentProfileRequest{},
// security policy
"/sdn/security_policy/create": secpolicies.CreateRequest{},