Compare commits

...
5 Commits
Author SHA1 Message Date
aafetisov 3b0a73c424 v16.12.0 2026-11-20 17:14:41 +03:00
aafetisov ee7a8ebb55 v16.11.0 2026-11-13 16:31:52 +03:00
aafetisov 00994516ba v16.10.0
v16.10.0
2026-10-30 16:04:15 +03:00
dayterr bc8c2b40e9 v16.9.0
v16.9.0
2026-10-23 16:13:20 +03:00
aafetisov 5825bdfa9e v16.8.0 2026-10-16 15:40:34 +03:00
114 changed files with 3722 additions and 356 deletions

No files matched your search

+31 -231
View File
@@ -1,277 +1,77 @@
## Version 16.7.0
## Version 16.12.0
### Deprecated
Перечисленные методы будут удалены в `v17.0.0`
Перечисленные методы будут удалены в `v17.0`
| Метод | CloudAPI | CloudBroker |
| --- | --- | --- |
| `account/AddUser` | :heavy_check_mark: | :heavy_check_mark: |
| `account/AddUserAsync` | :heavy_check_mark: | :heavy_check_mark: |
| `account/DeleteUser` | :heavy_check_mark: | :heavy_check_mark: |
| `account/DeleteUserAsync` | :heavy_check_mark: | :heavy_check_mark: |
| `account/UpdateUser` | :heavy_check_mark: | :heavy_check_mark: |
| `account/UpdateUserAsync` | :heavy_check_mark: | :heavy_check_mark: |
| `compute/CreateTemplate` | :heavy_check_mark: | :heavy_check_mark: |
| `compute/CreateTemplateAsync` | :x: | :heavy_check_mark: |
| `compute/CreateTemplateFromBlank` | :heavy_check_mark: | :heavy_check_mark: |
| `compute/CreateTemplateFromBlankAsync` | :heavy_check_mark: | :heavy_check_mark: |
| `compute/DiskQOS` | :heavy_check_mark: | :heavy_check_mark: |
| `compute/DiskQOSAsync` | :heavy_check_mark: | :heavy_check_mark: |
| `compute/Migrate` | :x: | :heavy_check_mark: |
| `compute/AsyncMigrate` | :x: | :heavy_check_mark: |
| `compute/MigrateAbort` | :x: | :heavy_check_mark: |
| `compute/MigrateAbortAsync` | :x: | :heavy_check_mark: |
| `compute/MigrateStorage` | :x: | :heavy_check_mark: |
| `compute/MigrateStorageAbort` | :x: | :heavy_check_mark: |
| `compute/MigrateStorageAbortAsync` | :x: | :heavy_check_mark: |
| `compute/MigrateStorageCleanUp` | :x: | :heavy_check_mark: |
| `compute/MigrateStorageCleanUpAsync` | :x: | :heavy_check_mark: |
| `compute/MigrateStorageInfo` | :x: | :heavy_check_mark: |
| `compute/MigrateStorageInfoRaw` | :x: | :heavy_check_mark: |
| `compute/MigrateStorageList` | :x: | :heavy_check_mark: |
| `compute/UserGrant` | :heavy_check_mark: | :heavy_check_mark: |
| `compute/UserList` | :heavy_check_mark: | :heavy_check_mark: |
| `compute/UserRevoke` | :heavy_check_mark: | :heavy_check_mark: |
| `compute/UserUpdate` | :heavy_check_mark: | :heavy_check_mark: |
| `disks/FromPlatformDisk` | :heavy_check_mark: | :heavy_check_mark: |
| `disks/FromPlatformDiskAsync` | :heavy_check_mark: | :heavy_check_mark: |
| `rg/AccessGrant` | :heavy_check_mark: | :heavy_check_mark: |
| `rg/AccessRevoke` | :heavy_check_mark: | :heavy_check_mark: |
| `sep/ConfigFieldEdit` | :x: | :heavy_check_mark: |
| `apiaccess/userList` | :x: | :heavy_check_mark: |
### Добавлено
#### compute
#### audit
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1111 | Опциональное поле `Planned` в структуру запроса `DiskSwitchToReplicationRequest` в cloudapi/compute |
| BGOS-1111 | Опциональное поле `Planned` в структуру запроса `DiskSwitchToReplicationRequest` в cloudbroker/compute |
| BGOS-1118 | Вычисляемое поле `CRTTracking` в структуру ответа `ItemComputeDisk` в cloudapi/compute |
| BGOS-1118 | Вычисляемое поле `CRTTracking` в структуру ответа `ItemDisk` в cloudbroker/compute |
| BGOS-1120 | Структура запроса `wrapperMigrateStorageRequest` и метод `MigrateStorageAsync` в cloudbroker/compute |
| BGOS-1174 | Вычисляемое поле `TTL` в структуре ответа `RecordAudit` в cloudapi/audit |
#### disks
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1109 | Структура запроса `ReplicationManualSyncRequest` и метод `ReplicationManualSync` в cloudapi/disks |
| BGOS-1109 | Структура запроса `ReplicationSetScheduleRequest` и метод `ReplicationSetSchedule` в cloudapi/disks |
| BGOS-1109 | Структура запроса `ReplicationDisableScheduleRequest` и метод `ReplicationDisableSchedule` в cloudapi/disks |
| BGOS-1109 | Структура запроса `ReplicationSetCopyRateRequest` и метод `ReplicationSetCopyRate` в cloudapi/disks |
| BGOS-1109 | Структура запроса `ReplicationPromote` и методы `ReplicationPromote` и `ReplicationPromoteAsync` в cloudapi/disks |
| BGOS-1109 | Структура запроса `ReplicationSyncNowRequest` и метод `ReplicationSyncNow` в cloudbroker/disks |
| BGOS-1109 | Структура запроса `ReplicationEnableScheduleRequest` и метод `ReplicationEnableSchedule` в cloudbroker/disks |
| BGOS-1109 | Структура запроса `ReplicationDisableScheduleRequest` и метод `ReplicationDisableSchedule` в cloudbroker/disks |
| BGOS-1109 | Структура запроса `ReplicationSetCopyRateRequest` и метод `ReplicationSetCopyRate` в cloudbroker/disks |
| BGOS-1109 | Структура запроса `ReplicationPromote` и методы `ReplicationPromote` и `ReplicationPromoteAsync` в cloudbroker/disks |
| BGOS-1108 | Вычисляемое поле `CRTTracking` в структуру ответа `InfoDisk` в cloudbroker/disks |
| BGOS-1108 | Вычисляемое поле `CRTTracking` в структуры ответа `ItemDisk`, `ItemDiskUnattached` и `RecordDisk` в cloudapi/disks |
| BGOS-1110 | Опциональные поля `CopyRate` и `Schedule` в структуры запроса `ReplicateRequest` и `ReplicationStartRequest` в cloudbroker/disks |
| BGOS-1110 | Опциональное поле `Planned` в структуру запроса `ReplicationReverseRequest` в cloudbroker/disks |
| BGOS-1110 | Опциональные поля `CopyRate` и `Schedule` в структуры запроса `ReplicateRequest` и `ReplicationStartRequest` в cloudapi/disks |
| BGOS-1110 | Опциональное поле `Planned` в структуру запроса `ReplicationReverseRequest` в cloudapi/disks |
| BGOS-1113 | Опциональное поле `KeepCurrentIOTune` в структуру запроса `ChangeDiskStoragePolicyRequest` в cloudbroker/disks |
| BGOS-1113 | Опциональное поле `KeepCurrentIOTune` в структуру запроса `ChangeDiskStoragePolicyRequest` в cloudapi/disks |
| BGOS-1114 | Опциональные поля `TotalBytesSecMaxLength`, `ReadBytesSecMaxLength`, `WriteBytesSecMaxLength`, `TotalIOPSSecMaxLength`, `ReadIOPSSecMaxLength` и `WriteIOPSSecMaxLength` в структуру запроса `LimitIORequest` в cloudbroker/disks |
| BGOS-1114 | Опциональные поля `TotalBytesSecMaxLength`, `ReadBytesSecMaxLength`, `WriteBytesSecMaxLength`, `TotalIOPSSecMaxLength`, `ReadIOPSSecMaxLength` и `WriteIOPSSecMaxLength` в структуру запроса `LimitIORequest` в cloudapi/disks |
| BGOS-1178 | Вычисляемые поля `ReadBytesSecMaxLength`, `ReadIOPSSecMaxLength`, `TotalBytesSecMaxLength`, `TotalIOPSSecMaxLength`, `WriteBytesSecMaxLength` и `WriteIOPSSecMaxLength` в структуре ответа `IOTune` в cloudapi/disks |
| BGOS-1178 | Вычисляемые поля `ReadBytesSecMaxLength`, `ReadIOPSSecMaxLength`, `TotalBytesSecMaxLength`, `TotalIOPSSecMaxLength`, `WriteBytesSecMaxLength` и `WriteIOPSSecMaxLength` в структуре ответа `IOTune` в cloudbroker/disks |
| BGOS-1169 | Метод `ReplicationCancelSync` и структура запроса `ReplicationCancelSyncRequest` в cloudapi/disks |
| BGOS-1169 | Метод `ReplicationCancelSync` и структура запроса `ReplicationCancelSyncRequest` в cloudbroker/disks |
#### dpdknet
#### zone
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1116 | Опциональные поля `AccountAccess` и `RGAccess` в структуру запроса `ListRequest` в cloudapi/dpdknet |
#### pcidevice
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1115 | Опциональное поле `NodeID` в структуру запроса `ListRequest` в cloudbroker/pcidevice |
| BGOS-1115 | Опциональное поле `NodeID` в структуру запроса `ListRequest` в cloudapi/pcidevice |
#### SDN defsecpolicies
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1103 | Вычисляемое поле `AccessGroupName` в структуру ответа `SecurityPolicy` в sdn/defsecpolicies |
| BGOS-1103 | Вычисляемые поля `AppliedNetObjectGroups`, `DestinationNetObjectGroups`, `LoggingProfile`, `LoggingProfileID`, `SecurityRuleConditionGroups`, `SecurityRuleConditions`, `SourceNetObjectGroups` и `Type` в структуру ответа `SecurityRule` в sdn/defsecpolicies |
| BGOS-1103 | Вычисляемые поля `EthType`, `IPProto`, `TCPSrcPorts` и `UDPSrcPorts` в структуру ответа `FilterParams` в sdn/defsecpolicies |
| BGOS-1103 | Структуры ответа `AppliedNetObjectGroup`, `NetObjectGroup`, `LoggingProfile`, `SecurityRuleConditionGroup` и `SecurityRuleCondition` в sdn/defsecpolicies |
#### SDN extnet
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1105 | Вычисляемые поля `OperationStatus` и `HypervisorStatus` в структуру ответа `Status` в sdn/extnet |
| BGOS-1105 | Вычисляемое поле `OperationStatus` в структуру ответа `HypervisorStatus` в sdn/extnet |
| BGOS-1105 | Вычисляемые поля `ExternalNetworkID`, `ID` и `VersionID` в структуру ответа `ExternalNetworkPort` в sdn/extnet |
| BGOS-1105 | Вычисляемые поля `CreatedBy` и `UpdatedBy` в структуру ответа `FloatingIP` в sdn/extnet |
| BGOS-1105 | Вычисляемые поля `ExcludeFirewall` и `Labels` в структуру ответа `LogicalPort` в sdn/extnet |
| BGOS-1105 | Вычисляемые поля `L2ConnectionPort` и `Type` в структуру ответа `Segment` в sdn/extnet |
| BGOS-1105 | Обязательное поле `OperationStatus` в структуру запроса `StatusRequest` в sdn/extnet |
| BGOS-1105 | Обязательное поле `OperationStatus` в структуру запроса `HypervisorStatusRequest` в sdn/extnet |
| BGOS-1105 | Опциональные поля `CreatedBy` и `UpdatedBy` в структуру запроса `FloatingIPRequest` в sdn/extnet |
| BGOS-1105 | Обязательные поля `DisplayName` и `ExcludeFirewall` в структуру запроса `LogicalPortRequest` в sdn/extnet |
| BGOS-1105 | Опциональное поле `Labels` в структуру запроса `LogicalPortRequest` в sdn/extnet |
| BGOS-1105 | Обязательные поля `IPv4Address` и `IPv6Address` в структуру запроса `RouterPortRequest` в sdn/extnet |
| BGOS-1105 | Обязательное поле `Type` в структуру запроса `SegmentRequest` в sdn/extnet |
| BGOS-1105 | Опциональное поле `L2ConnectionPort` в структуру запроса `SegmentRequest` в sdn/extnet |
#### SDN routers
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1106 | Вычисляемое поле `OperationStatus` в структуру ответа `Status` в sdn/routers |
| BGOS-1106 | Вычисляемое поле `OperationStatus` в структуру ответа `Status` в sdn/routers/gwport |
| BGOS-1106 | Вычисляемое поле `OperationStatus` в структуру ответа `HypervisorStatus` в sdn/routers |
| BGOS-1106 | Вычисляемое поле `OperationStatus` в структуру ответа `HypervisorStatus` в sdn/routers/gwport |
| BGOS-1106 | Вычисляемые поля `ExternalNetworkID`, `ID` и `VersionID` в структуру ответа `ExternalNetworkPort` в sdn/routers |
| BGOS-1106 | Вычисляемые поля `ExternalNetworkID`, `ID` и `VersionID` в структуру ответа `ExternalNetworkPort` в sdn/routers/gwport |
| BGOS-1106 | Вычисляемые поля `CreatedBy` и `UpdatedBy` в структуру ответа `FloatingIP` в sdn/routers |
| BGOS-1106 | Вычисляемые поля `CreatedBy` и `UpdatedBy` в структуру ответа `FloatingIP` в sdn/routers/gwport |
| BGOS-1106 | Вычисляемые поля `ExcludeFirewall` и `Labels` в структуру ответа `LogicalPort` в sdn/routers |
| BGOS-1106 | Вычисляемые поля `ExcludeFirewall` и `Labels` в структуру ответа `LogicalPort` в sdn/routers/gwport |
| BGOS-1106 | Вычисляемые поля `L2ConnectionPort` и `Type` в структуру ответа `Segment` в sdn/routers |
| BGOS-1106 | Вычисляемые поля `L2ConnectionPort` и `Type` в структуру ответа `Segment` в sdn/routers/gwport |
| BGOS-1106 | Структуры ответа `ExcludeFirewall`, `Labels`, `L2ConnectionPort` и `L2ExternalNetwork` в sdn/routers |
| BGOS-1106 | Структуры ответа `ExcludeFirewall`, `Labels`, `L2ConnectionPort`, `L2ExternalNetwork` и `Router` в sdn/routers/gwport |
| BGOS-1106 | Опциональное поле `OperationStatus` в структуру запроса `ListRequest` в sdn/routers |
#### SDN secpolicies
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1104 | Вычисляемые поля `Type`, `EndDateTime`, `LockedAt`, `ScheduleCron` и `StartDateTime` в структуру ответа `SecurityPolicySummary` в sdn/secpolicies |
| BGOS-1104 | Структура ответа `AppliedNetObjectGroup` в sdn/secpolicies |
| BGOS-1104 | Вычисляемые поля `OperationStatus` и `HypervisorStatus` в структуру ответа `Status` в sdn/secpolicies |
| BGOS-1104 | Опциональное поле `SecurityRulesForCreate` в структуру запроса `CreateRequest` в sdn/secpolicies |
| BGOS-1104 | Структуры запроса `AppliedToNetObjectGroup`, `SecurityRuleForCreate`, `RuleNetObjectGroup` и `RuleFilter` в sdn/secpolicies |
| BGOS-1104 | Опциональные поля `OperationStatus` и `Type` в структуру запроса `ListRequest` в sdn/secpolicies |
| BGOS-1104 | Обязательное поле `AccessGroupID` в структуру запроса `UpdateRequest` в sdn/secpolicies |
#### vgpu
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1066 | Обязательное поле `Name` в структуру запроса `CreateRequest` в cloudbroker/vgpu |
| BGOS-1066 | Опциональное поле `Name` в структуру запроса `ListRequest` в cloudbroker/vgpu |
| BGOS-1066 | Вычисляемые поля `Name` и `NodeID` в структуру ответа `ItemVGPU` в cloudbroker/vgpu |
| BGOS-1066 | Опциональное поле `Name` в структуру запроса `ListRequest` в cloudapi/vgpu |
| BGOS-1066 | Вычисляемые поля `Name` и `NodeID` в структуру ответа `ItemVGPU` в cloudapi/vgpu |
| BGOS-1066 | Структура запроса `EditRequest` и метод `Edit` в cloudbroker/vgpu |
| BGOS-1066 | Методы `CreateAsync`, `EditAsync` и `DestroyAsync` в cloudbroker/vgpu |
#### user
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1093 | Опциональное поле `APIAccessID` в структуру запроса `ListRequest` в cloudbroker/user |
| BGOS-1175 | Вычисляемое поле `TTL` в структуры ответа `RecordZone` и `ItemZone` в cloudapi/zone |
| BGOS-1175 | Вычисляемое поле `TTL` в структуры ответа `RecordZone` и `ItemZone` в cloudbroker/zone |
### Изменено
#### compute
#### grid
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1120 | Поле `Async` с обязательного на опциональное в структуре запроса `MigrateStorageRequest` в cloudbroker/compute |
| BGOS-1120 | Тэги `url` и `json` поля `AsyncMode` с `asyncMode` на `async_mode` в структуре запроса `asyncWrapperSnapshotEvictDiskRequest` в cloudbroker/compute |
| BGOS-1172 | Тип обязательного поля `Ratio` с `uint64` на `float64` в структуре запроса `SetMemAllocationRatioRequest` в cloudbroker/grid |
#### SDN defsecpolicies
#### node
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1103 | JSON-тэг вычисляемого поля `Filter` с `filter` на `filters` и его тип с `Filter` на `[]FilterParams` в структуре ответа `SecurityRule` в sdn/defsecpolicies |
#### SDN extnet
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1105 | Тип опционального поля `VLANTag` со `string` на `uint64` в структуре запроса `CreateRequest` в sdn/extnet |
| BGOS-1105 | Тип опционального поля `VLANTag` со `string` на `uint64` в структуре запроса `ListRequest` в sdn/extnet |
| BGOS-1105 | Тип опционального поля `VLANTag` со `string` на `uint64` в структуре запроса `UpdateRequest` в sdn/extnet |
| BGOS-1105 | Допустимый диапазон опционального поля `VLANTag` с 1–4095 на 1–4094 в структуре запроса `CreateRequest` в sdn/extnet |
| BGOS-1105 | Допустимый диапазон опционального поля `VLANTag` с 1–4095 на 1–4094 в структуре запроса `UpdateRequest` в sdn/extnet |
| BGOS-1105 | Проверка диапазона 1–4094 для опционального поля `VLANTag` в структуре запроса `ListRequest` в sdn/extnet |
| BGOS-1105 | Тип вычисляемого поля `ExternalNetworkPort` со `string` на `*ExternalNetworkPort` в структуре ответа `FloatingIP` в sdn/extnet |
| BGOS-1105 | Тип вычисляемого поля `ExternalNetworkPort` с `interface{}` на `*ExternalNetworkPort` в структуре ответа `GatewayPort` в sdn/extnet |
| BGOS-1105 | Тип обязательного поля `ExternalNetworkPort` со `string` на `*ExternalNetworkPortRequest` в структуре запроса `FloatingIPRequest` в sdn/extnet |
| BGOS-1105 | Тип обязательного поля `ExternalNetworkPort` с `interface{}` на `*ExternalNetworkPortRequest` в структуре запроса `GatewayPortRequest` в sdn/extnet |
| BGOS-1105 | Тип полей `AccessGroupName`, `IPv4`, `IPv6`, `IPv6Config`, `RouterGatewayPort` и `FloatingIP` с опционального на обязательный в структуре запроса `ExternalNetworkPortRequest` в sdn/extnet |
| BGOS-1105 | Тип поля `LogicalPort` с опционального на обязательный в структуре запроса `FloatingIPRequest` в sdn/extnet |
| BGOS-1105 | Тип поля `HypervisorDisplayName` с опционального на обязательный в структуре запроса `LogicalPortRequest` в sdn/extnet |
| BGOS-1105 | Тип полей `LiveMigrationTargetHV`, `Status`, `Bindings` и `UpdatedAt` с обязательного на опциональный в структуре запроса `LogicalPortRequest` в sdn/extnet |
| BGOS-1105 | Тип полей `SegmentDisplayName`, `SegmentID` и `LogicalPortAddresses` с обязательного на опциональный в структуре запроса `PortBindingsRequest` в sdn/extnet |
| BGOS-1105 | Тип полей `MAC` и `AssignedAt` с опционального на обязательный в структуре запроса `LogicalPortAddressRequest` в sdn/extnet |
| BGOS-1105 | Тип поля `IsPrimary` с обязательного на опциональный в структуре запроса `LogicalPortAddressRequest` в sdn/extnet |
| BGOS-1105 | Тип полей `AccessGroupID`, `AccessGroupName`, `CreatedAt`, `Description`, `Enabled`, `GatewayPorts`, `Policies`, `Ports`, `Status`, `UpdatedAt` и `VersionID` с опционального на обязательный в структуре запроса `RouterRequest` в sdn/extnet |
| BGOS-1105 | Тип полей `ExternalL4PortMax`, `ExternalL4PortMin`, `ID` и `Status` с опционального на обязательный в структуре запроса `GatewayPortRequest` в sdn/extnet |
| BGOS-1105 | Тип полей `Enabled` и `ID` с опционального на обязательный в структуре запроса `RouterPolicyRequest` в sdn/extnet |
| BGOS-1105 | Тип полей `ID` и `Status` с опционального на обязательный в структуре запроса `RouterPortRequest` в sdn/extnet |
| BGOS-1105 | Тип полей `Enabled` и `ID` с опционального на обязательный в структуре запроса `SegmentRequest` в sdn/extnet |
| BGOS-1105 | Тип полей `LeaseTime` и `ServerMAC` с обязательного на опциональный в структуре запроса `DHCPv6ConfigRequest` в sdn/extnet |
| BGOS-1105 | Тип поля `ID` с опционального на обязательный в структуре запроса `EntityInfoRequest` в sdn/extnet |
#### SDN routers
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1106 | Тип вычисляемого поля `ExternalNetworkPort` со `string` на `*ExternalNetworkPort` в структуре ответа `FloatingIP` в sdn/routers |
| BGOS-1106 | Тип вычисляемого поля `ExternalNetworkPort` со `string` на `*ExternalNetworkPort` в структуре ответа `FloatingIP` в sdn/routers/gwport |
| BGOS-1106 | Тип вычисляемого поля `Router` со `string` на `*RoutersModel` в структуре ответа `FloatingIP` в sdn/routers |
| BGOS-1106 | Тип вычисляемого поля `Router` со `string` на `*Router` в структуре ответа `FloatingIP` в sdn/routers/gwport |
#### SDN secpolicies
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1104 | Вычисляемое поле `AppliedToNetObjectGroupID` переименовано в `AppliedNetObjectGroups` в структуре ответа `SecurityPolicySummary` в sdn/secpolicies |
| BGOS-1104 | Тип вычисляемого поля `AppliedNetObjectGroups` со `string` на `[]AppliedNetObjectGroup` в структуре ответа `SecurityPolicySummary` в sdn/secpolicies |
| BGOS-1104 | JSON-тэг вычисляемого поля `AppliedNetObjectGroups` с `applied_to_net_object_group_id` на `applied_net_object_groups` в структуре ответа `SecurityPolicySummary` в sdn/secpolicies |
| BGOS-1104 | Вычисляемое поле `Status` переименовано в `OperationStatus` в структуре ответа `HypervisorStatus` в sdn/secpolicies |
| BGOS-1104 | JSON-тэг вычисляемого поля `OperationStatus` с `status` на `operation_status` в структуре ответа `HypervisorStatus` в sdn/secpolicies |
| BGOS-1104 | Тип поля `AppliedToNetObjectGroupID` со `string` на `[]AppliedToNetObjectGroup` в структуре запроса `CreateRequest` в sdn/secpolicies |
| BGOS-1104 | Тэги `url` и `json` поля `AppliedToNetObjectGroupID` с `applied_to_net_object_group_id` на `applied_to_net_object_group_ids` в структуре запроса `CreateRequest` в sdn/secpolicies |
| BGOS-1104 | Тип поля `AppliedToNetObjectGroupID` с обязательного на опциональный в структуре запроса `CreateRequest` в sdn/secpolicies |
| BGOS-1104 | Тип опционального поля `AppliedToNetObjectGroupID` со `string` на `[]string` в структуре запроса `ListRequest` в sdn/secpolicies |
| BGOS-1104 | Тэги `url` и `json` опционального поля `AppliedToNetObjectGroupID` с `applied_to_net_object_group_id` на `applied_to_net_object_group_ids` в структуре запроса `ListRequest` в sdn/secpolicies |
| BGOS-1104 | Поле `AppliedToNetObjectGroupID` переименовано в `AppliedNetObjectGroups` в структуре запроса `UpdateRequest` в sdn/secpolicies |
| BGOS-1104 | Тип поля `AppliedNetObjectGroups` со `string` на `[]AppliedToNetObjectGroup` в структуре запроса `UpdateRequest` в sdn/secpolicies |
| BGOS-1104 | Тэги `url` и `json` поля `AppliedNetObjectGroups` с `applied_to_net_object_group_id` на `applied_net_object_groups` в структуре запроса `UpdateRequest` в sdn/secpolicies |
| BGOS-1104 | Тип поля `AppliedNetObjectGroups` с обязательного на опциональный в структуре запроса `UpdateRequest` в sdn/secpolicies |
| BGOS-1104 | Тип полей `Description` и `DisplayName` с опционального на обязательный в структуре запроса `CreateRequest` в sdn/secpolicies |
| BGOS-1104 | Тип полей `Description` и `DisplayName` с опционального на обязательный в структуре запроса `UpdateRequest` в sdn/secpolicies |
#### sep
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1121 | Тэги `url` и `json` поля `AsyncMode` с `asyncMode` на `async_mode` в структуре запроса `wrapperAddPoolRequest` в cloudbroker/sep |
#### vins
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1119 | Тэги `url` и `json` поля `AsyncMode` с `asyncMode` на `async_mode` в структурах запроса `asyncWrapperCreateInAccountRequest`, `asyncWrapperEnableRequest`, `asyncWrapperCreateInRgRequest`, `asyncWrapperVNFDevRedeployRequest` и `asyncWrapperVNFDevRestartRequest` в cloudapi/vins |
| BGOS-1119 | Тэги `url` и `json` `AsyncMode` с `asyncMode` на `async_mode` в структурах запроса `asyncWrapperCreateInAccountRequest`, `asyncWrapperCreateInRgRequest`, `asyncWrapperEnableRequest`, `asyncWrapperVNFDevRedeployRequest`, `asyncWrapperVNFDevRestartRequest` и `asyncWrapperVNFDevStartRequest` в cloudbroker/vins |
### Исправлено
#### SDN secpolicies
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1104 | URL метода `Get` с `/sdn/security_policies/get` на `/sdn/security_policy/get` в sdn/secpolicies |
| BGOS-1104 | Тип поля `InsertUp` с обязательного на опциональный в структуре запроса `MoveRequest` в sdn/secpolicies |
### Удалено
#### SDN defsecpolicies
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1103 | Вычисляемые поля `Description`, `LockedAt` и `Status` из структуры ответа `SecurityPolicy` в sdn/defsecpolicies |
| BGOS-1103 | Вычисляемые поля `Description`, `DestinationNetObject`, `LogName`, `LogSeverity`, `SecurityPolicyID` и `SourceNetObject` из структуры ответа `SecurityRule` в sdn/defsecpolicies |
| BGOS-1103 | Вычисляемое поле `DHCP` из структуры ответа `FilterParams` в sdn/defsecpolicies |
| BGOS-1103 | Структуры ответа `Filter`, `NetObject`, `Status` и `HypervisorStatus` в sdn/defsecpolicies |
#### SDN extnet
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1105 | Вычисляемое поле `Common` из структуры ответа `Status` в sdn/extnet |
| BGOS-1105 | Вычисляемое поле `Status` из структуры ответа `HypervisorStatus` в sdn/extnet |
| BGOS-1105 | Вычисляемое поле `IsExcludedFromFirewall` из структуры ответа `PortBindings` в sdn/extnet |
| BGOS-1105 | Обязательное поле `Common` из структуры запроса `StatusRequest` в sdn/extnet |
| BGOS-1105 | Обязательное поле `Status` из структуры запроса `HypervisorStatusRequest` в sdn/extnet |
| BGOS-1105 | Обязательное поле `RouterDisplayName` из структуры запроса `LogicalPortRequest` в sdn/extnet |
| BGOS-1105 | Обязательное поле `IsExcludedFromFirewall` из структуры запроса `PortBindingsRequest` в sdn/extnet |
| BGOS-1105 | Обязательные поля `NextIPv4Address` и `NextIPv6Address` из структуры запроса `RouterPortRequest` в sdn/extnet |
#### SDN routers
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1106 | Вычисляемое поле `Common` из структуры ответа `Status` в sdn/routers |
| BGOS-1106 | Вычисляемое поле `Common` из структуры ответа `Status` в sdn/routers/gwport |
| BGOS-1106 | Вычисляемое поле `Status` из структуры ответа `HypervisorStatus` в sdn/routers |
| BGOS-1106 | Вычисляемое поле `Status` из структуры ответа `HypervisorStatus` в sdn/routers/gwport |
| BGOS-1106 | Вычисляемое поле `IsExcludedFromFirewall` из структуры ответа `Bindings` в sdn/routers |
| BGOS-1106 | Вычисляемое поле `IsExcludedFromFirewall` из структуры ответа `Bindings` в sdn/routers/gwport |
#### SDN secpolicies
| Идентификатор задачи | Описание |
| --- | --- |
| BGOS-1104 | Вычисляемое поле `SecurityRules` из структуры ответа `SecurityPolicySummary` в sdn/secpolicies |
| BGOS-1104 | Структуры ответа `SecurityRule` и `Filter` в sdn/secpolicies |
| BGOS-1104 | Вычисляемое поле `Common` из структуры ответа `Status` в sdn/secpolicies |
| BGOS-1104 | Опциональное поле `InsertUp` из структуры запроса `UpdateRequest` в sdn/secpolicies |
| BGOS-1173 | Тип вычисляемого поля `MemAllocationRatio` с `uint64` на `float64` в структурах ответа `RecordNode` и `ItemNode` в cloudbroker/node |
| BGOS-1173 | Тип обязательного поля `Ratio` с `uint64` на `float64` в структуре запроса `SetMemAllocationRatioRequest` в cloudbroker/node |
+2
View File
@@ -139,6 +139,7 @@ go get -u repository.basistech.ru/BASIS/dynamix-golang-sdk/v16
- `Audit` - получение информации о событиях системы;
- `APIAccess` - управление доступом к API и его объектам;
- `Backup` - управление резервным копированием;
- `BasisMPM` - управление в случае нехватки памяти;
- `BService` - управление группами виртуальных машин (computes);
- `Compute` - управление виртуальными машинами (индивидуально);
- `Disks` - управление виртуальными дисками;
@@ -352,6 +353,7 @@ func main() {
- `pkg/cloudbroker/audit` - для `Audit`
- `pkg/cloudbroker/apiaccess` - для `APIAccess`
- `pkg/cloudbroker/backup` - для `Backup`
- `pkg/cloudbroker/basismpm` - для `BasisMPM`
- `pkg/cloudbroker/bservice` - для `Basic Service`
- `pkg/cloudbroker/compute` - для `Compute`
- `pkg/cloudbroker/disks` - для `Disks`
+3 -4
View File
@@ -210,7 +210,7 @@ func (dc *DecortClient) getToken(ctx context.Context) error {
}
if resp.StatusCode != 200 {
return fmt.Errorf("cannot get token: %s", tokenBytes)
return newHTTPError("cannot get token", resp.StatusCode, tokenBytes)
}
// save token in config
@@ -297,8 +297,7 @@ func (dc *DecortClient) do(req *http.Request, ctype string) ([]byte, error) {
}
// handle errors with status code other than 200
err = fmt.Errorf("%s", respBytes)
return nil, fmt.Errorf("could not execute request: %w", err)
return nil, newHTTPError("could not execute request", resp.StatusCode, respBytes)
}
// isConnectionError checks if given error falls within specific and associated connection errors
@@ -444,7 +443,7 @@ func getTokenExp(token string) (time.Time, error) {
exp, ok := claims["exp"]
if !ok {
return time.Time{}, fmt.Errorf("exp time bot found")
return time.Time{}, fmt.Errorf("exp time not found")
}
expTime := time.Unix(int64(exp.(float64)), 0)
+7 -13
View File
@@ -5,7 +5,6 @@ import (
"context"
"crypto/tls"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
@@ -127,7 +126,7 @@ func (bdc *BVSDecortClient) DecortApiCall(ctx context.Context, method, url strin
}
// get token and retry in case of access denied
if err.Error() == "access is denied" {
if HasStatusCode(err, http.StatusUnauthorized) {
_, err = bdc.GetToken(ctx)
if err != nil {
return nil, err
@@ -193,7 +192,7 @@ func (bdc *BVSDecortClient) DecortApiCallCtype(ctx context.Context, method, url,
}
// get token and retry in case of access denied
if err.Error() == "access is denied" {
if HasStatusCode(err, http.StatusUnauthorized) {
_, err = bdc.GetToken(ctx)
if err != nil {
return nil, err
@@ -243,7 +242,7 @@ func (bdc *BVSDecortClient) DecortApiCallMP(ctx context.Context, method, url str
}
// get token and retry in case of access denied
if err.Error() == "access is denied" {
if HasStatusCode(err, http.StatusUnauthorized) {
_, err = bdc.GetToken(ctx)
if err != nil {
return nil, err
@@ -287,7 +286,7 @@ func (bdc *BVSDecortClient) GetToken(ctx context.Context) (config.Token, error)
}
if resp.StatusCode != 200 {
return config.Token{}, fmt.Errorf("cannot get token: %s", tokenBytes)
return config.Token{}, newHTTPError("cannot get token", resp.StatusCode, tokenBytes)
}
// save token in config
@@ -346,7 +345,7 @@ func (bdc *BVSDecortClient) RefreshToken(ctx context.Context) (config.Token, err
}
if resp.StatusCode != 200 {
return config.Token{}, fmt.Errorf("cannot refresh token: %s", tokenBytes)
return config.Token{}, newHTTPError("cannot refresh token", resp.StatusCode, tokenBytes)
}
// save token in config
@@ -452,17 +451,12 @@ func (bdc *BVSDecortClient) do(req *http.Request, ctype string) ([]byte, error)
return nil, err
}
// handle access denied and successful request
if resp.StatusCode == 401 {
return respBytes, errors.New("access is denied")
}
if resp.StatusCode == 200 {
return respBytes, nil
}
// handle errors with other status codes
err = fmt.Errorf("%s", respBytes)
return nil, fmt.Errorf("could not execute request: %w", err)
// handle errors with status code other than 200 (401 triggers token refresh in callers)
return nil, newHTTPError("could not execute request", resp.StatusCode, respBytes)
}
func trimBVSConfig(cfg *config.BVSConfig) config.BVSConfig {
+32
View File
@@ -0,0 +1,32 @@
package decortsdk
import (
"errors"
"fmt"
"net/http"
)
// HTTPError is returned when the API responds with a non-successful status code.
type HTTPError struct {
StatusCode int
Body []byte
}
func (e *HTTPError) Error() string {
return string(e.Body)
}
// IsNotFound reports whether err contains an HTTPError with status 404.
func IsNotFound(err error) bool {
return HasStatusCode(err, http.StatusNotFound)
}
// HasStatusCode reports whether err contains an HTTPError with the given status code.
func HasStatusCode(err error, code int) bool {
var httpErr *HTTPError
return errors.As(err, &httpErr) && httpErr.StatusCode == code
}
func newHTTPError(prefix string, statusCode int, body []byte) error {
return fmt.Errorf("%s: %w", prefix, &HTTPError{StatusCode: statusCode, Body: body})
}
+87
View File
@@ -500,3 +500,90 @@ func memoryBalloonModeValidator(fe validator.FieldLevel) bool {
return IsInSlice(fieldValue, memoryBalloonModeValues)
}
func migrateV2ModeValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().String()
return IsInSlice(fieldValue, migrateV2ModeValues)
}
func migrateV2UserMatchValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().String()
return IsInSlice(fieldValue, migrateV2UserMatchValues)
}
func migrateV2StatusValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().String()
return IsInSlice(fieldValue, migrateV2StatusValues)
}
// pressureThresholdValidator checks if PressureThreshold is in range from 5 to 50
func pressureThresholdValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().Float()
return fieldValue >= float64(pressureThresholdMin) && fieldValue <= float64(pressureThresholdMax)
}
// deflateThresholdValidator checks if DeflateThreshold is in range from 10 to 70
func deflateThresholdValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().Float()
return fieldValue >= float64(deflateThresholdMin) && fieldValue <= float64(deflateThresholdMax)
}
func bufferPCTValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().Float()
return fieldValue >= float64(bufferPCTMin) && fieldValue <= float64(bufferPCTMax)
}
func guaranteedPCTValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().Float()
return fieldValue >= float64(guaranteedPCTMin) && fieldValue <= float64(guaranteedPCTMax)
}
func guaranteedABSMinValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().Uint()
return fieldValue >= uint64(guaranteedABSMinMin) && fieldValue <= uint64(guaranteedABSMinMax)
}
func shrinkThresholdPCTValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().Float()
return fieldValue >= float64(shrinkThresholdPCTMin) && fieldValue <= float64(shrinkThresholdPCTMax)
}
func balloonMaxShrinkPCTValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().Float()
return fieldValue >= float64(balloonMaxShrinkPCTMin) && fieldValue <= float64(balloonMaxShrinkPCTMax)
}
func balloonMaxGrowPCTValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().Float()
return fieldValue >= float64(balloonMaxGrowPCTMin) && fieldValue <= float64(balloonMaxGrowPCTMax)
}
func vmChangeCooldownValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().Uint()
return fieldValue >= uint64(vmChangeCooldownMin) && fieldValue <= uint64(vmChangeCooldownMax)
}
func emergencyReturnCooldownValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().Uint()
return fieldValue >= uint64(emergencyReturnCooldownMin) && fieldValue <= uint64(emergencyReturnCooldownMax)
}
func majorFaultThresholdValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().Uint()
return fieldValue >= uint64(majorFaultThresholdMin) && fieldValue <= uint64(majorFaultThresholdMax)
}
func logLevelValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().String()
return IsInSlice(fieldValue, logLevelValues)
}
func sepTypesValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().String()
return IsInSlice(fieldValue, sepTypesValues)
}
func userMatchValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().String()
return IsInSlice(fieldValue, userMatchValues)
}
+22
View File
@@ -367,6 +367,28 @@ func errorMessage(fe validator.FieldError) string {
prefix,
fe.Field(),
joinValues(sepTechStatusValues))
case "sepTypes":
return fmt.Sprintf("%s %s must be one of the following: %s",
prefix,
fe.Field(),
joinValues(sepTypesValues))
case "migrateV2UserMatch":
return fmt.Sprintf("%s %s must be one of the following: %s",
prefix,
fe.Field(),
joinValues(migrateV2UserMatchValues))
case "migrateV2Status":
return fmt.Sprintf("%s %s must be one of the following: %s",
prefix,
fe.Field(),
joinValues(migrateV2StatusValues))
case "userMatch":
return fmt.Sprintf("%s %s must be one of the following: %s",
prefix,
fe.Field(),
joinValues(userMatchValues))
}
return fe.Error()
+82
View File
@@ -101,6 +101,11 @@ func registerAllValidators(validate *validator.Validate) error {
return err
}
err = validate.RegisterValidation("userMatch", userMatchValidator)
if err != nil {
return err
}
err = validate.RegisterValidation("computeDataDisks", computeDataDisksValidator)
if err != nil {
return err
@@ -336,5 +341,82 @@ func registerAllValidators(validate *validator.Validate) error {
return err
}
err = validate.RegisterValidation("migrateV2Mode", migrateV2ModeValidator)
err = validate.RegisterValidation("pressureThreshold", pressureThresholdValidator)
if err != nil {
return err
}
err = validate.RegisterValidation("deflateThreshold", deflateThresholdValidator)
if err != nil {
return err
}
err = validate.RegisterValidation("bufferPCT", bufferPCTValidator)
if err != nil {
return err
}
err = validate.RegisterValidation("guaranteedPCT", guaranteedPCTValidator)
if err != nil {
return err
}
err = validate.RegisterValidation("guaranteedABSMin", guaranteedABSMinValidator)
if err != nil {
return err
}
err = validate.RegisterValidation("shrinkThresholdPCT", shrinkThresholdPCTValidator)
if err != nil {
return err
}
err = validate.RegisterValidation("balloonMaxShrinkPCT", balloonMaxShrinkPCTValidator)
if err != nil {
return err
}
err = validate.RegisterValidation("balloonMaxGrowPCT", balloonMaxGrowPCTValidator)
if err != nil {
return err
}
err = validate.RegisterValidation("vmChangeCooldown", vmChangeCooldownValidator)
if err != nil {
return err
}
err = validate.RegisterValidation("emergencyReturnCooldown", emergencyReturnCooldownValidator)
if err != nil {
return err
}
err = validate.RegisterValidation("majorFaultThreshold", majorFaultThresholdValidator)
if err != nil {
return err
}
err = validate.RegisterValidation("logLevel", logLevelValidator)
if err != nil {
return err
}
err = validate.RegisterValidation("sepTypes", sepTypesValidator)
if err != nil {
return err
}
err = validate.RegisterValidation("migrateV2UserMatch", migrateV2UserMatchValidator)
if err != nil {
return err
}
err = validate.RegisterValidation("migrateV2Status", migrateV2StatusValidator)
if err != nil {
return err
}
return nil
}
+46 -1
View File
@@ -63,7 +63,7 @@ var (
loaderTypeValues = []string{"linux", "windows", "unknown"}
sepTypeValues = []string{"hitachi", "dorado", "tatlin", "shared", "local", "des", "ustor"}
sepTypeValues = []string{"hitachi", "dorado", "tatlin", "shared", "local", "des", "ustor", "aerodisk"}
languageValues = []string{"ru", "en"}
@@ -84,6 +84,18 @@ var (
watchdogActionValues = []string{"reset", "shutdown", "poweroff", "pause", "none"}
memoryBalloonModeValues = []string{"auto", "legacy", "none"}
migrateV2ModeValues = []string{"compute", "disks", "compute_and_disks"}
migrateV2UserMatchValues = []string{"exact", "prefix"}
migrateV2StatusValues = []string{"QUEUED", "VALIDATING", "PREPARING", "MIGRATING", "COMPLETING", "ABORTING", "NEEDS_ATTENTION", "COMPLETED", "PARTIALLY_COMPLETED", "ABORTED", "ERROR", "RESOLVED"}
logLevelValues = []string{"DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"}
sepTypesValues = []string{"DES", "DORADO", "HITACHI", "LOCAL", "SHARED", "TATLIN", "USTOR", "AERODISK"}
userMatchValues = []string{"exact", "prefix"}
)
const (
@@ -92,4 +104,37 @@ const (
trunkTagsMin = 1
trunkTagsMax = 4095
pressureThresholdMin = 5
pressureThresholdMax = 50
deflateThresholdMin = 10
deflateThresholdMax = 70
bufferPCTMin = 5
bufferPCTMax = 50
guaranteedPCTMin = 10
guaranteedPCTMax = 50
guaranteedABSMinMin = 256
guaranteedABSMinMax = 4096
shrinkThresholdPCTMin = 30
shrinkThresholdPCTMax = 90
balloonMaxShrinkPCTMin = 5
balloonMaxShrinkPCTMax = 25
balloonMaxGrowPCTMin = 5
balloonMaxGrowPCTMax = 25
vmChangeCooldownMin = 30
vmChangeCooldownMax = 300
emergencyReturnCooldownMin = 60
emergencyReturnCooldownMax = 1800
majorFaultThresholdMin = 1
majorFaultThresholdMax = 10000
)
+2 -3
View File
@@ -210,7 +210,7 @@ func (ldc *LegacyDecortClient) getToken(ctx context.Context) error {
}
if resp.StatusCode != 200 {
return fmt.Errorf("cannot get token: %s", tokenBytes)
return newHTTPError("cannot get token", resp.StatusCode, tokenBytes)
}
// save token in config
@@ -291,8 +291,7 @@ func (ldc *LegacyDecortClient) do(req *http.Request, ctype string) ([]byte, erro
}
// handle errors with status code other than 200
err = fmt.Errorf("%s", respBytes)
return nil, fmt.Errorf("could not execute request: %w", err)
return nil, newHTTPError("could not execute request", resp.StatusCode, respBytes)
}
func trimLegacyConfig(cfg *config.LegacyConfig) config.LegacyConfig {
+34 -1
View File
@@ -17,6 +17,12 @@ type AddACLAccessRequest struct {
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
type wrapperAddACLAccessRequest struct {
AddACLAccessRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// AddACLAccess adds ACL access to an account.
func (a Account) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -26,7 +32,12 @@ func (a Account) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (boo
url := "/cloudapi/account/add_acl_access"
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
reqWrapped := wrapperAddACLAccessRequest{
AddACLAccessRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return false, err
}
@@ -38,3 +49,25 @@ func (a Account) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (boo
return result, nil
}
// AddACLAccessAsync adds ACL access to an account in async mode
func (a Account) AddACLAccessAsync(ctx context.Context, req AddACLAccessRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/account/add_acl_access"
reqWrapped := wrapperAddACLAccessRequest{
AddACLAccessRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+37 -2
View File
@@ -26,9 +26,15 @@ type AddUserRequest struct {
AccessType string `url:"accesstype" json:"accesstype" validate:"required,accessType"`
}
type wrapperAddUserRequest struct {
AddUserRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// AddUser gives a user access rights.
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (a Account) AddUser(ctx context.Context, req AddUserRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -37,7 +43,12 @@ func (a Account) AddUser(ctx context.Context, req AddUserRequest) (bool, error)
url := "/cloudapi/account/addUser"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperAddUserRequest{
AddUserRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -49,3 +60,27 @@ func (a Account) AddUser(ctx context.Context, req AddUserRequest) (bool, error)
return result, nil
}
// AddUserAsync gives a user access rights in async mode
//
// Deprecated: will be removed in SDK v17.0
func (a Account) AddUserAsync(ctx context.Context, req AddUserRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/account/addUser"
reqWrapped := wrapperAddUserRequest{
AddUserRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+34 -1
View File
@@ -16,6 +16,12 @@ type DelACLAccessRequest struct {
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
type wrapperDelACLAccessRequest struct {
DelACLAccessRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// DelACLAccess deletes ACL access from an account.
func (a Account) DeleteACLAccess(ctx context.Context, req DelACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -25,7 +31,12 @@ func (a Account) DeleteACLAccess(ctx context.Context, req DelACLAccessRequest) (
url := "/cloudapi/account/del_acl_access"
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
reqWrapped := wrapperDelACLAccessRequest{
DelACLAccessRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return false, err
}
@@ -37,3 +48,25 @@ func (a Account) DeleteACLAccess(ctx context.Context, req DelACLAccessRequest) (
return result, nil
}
// DeleteACLAccessAsync deletes ACL access from an account in async mode
func (a Account) DeleteACLAccessAsync(ctx context.Context, req DelACLAccessRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/account/del_acl_access"
reqWrapped := wrapperDelACLAccessRequest{
DelACLAccessRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+37 -2
View File
@@ -19,9 +19,15 @@ type DeleteUserRequest struct {
UserID string `url:"userId" json:"userId" validate:"required"`
}
type wrapperDeleteUserRequest struct {
DeleteUserRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// DeleteUser revokes user access from the account
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (a Account) DeleteUser(ctx context.Context, req DeleteUserRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -30,7 +36,12 @@ func (a Account) DeleteUser(ctx context.Context, req DeleteUserRequest) (bool, e
url := "/cloudapi/account/deleteUser"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperDeleteUserRequest{
DeleteUserRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -42,3 +53,27 @@ func (a Account) DeleteUser(ctx context.Context, req DeleteUserRequest) (bool, e
return result, nil
}
// DeleteUserAsync revokes user access from the account in async mode
//
// Deprecated: will be removed in SDK v17.0
func (a Account) DeleteUserAsync(ctx context.Context, req DeleteUserRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/account/deleteUser"
reqWrapped := wrapperDeleteUserRequest{
DeleteUserRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+34 -1
View File
@@ -14,6 +14,12 @@ type RestoreRequest struct {
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
}
type wrapperRestoreRequest struct {
RestoreRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// Restore restores a deleted account
func (a Account) Restore(ctx context.Context, req RestoreRequest) (string, error) {
err := validators.ValidateRequest(req)
@@ -23,10 +29,37 @@ func (a Account) Restore(ctx context.Context, req RestoreRequest) (string, error
url := "/cloudapi/account/restore"
result, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperRestoreRequest{
RestoreRequest: req,
AsyncMode: false,
}
result, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(result), nil
}
// RestoreAsync restores a deleted account in async mode
func (a Account) RestoreAsync(ctx context.Context, req RestoreRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/account/restore"
reqWrapped := wrapperRestoreRequest{
RestoreRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+34 -1
View File
@@ -56,6 +56,12 @@ type UpdateRequest struct {
DefaultZoneID uint64 `url:"defaultZoneId,omitempty" json:"defaultZoneId,omitempty"`
}
type wrapperUpdateRequest struct {
UpdateRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// Update updates an account name and resource types and limits
func (a Account) Update(ctx context.Context, req UpdateRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -65,7 +71,12 @@ func (a Account) Update(ctx context.Context, req UpdateRequest) (bool, error) {
url := "/cloudapi/account/update"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperUpdateRequest{
UpdateRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -77,3 +88,25 @@ func (a Account) Update(ctx context.Context, req UpdateRequest) (bool, error) {
return result, nil
}
// UpdateAsync updates an account name and resource types and limits in async mode
func (a Account) UpdateAsync(ctx context.Context, req UpdateRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/account/update"
reqWrapped := wrapperUpdateRequest{
UpdateRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+34 -1
View File
@@ -17,6 +17,12 @@ type UpdateACLAccessRequest struct {
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
type wrapperUpdateACLAccessRequest struct {
UpdateACLAccessRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// UpdateACLAccess updates ACL access in an account.
func (a Account) UpdateACLAccess(ctx context.Context, req UpdateACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -26,7 +32,12 @@ func (a Account) UpdateACLAccess(ctx context.Context, req UpdateACLAccessRequest
url := "/cloudapi/account/update_acl_access"
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
reqWrapped := wrapperUpdateACLAccessRequest{
UpdateACLAccessRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return false, err
}
@@ -38,3 +49,25 @@ func (a Account) UpdateACLAccess(ctx context.Context, req UpdateACLAccessRequest
return result, nil
}
// UpdateACLAccessAsync updates ACL access in an account in async mode
func (a Account) UpdateACLAccessAsync(ctx context.Context, req UpdateACLAccessRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/account/update_acl_access"
reqWrapped := wrapperUpdateACLAccessRequest{
UpdateACLAccessRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+37 -2
View File
@@ -26,9 +26,15 @@ type UpdateUserRequest struct {
AccessType string `url:"accesstype" json:"accesstype" validate:"required,accessType"`
}
type wrapperUpdateUserRequest struct {
UpdateUserRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// UpdateUser updates user access rights
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (a Account) UpdateUser(ctx context.Context, req UpdateUserRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -37,7 +43,12 @@ func (a Account) UpdateUser(ctx context.Context, req UpdateUserRequest) (bool, e
url := "/cloudapi/account/updateUser"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperUpdateUserRequest{
UpdateUserRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -49,3 +60,27 @@ func (a Account) UpdateUser(ctx context.Context, req UpdateUserRequest) (bool, e
return result, nil
}
// UpdateUserAsync updates user access rights in async mode
//
// Deprecated: will be removed in SDK v17.0
func (a Account) UpdateUserAsync(ctx context.Context, req UpdateUserRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/account/updateUser"
reqWrapped := wrapperUpdateUserRequest{
UpdateUserRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+39 -2
View File
@@ -1,8 +1,10 @@
package audit
import "encoding/json"
// Main info about audit
type RecordAudit struct {
// Arguments
// Arguments as JSON text
Arguments string `json:"args"`
// Call
@@ -14,7 +16,7 @@ type RecordAudit struct {
// Correlation ID
CorrelationID string `json:"correlation_id"`
// Kwargs
// Keyword arguments as JSON text
Kwargs string `json:"kwargs"`
// RemoteAddr
@@ -43,6 +45,38 @@ type RecordAudit struct {
// Public Session ID
PublicSessionID string `json:"public_session_id"`
// TTL
TTL string `json:"_ttl"`
}
// UnmarshalJSON accepts both JSON-encoded strings and structured arguments.
func (r *RecordAudit) UnmarshalJSON(data []byte) error {
type recordAudit RecordAudit
response := struct {
*recordAudit
Arguments auditJSONText `json:"args"`
Kwargs auditJSONText `json:"kwargs"`
}{
recordAudit: (*recordAudit)(r),
Arguments: auditJSONText{value: &r.Arguments, opening: '['},
Kwargs: auditJSONText{value: &r.Kwargs, opening: '{'},
}
return json.Unmarshal(data, &response)
}
type auditJSONText struct {
value *string
opening byte
}
func (f *auditJSONText) UnmarshalJSON(data []byte) error {
if len(data) > 0 && data[0] == f.opening {
*f.value = string(data)
return nil
}
return json.Unmarshal(data, f.value)
}
// Main info about audit
@@ -122,6 +156,9 @@ type ItemAudit struct {
// Persistent disk IDs associated with the operation
DiskIDs []uint64 `json:"disk_ids"`
// VM folder ID
VMFolderID uint64 `json:"vmfolder_id"`
// API task ID for asynchronous calls
APITask string `json:"apitask"`
}
+2
View File
@@ -26,6 +26,8 @@ type wrapperCreateTemplateRequest struct {
}
// CreateTemplate create template from compute instance
//
// Deprecated: will be removed in SDK v17.0
func (c Compute) CreateTemplate(ctx context.Context, req CreateTemplateRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -56,6 +56,8 @@ type wrapperCreateTemplateFromBlankRequest struct {
// CreateTemplateFromBlank creates template from boot disk of current compute in sync mode.
// It returns id of created compute and error.
//
// Deprecated: will be removed in SDK v17.0
func (c Compute) CreateTemplateFromBlank(ctx context.Context, req CreateTemplateFromBlankRequest) (uint64, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -84,6 +86,8 @@ func (c Compute) CreateTemplateFromBlank(ctx context.Context, req CreateTemplate
// CreateTemplateFromBlankAsync creates template from boot disk of current compute in async mode.
// It returns guid of task and error.
//
// Deprecated: will be removed in SDK v17.0
func (c Compute) CreateTemplateFromBlankAsync(ctx context.Context, req CreateTemplateFromBlankRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
+2 -2
View File
@@ -31,7 +31,7 @@ type wrapperDiskQOSRequest struct {
// DiskQOS change QoS of the disk
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) DiskQOS(ctx context.Context, req DiskQOSRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -60,7 +60,7 @@ func (c Compute) DiskQOS(ctx context.Context, req DiskQOSRequest) (bool, error)
// DiskQOSAsync changes QoS of the disk with AsyncMode
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) DiskQOSAsync(ctx context.Context, req DiskQOSRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
+1 -1
View File
@@ -29,7 +29,7 @@ type UserGrantRequest struct {
// UserGrant grants user access to the compute
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) UserGrant(ctx context.Context, req UserGrantRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
+1 -1
View File
@@ -17,7 +17,7 @@ type UserListRequest struct {
// UserList gets users list for compute
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) UserList(ctx context.Context, req UserListRequest) (*ListUsers, error) {
err := validators.ValidateRequest(req)
if err != nil {
+1 -1
View File
@@ -21,7 +21,7 @@ type UserRevokeRequest struct {
// UserRevoke revokes user access to the compute
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) UserRevoke(ctx context.Context, req UserRevokeRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
+1 -1
View File
@@ -29,7 +29,7 @@ type UserUpdateRequest struct {
// UserUpdate updates user access to the compute
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) UserUpdate(ctx context.Context, req UserUpdateRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -22,7 +22,7 @@ type ChangeDiskStoragePolicyRequest struct {
// Keep current disk I/O tune settings in the domain XML
// Required: false
// Default: false
KeepCurrentIOTune interface{} `url:"keep_current_iot,omitempty" json:"keep_current_iot,omitempty" validate:"omitempty,isBool"`
KeepCurrentIOTune interface{} `url:"keep_current_iotune,omitempty" json:"keep_current_iotune,omitempty" validate:"omitempty,isBool"`
}
type wrapperChangeDiskStoragePolicyRequest struct {
+4
View File
@@ -55,6 +55,8 @@ type wrapperFromPlatformDiskRequest struct {
// FromPlatformDisk creates template from platform disk in sync mode.
// It returns id of created disk and error.
//
// Deprecated: will be removed in SDK v17.0
func (d Disks) FromPlatformDisk(ctx context.Context, req FromPlatformDiskRequest) (uint64, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -83,6 +85,8 @@ func (d Disks) FromPlatformDisk(ctx context.Context, req FromPlatformDiskRequest
// FromPlatformDiskAsync creates template from platform disk in async mode.
// It returns guid of task and error.
//
// Deprecated: will be removed in SDK v17.0
func (d Disks) FromPlatformDiskAsync(ctx context.Context, req FromPlatformDiskRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
+48
View File
@@ -399,6 +399,24 @@ type IOTune struct {
// WriteIOPSSecMax
WriteIOPSSecMax uint64 `json:"write_iops_sec_max"`
// ReadBytesSecMaxLength
ReadBytesSecMaxLength uint64 `json:"read_bytes_sec_max_length"`
// ReadIOPSSecMaxLength
ReadIOPSSecMaxLength uint64 `json:"read_iops_sec_max_length"`
// TotalBytesSecMaxLength
TotalBytesSecMaxLength uint64 `json:"total_bytes_sec_max_length"`
// TotalIOPSSecMaxLength
TotalIOPSSecMaxLength uint64 `json:"total_iops_sec_max_length"`
// WriteBytesSecMaxLength
WriteBytesSecMaxLength uint64 `json:"write_bytes_sec_max_length"`
// WriteIOPSSecMaxLength
WriteIOPSSecMaxLength uint64 `json:"write_iops_sec_max_length"`
}
// Detailed information about disk
@@ -561,21 +579,51 @@ type RecordDisk struct {
}
type ItemReplication struct {
// Bandwidth
Bandwidth uint64 `json:"bandwidth"`
// CopyRate
CopyRate uint64 `json:"copy_rate"`
// DiskID
DiskID uint64 `json:"diskId"`
// LastSync
LastSync uint64 `json:"last_sync"`
// PairID
PairID string `json:"pair_id"`
// PoolID
PoolID string `json:"poolId"`
// ProfileID
ProfileID uint64 `json:"profile_id"`
// Role
Role string `json:"role"`
// ScheduleID
ScheduleID uint64 `json:"schedule_id"`
// ScheduleName
ScheduleName string `json:"schedule_name"`
// SelfVolumeID
SelfVolumeID string `json:"selfVolumeId"`
// Status
Status string `json:"status"`
// StorageID
StorageID string `json:"storageId"`
// Target
Target string `json:"target"`
// Type
Type string `json:"type"`
// VolumeID
VolumeID string `json:"volumeId"`
}
@@ -0,0 +1,39 @@
package disks
import (
"context"
"net/http"
"strconv"
"strings"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
type ReplicationCancelSyncRequest struct {
// Disk ID
// Required: true
DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"`
}
// ReplicationCancelSync cancels ongoing disk replication synchronization
func (d Disks) ReplicationCancelSync(ctx context.Context, req ReplicationCancelSyncRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/disks/replication_cancel_sync"
res, err := d.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(strings.TrimSpace(string(res)))
if err != nil {
return false, err
}
return result, nil
}
+139
View File
@@ -0,0 +1,139 @@
package image
import (
"context"
"encoding/json"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// CreateFromDiskRequest to create image from existing disk
type CreateFromDiskRequest struct {
// Name of the new image
// Required: true
Name string `url:"name" json:"name" validate:"required"`
// ID of the source disk to create image from
// Required: true
DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"`
// Boot type of the image (bios or uefi)
// Required: true
// Options:
// - bios
// - uefi
BootType string `url:"boot_type" json:"boot_type" validate:"required,imageBootType"`
// Type of the operating system
// Required: true
// Options:
// - linux
// - windows
// - unknown
ImageType string `url:"image_type" json:"image_type" validate:"required,imageType"`
// ID of the storage policy to apply
// Required: true
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
// Network interface naming pattern for Linux machines. eth - onboard naming, ens - PCI slot naming.
// Required: false
// Default: ens
// Options:
// - eth
// - ens
NetworkInterfaceNaming string `url:"network_interface_naming,omitempty" json:"network_interface_naming,omitempty" validate:"omitempty,networkInterfaceNaming"`
// Whether the image supports hot resize (online resizing)
// Required: false
// Default: false
HotResize interface{} `url:"hot_resize,omitempty" json:"hot_resize,omitempty" validate:"omitempty,isBool"`
// Default username for VMs created from this image
// Required: false
UserName string `url:"user_name,omitempty" json:"user_name,omitempty"`
// Default password for the default user
// Required: false
Password string `url:"password,omitempty" json:"password,omitempty"`
// Account ID to grant exclusive access to the image
// Required: false
AccountID uint64 `url:"account_id,omitempty" json:"account_id,omitempty"`
// Target SEP ID where the image will be created. If not specified, the best SEP will be selected based on storage policy.
// Required: false
SEPID uint64 `url:"sep_id,omitempty" json:"sep_id,omitempty"`
// Target pool name in the SEP. If not specified, the best pool will be selected automatically.
// Required: false
PoolName string `url:"pool_name,omitempty" json:"pool_name,omitempty"`
// Whether the image is bootable
// Required: false
// Default: true
Bootable interface{} `url:"bootable,omitempty" json:"bootable,omitempty" validate:"omitempty,isBool"`
}
type wrapperCreateFromDiskRequest struct {
CreateFromDiskRequest
AsyncMode bool `url:"async_mode" json:"async_mode" validate:"omitempty,isBool"`
}
// CreateFromDisk creates image from existing disk
func (i Image) CreateFromDisk(ctx context.Context, req CreateFromDiskRequest) (uint64, error) {
err := validators.ValidateRequest(req)
if err != nil {
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/image/create_from_disk"
aReq := wrapperCreateFromDiskRequest{
CreateFromDiskRequest: req,
AsyncMode: false,
}
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
if err != nil {
return 0, err
}
result, err := strconv.ParseUint(string(res), 10, 64)
if err != nil {
return 0, err
}
return result, nil
}
// CreateFromDiskAsync creates image from existing disk in async mode
func (i Image) CreateFromDiskAsync(ctx context.Context, req CreateFromDiskRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/image/create_from_disk"
aReq := wrapperCreateFromDiskRequest{
CreateFromDiskRequest: req,
AsyncMode: true,
}
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
if err != nil {
return "", err
}
var resp string
err = json.Unmarshal(res, &resp)
if err != nil {
return "", err
}
return resp, nil
}
+8
View File
@@ -59,6 +59,14 @@ type ListRequest struct {
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
// Sort by account ID
// Required: false
AccountID uint64 `url:"account_id,omitempty" json:"account_id,omitempty"`
// Sort by sep type
// Required: false
SEPType string `url:"sep_type,omitempty" json:"sep_type,omitempty" validate:"omitempty,sepTypes"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
+6
View File
@@ -32,6 +32,9 @@ type ItemImage struct {
// Link to
LinkTo uint64 `json:"linkTo"`
// Links to
LinksTo []uint64 `json:"linksTo"`
// Name
Name string `json:"name"`
@@ -214,4 +217,7 @@ type RecordImage struct {
// Version
Version string `json:"version"`
// Real size of the image
RealSize uint64 `json:"real_size"`
}
+30
View File
@@ -46,6 +46,12 @@ type ItemLocation struct {
// Are VM Folders enabled
VMFoldersEnabled bool `json:"vm_folders_enabled"`
// SDN Web config
SDNWeb SDNWeb `json:"sdn_web"`
// BVP Web config
BVPWeb BVPWeb `json:"bvp_web"`
}
// List of locations
@@ -56,3 +62,27 @@ type ListLocations struct {
// Entry count
EntryCount uint64 `json:"entryCount"`
}
// SDN Web config
type SDNWeb struct {
// Whether the config is enabled
Enabled bool `json:"enabled"`
// URL
URL string `json:"url"`
// Number of the port
Port uint64 `json:"port"`
}
// BVP Web config
type BVPWeb struct {
// Whether the config is enabled
Enabled bool `json:"enabled"`
// URL
URL string `json:"url"`
// Number of ther port
Port uint64 `json:"port"`
}
+1 -1
View File
@@ -28,7 +28,7 @@ type AccessGrantRequest struct {
// AccessGrant grants user or group access to the resource group as specified
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (r RG) AccessGrant(ctx context.Context, req AccessGrantRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
+1 -1
View File
@@ -21,7 +21,7 @@ type AccessRevokeRequest struct {
// AccessRevoke revokes specified user or group access from the resource group
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (r RG) AccessRevoke(ctx context.Context, req AccessRevokeRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
+44 -2
View File
@@ -22,6 +22,9 @@ type Resource struct {
// SEPs
SEPs map[string]map[string]DiskUsage `json:"seps"`
// Policies
Policies map[string]PolicyUsage `json:"policies"`
}
// Disk usage
@@ -33,6 +36,21 @@ type DiskUsage struct {
DiskSizeMax float64 `json:"disksizemax"`
}
// Policy usage
type PolicyUsage struct {
// Disk size
DiskSize float64 `json:"disksize"`
// Max disk size
DiskSizeMax float64 `json:"disksizemax"`
// Limit
Limit float64 `json:"limit"`
// SEPs
SEPs map[string]map[string]DiskUsage `json:"seps"`
}
// Information about resources
type Resources struct {
// Current information about resources
@@ -51,10 +69,31 @@ type ItemResourceConsumption struct {
Reserved Resource `json:"reserved"`
// Resource limits
ResourceLimits ResourceLimits `json:"resourceLimits"`
ResourceLimits ResourceConsumptionLimits `json:"resourceLimits"`
// Resource group ID
RGID uint64 `json:"rgid"`
RGID uint64 `json:"id"`
}
// Resource limits of resource consumption
type ResourceConsumptionLimits struct {
// CUC
CUC float64 `json:"CU_C"`
// CUD
CUD float64 `json:"CU_D"`
// CUDM
CUDM float64 `json:"CU_DM"`
// CUI
CUI float64 `json:"CU_I"`
// CUM
CUM float64 `json:"CU_M"`
// GPU units
GPUUnits float64 `json:"gpu_units"`
}
type ListResourceConsumption struct {
@@ -892,4 +931,7 @@ type RecordResourceUsage struct {
// SEPs
SEPs map[string]map[string]DiskUsage `json:"seps"`
// Policies
Policies map[string]PolicyUsage `json:"policies"`
}
+3
View File
@@ -844,6 +844,9 @@ type ItemReservation struct {
// Account ID
AccountID uint64 `json:"account_id"`
// Whether reservation is auto assignable
AutoAssignable bool `json:"auto_assignable"`
// IP
IP string `json:"ip"`
+12
View File
@@ -126,6 +126,12 @@ type RecordZone struct {
// Minimal level of logs
LoggingLevel string `json:"logging_level"`
// Timeout
TaskDiskTimeout string `json:"task_disk_timeout"`
// TTL
TTL string `json:"ttl"`
}
// A zone item from a list
@@ -213,4 +219,10 @@ type ItemZone struct {
// Minimal level of logs
LoggingLevel string `json:"logging_level"`
// Timeout
TaskDiskTimeout string `json:"task_disk_timeout"`
// TTL
TTL string `json:"ttl"`
}
+34 -1
View File
@@ -17,6 +17,12 @@ type AddACLAccessRequest struct {
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
type wrapperAddACLAccessRequest struct {
AddACLAccessRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// AddACLAccess adds ACL access to an account.
func (a Account) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -26,7 +32,12 @@ func (a Account) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (boo
url := "/cloudbroker/account/add_acl_access"
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
reqWrapped := wrapperAddACLAccessRequest{
AddACLAccessRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return false, err
}
@@ -38,3 +49,25 @@ func (a Account) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (boo
return result, nil
}
// AddACLAccessAsync adds ACL access to an account in async mode
func (a Account) AddACLAccessAsync(ctx context.Context, req AddACLAccessRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/add_acl_access"
reqWrapped := wrapperAddACLAccessRequest{
AddACLAccessRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+34 -1
View File
@@ -23,6 +23,12 @@ type AddStoragePolicyRequest struct {
Limit int `url:"limit,omitempty" json:"limit,omitempty"`
}
type wrapperAddStoragePolicyRequest struct {
AddStoragePolicyRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// AddStoragePolicy add storage policy to the account.
func (a Account) AddStoragePolicy(ctx context.Context, req AddStoragePolicyRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -32,7 +38,12 @@ func (a Account) AddStoragePolicy(ctx context.Context, req AddStoragePolicyReque
url := "/cloudbroker/account/add_storage_policy"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperAddStoragePolicyRequest{
AddStoragePolicyRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -44,3 +55,25 @@ func (a Account) AddStoragePolicy(ctx context.Context, req AddStoragePolicyReque
return result, nil
}
// AddStoragePolicyAsync add storage policy to the account in async mode
func (a Account) AddStoragePolicyAsync(ctx context.Context, req AddStoragePolicyRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/add_storage_policy"
reqWrapped := wrapperAddStoragePolicyRequest{
AddStoragePolicyRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+37 -2
View File
@@ -26,9 +26,15 @@ type AddUserRequest struct {
AccessType string `url:"accesstype" json:"accesstype" validate:"accessType"`
}
type wrapperAddUserRequest struct {
AddUserRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// AddUser gives a user access rights.
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (a Account) AddUser(ctx context.Context, req AddUserRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -37,7 +43,12 @@ func (a Account) AddUser(ctx context.Context, req AddUserRequest) (bool, error)
url := "/cloudbroker/account/addUser"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperAddUserRequest{
AddUserRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -49,3 +60,27 @@ func (a Account) AddUser(ctx context.Context, req AddUserRequest) (bool, error)
return result, nil
}
// AddUserAsync gives a user access rights in async mode
//
// Deprecated: will be removed in SDK v17.0
func (a Account) AddUserAsync(ctx context.Context, req AddUserRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/addUser"
reqWrapped := wrapperAddUserRequest{
AddUserRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+35 -2
View File
@@ -19,7 +19,13 @@ type AddZoneRequest struct {
ZoneIDs []uint64 `url:"zoneIds" json:"zoneIds" validate:"required"`
}
// AddUser gives a user access rights.
type wrapperAddZoneRequest struct {
AddZoneRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// AddZone adds zones to account
func (a Account) AddZone(ctx context.Context, req AddZoneRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -28,7 +34,12 @@ func (a Account) AddZone(ctx context.Context, req AddZoneRequest) (bool, error)
url := "/cloudbroker/account/addZone"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperAddZoneRequest{
AddZoneRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -40,3 +51,25 @@ func (a Account) AddZone(ctx context.Context, req AddZoneRequest) (bool, error)
return result, nil
}
// AddZoneAsync adds zones to account in async mode
func (a Account) AddZoneAsync(ctx context.Context, req AddZoneRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/addZone"
reqWrapped := wrapperAddZoneRequest{
AddZoneRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+34 -1
View File
@@ -79,6 +79,12 @@ type StoragePolicy struct {
Limit int `url:"limit" json:"limit"`
}
type wrapperCreateRequest struct {
CreateRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// Create creates account
// Setting a cloud unit maximum to -1 or empty will not put any restrictions on the resource
func (a Account) Create(ctx context.Context, req CreateRequest) (uint64, error) {
@@ -89,7 +95,12 @@ func (a Account) Create(ctx context.Context, req CreateRequest) (uint64, error)
url := "/cloudbroker/account/create"
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
reqWrapped := wrapperCreateRequest{
CreateRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return 0, err
}
@@ -101,3 +112,25 @@ func (a Account) Create(ctx context.Context, req CreateRequest) (uint64, error)
return result, nil
}
// CreateAsync creates account in async mode
func (a Account) CreateAsync(ctx context.Context, req CreateRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/create"
reqWrapped := wrapperCreateRequest{
CreateRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+34 -1
View File
@@ -16,6 +16,12 @@ type DelACLAccessRequest struct {
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
type wrapperDelACLAccessRequest struct {
DelACLAccessRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// DelACLAccess deletes ACL access from an account.
func (a Account) DeleteACLAccess(ctx context.Context, req DelACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -25,7 +31,12 @@ func (a Account) DeleteACLAccess(ctx context.Context, req DelACLAccessRequest) (
url := "/cloudbroker/account/del_acl_access"
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
reqWrapped := wrapperDelACLAccessRequest{
DelACLAccessRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return false, err
}
@@ -37,3 +48,25 @@ func (a Account) DeleteACLAccess(ctx context.Context, req DelACLAccessRequest) (
return result, nil
}
// DeleteACLAccessAsync deletes ACL access from an account in async mode
func (a Account) DeleteACLAccessAsync(ctx context.Context, req DelACLAccessRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/del_acl_access"
reqWrapped := wrapperDelACLAccessRequest{
DelACLAccessRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+34 -1
View File
@@ -19,6 +19,12 @@ type DelStoragePolicyRequest struct {
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
}
type wrapperDelStoragePolicyRequest struct {
DelStoragePolicyRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// DelStoragePolicy delete storage policy to the account.
func (a Account) DelStoragePolicy(ctx context.Context, req DelStoragePolicyRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -28,7 +34,12 @@ func (a Account) DelStoragePolicy(ctx context.Context, req DelStoragePolicyReque
url := "/cloudbroker/account/del_storage_policy"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperDelStoragePolicyRequest{
DelStoragePolicyRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -40,3 +51,25 @@ func (a Account) DelStoragePolicy(ctx context.Context, req DelStoragePolicyReque
return result, nil
}
// DelStoragePolicyAsync delete storage policy to the account in async mode
func (a Account) DelStoragePolicyAsync(ctx context.Context, req DelStoragePolicyRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/del_storage_policy"
reqWrapped := wrapperDelStoragePolicyRequest{
DelStoragePolicyRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+35 -2
View File
@@ -22,7 +22,13 @@ type DeleteRequest struct {
Name string `url:"name,omitempty" json:"name,omitempty"`
}
// Delete completes delete an account from the system Returns true if account is deleted or was already deleted or never existed
type wrapperDeleteRequest struct {
DeleteRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// Delete deletes an account from the system
func (a Account) Delete(ctx context.Context, req DeleteRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -31,10 +37,37 @@ func (a Account) Delete(ctx context.Context, req DeleteRequest) (string, error)
url := "/cloudbroker/account/delete"
result, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperDeleteRequest{
DeleteRequest: req,
AsyncMode: false,
}
result, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(result), nil
}
// DeleteAsync deletes an account from the system in async mode
func (a Account) DeleteAsync(ctx context.Context, req DeleteRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/delete"
reqWrapped := wrapperDeleteRequest{
DeleteRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+43 -2
View File
@@ -2,6 +2,7 @@ package account
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
@@ -18,8 +19,43 @@ type DeleteAccountsRequest struct {
Permanently bool `url:"permanently,omitempty" json:"permanently,omitempty"`
}
type wrapperDeleteAccountsRequest struct {
DeleteAccountsRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// DeleteAccounts destroys a group of accounts
func (a Account) DeleteAccounts(ctx context.Context, req DeleteAccountsRequest) (string, error) {
func (a Account) DeleteAccounts(ctx context.Context, req DeleteAccountsRequest) ([]uint64, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/deleteAccounts"
reqWrapped := wrapperDeleteAccountsRequest{
DeleteAccountsRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return nil, err
}
result := make([]uint64, 0)
err = json.Unmarshal(res, &result)
if err != nil {
return nil, err
}
return result, nil
}
// DeleteAccountsAsync destroys a group of accounts in async mode
func (a Account) DeleteAccountsAsync(ctx context.Context, req DeleteAccountsRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
@@ -27,7 +63,12 @@ func (a Account) DeleteAccounts(ctx context.Context, req DeleteAccountsRequest)
url := "/cloudbroker/account/deleteAccounts"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperDeleteAccountsRequest{
DeleteAccountsRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
+37 -2
View File
@@ -19,9 +19,15 @@ type DeleteUserRequest struct {
UserName string `url:"username" json:"username" validate:"required"`
}
type wrapperDeleteUserRequest struct {
DeleteUserRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// DeleteUser revokes user access from the account
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (a Account) DeleteUser(ctx context.Context, req DeleteUserRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -30,7 +36,12 @@ func (a Account) DeleteUser(ctx context.Context, req DeleteUserRequest) (bool, e
url := "/cloudbroker/account/deleteUser"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperDeleteUserRequest{
DeleteUserRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -42,3 +53,27 @@ func (a Account) DeleteUser(ctx context.Context, req DeleteUserRequest) (bool, e
return result, nil
}
// DeleteUserAsync revokes user access from the account in async mode
//
// Deprecated: will be removed in SDK v17.0
func (a Account) DeleteUserAsync(ctx context.Context, req DeleteUserRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/deleteUser"
reqWrapped := wrapperDeleteUserRequest{
DeleteUserRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+43 -2
View File
@@ -2,6 +2,7 @@ package account
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
@@ -14,8 +15,43 @@ type DisableAccountsRequest struct {
AccountIDs []uint64 `url:"accountIds" json:"accountIds" validate:"min=1"`
}
type wrapperDisableAccountsRequest struct {
DisableAccountsRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// DisableAccounts disables accounts
func (a Account) DisableAccounts(ctx context.Context, req DisableAccountsRequest) (string, error) {
func (a Account) DisableAccounts(ctx context.Context, req DisableAccountsRequest) ([]uint64, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/disableAccounts"
reqWrapped := wrapperDisableAccountsRequest{
DisableAccountsRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return nil, err
}
result := make([]uint64, 0)
err = json.Unmarshal(res, &result)
if err != nil {
return nil, err
}
return result, nil
}
// DisableAccountsAsync disables accounts in async mode
func (a Account) DisableAccountsAsync(ctx context.Context, req DisableAccountsRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
@@ -23,7 +59,12 @@ func (a Account) DisableAccounts(ctx context.Context, req DisableAccountsRequest
url := "/cloudbroker/account/disableAccounts"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperDisableAccountsRequest{
DisableAccountsRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
+43 -2
View File
@@ -2,6 +2,7 @@ package account
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
@@ -14,8 +15,43 @@ type EnableAccountsRequest struct {
AccountIDs []uint64 `url:"accountIds" json:"accountIds" validate:"min=1"`
}
type wrapperEnableAccountsRequest struct {
EnableAccountsRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// EnableAccounts enables accounts
func (a Account) EnableAccounts(ctx context.Context, req EnableAccountsRequest) (string, error) {
func (a Account) EnableAccounts(ctx context.Context, req EnableAccountsRequest) ([]uint64, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/enableAccounts"
reqWrapped := wrapperEnableAccountsRequest{
EnableAccountsRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return nil, err
}
result := make([]uint64, 0)
err = json.Unmarshal(res, &result)
if err != nil {
return nil, err
}
return result, nil
}
// EnableAccountsAsync enables accounts in async mode
func (a Account) EnableAccountsAsync(ctx context.Context, req EnableAccountsRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
@@ -23,7 +59,12 @@ func (a Account) EnableAccounts(ctx context.Context, req EnableAccountsRequest)
url := "/cloudbroker/account/enableAccounts"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperEnableAccountsRequest{
EnableAccountsRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
@@ -19,6 +19,12 @@ type GrantAccessTemplatesRequest struct {
ImageIDs []uint64 `url:"imageIds" json:"imageIds" validate:"required"`
}
type wrapperGrantAccessTemplatesRequest struct {
GrantAccessTemplatesRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// GrantAccessTemplates shares specified images with specified account
func (a Account) GrantAccessTemplates(ctx context.Context, req GrantAccessTemplatesRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -28,7 +34,12 @@ func (a Account) GrantAccessTemplates(ctx context.Context, req GrantAccessTempla
url := "/cloudbroker/account/grantAccessTemplates"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperGrantAccessTemplatesRequest{
GrantAccessTemplatesRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -40,3 +51,25 @@ func (a Account) GrantAccessTemplates(ctx context.Context, req GrantAccessTempla
return result, nil
}
// GrantAccessTemplatesAsync shares specified images with specified account in async mode
func (a Account) GrantAccessTemplatesAsync(ctx context.Context, req GrantAccessTemplatesRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/grantAccessTemplates"
reqWrapped := wrapperGrantAccessTemplatesRequest{
GrantAccessTemplatesRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+34 -1
View File
@@ -19,6 +19,12 @@ type RemoveZoneRequest struct {
ZoneIDs []uint64 `url:"zoneIds" json:"zoneIds" validate:"required"`
}
type wrapperRemoveZoneRequest struct {
RemoveZoneRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// RemoveZone removes zones with ids provided from a user.
func (a Account) RemoveZone(ctx context.Context, req RemoveZoneRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -28,7 +34,12 @@ func (a Account) RemoveZone(ctx context.Context, req RemoveZoneRequest) (bool, e
url := "/cloudbroker/account/removeZone"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperRemoveZoneRequest{
RemoveZoneRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -40,3 +51,25 @@ func (a Account) RemoveZone(ctx context.Context, req RemoveZoneRequest) (bool, e
return result, nil
}
// RemoveZoneAsync removes zones with ids provided from a user in async mode
func (a Account) RemoveZoneAsync(ctx context.Context, req RemoveZoneRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/removeZone"
reqWrapped := wrapperRemoveZoneRequest{
RemoveZoneRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+34 -1
View File
@@ -14,6 +14,12 @@ type RestoreRequest struct {
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
}
type wrapperRestoreRequest struct {
RestoreRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// Restore restores a deleted account
func (a Account) Restore(ctx context.Context, req RestoreRequest) (string, error) {
err := validators.ValidateRequest(req)
@@ -23,10 +29,37 @@ func (a Account) Restore(ctx context.Context, req RestoreRequest) (string, error
url := "/cloudbroker/account/restore"
result, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperRestoreRequest{
RestoreRequest: req,
AsyncMode: false,
}
result, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(result), nil
}
// RestoreAsync restores a deleted account in async mode
func (a Account) RestoreAsync(ctx context.Context, req RestoreRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/restore"
reqWrapped := wrapperRestoreRequest{
RestoreRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
@@ -19,6 +19,12 @@ type RevokeAccessTemplatesRequest struct {
ImageIDs []uint64 `url:"imageIds" json:"imageIds" validate:"required"`
}
type wrapperRevokeAccessTemplatesRequest struct {
RevokeAccessTemplatesRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// RevokeAccessTemplates unshares specified images with specified account
func (a Account) RevokeAccessTemplates(ctx context.Context, req RevokeAccessTemplatesRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -28,7 +34,12 @@ func (a Account) RevokeAccessTemplates(ctx context.Context, req RevokeAccessTemp
url := "/cloudbroker/account/revokeAccessTemplates"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperRevokeAccessTemplatesRequest{
RevokeAccessTemplatesRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -40,3 +51,25 @@ func (a Account) RevokeAccessTemplates(ctx context.Context, req RevokeAccessTemp
return result, nil
}
// RevokeAccessTemplatesAsync unshares specified images with specified account in async mode
func (a Account) RevokeAccessTemplatesAsync(ctx context.Context, req RevokeAccessTemplatesRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/revokeAccessTemplates"
reqWrapped := wrapperRevokeAccessTemplatesRequest{
RevokeAccessTemplatesRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
@@ -20,6 +20,12 @@ type SetCPUAllocationParameterRequest struct {
StrictLoose string `url:"strict_loose" json:"strict_loose" validate:"required,strict_loose"`
}
type wrapperSetCPUAllocationParameterRequest struct {
SetCPUAllocationParameterRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// SetCPUAllocationParameter sets CPU allocation parameter
func (a Account) SetCPUAllocationParameter(ctx context.Context, req SetCPUAllocationParameterRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -29,7 +35,12 @@ func (a Account) SetCPUAllocationParameter(ctx context.Context, req SetCPUAlloca
url := "/cloudbroker/account/setCpuAllocationParameter"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperSetCPUAllocationParameterRequest{
SetCPUAllocationParameterRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -41,3 +52,25 @@ func (a Account) SetCPUAllocationParameter(ctx context.Context, req SetCPUAlloca
return result, nil
}
// SetCPUAllocationParameterAsync sets CPU allocation parameter in async mode
func (a Account) SetCPUAllocationParameterAsync(ctx context.Context, req SetCPUAllocationParameterRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/setCpuAllocationParameter"
reqWrapped := wrapperSetCPUAllocationParameterRequest{
SetCPUAllocationParameterRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
@@ -19,6 +19,12 @@ type SetCPUAllocationRatioRequest struct {
Ratio uint64 `url:"ratio" json:"ratio" validate:"required"`
}
type wrapperSetCPUAllocationRatioRequest struct {
SetCPUAllocationRatioRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// SetCPUAllocationRatio sets CPU allocation ratio
func (a Account) SetCPUAllocationRatio(ctx context.Context, req SetCPUAllocationRatioRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -28,7 +34,12 @@ func (a Account) SetCPUAllocationRatio(ctx context.Context, req SetCPUAllocation
url := "/cloudbroker/account/setCpuAllocationRatio"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperSetCPUAllocationRatioRequest{
SetCPUAllocationRatioRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -40,3 +51,25 @@ func (a Account) SetCPUAllocationRatio(ctx context.Context, req SetCPUAllocation
return result, nil
}
// SetCPUAllocationRatioAsync sets CPU allocation ratio in async mode
func (a Account) SetCPUAllocationRatioAsync(ctx context.Context, req SetCPUAllocationRatioRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/setCpuAllocationRatio"
reqWrapped := wrapperSetCPUAllocationRatioRequest{
SetCPUAllocationRatioRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+34 -1
View File
@@ -70,6 +70,12 @@ type UpdateRequest struct {
CpuAllocationParameter string `url:"cpu_allocation_parameter,omitempty" json:"cpu_allocation_parameter,omitempty"`
}
type wrapperUpdateRequest struct {
UpdateRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// Update updates an account name and resource types and limits
func (a Account) Update(ctx context.Context, req UpdateRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -79,7 +85,12 @@ func (a Account) Update(ctx context.Context, req UpdateRequest) (bool, error) {
url := "/cloudbroker/account/update"
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
reqWrapped := wrapperUpdateRequest{
UpdateRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return false, err
}
@@ -91,3 +102,25 @@ func (a Account) Update(ctx context.Context, req UpdateRequest) (bool, error) {
return result, nil
}
// UpdateAsync updates an account name and resource types and limits in async mode
func (a Account) UpdateAsync(ctx context.Context, req UpdateRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/update"
reqWrapped := wrapperUpdateRequest{
UpdateRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+34 -1
View File
@@ -17,6 +17,12 @@ type UpdateACLAccessRequest struct {
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
type wrapperUpdateACLAccessRequest struct {
UpdateACLAccessRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// UpdateACLAccess updates ACL access in an account.
func (a Account) UpdateACLAccess(ctx context.Context, req UpdateACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -26,7 +32,12 @@ func (a Account) UpdateACLAccess(ctx context.Context, req UpdateACLAccessRequest
url := "/cloudbroker/account/update_acl_access"
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
reqWrapped := wrapperUpdateACLAccessRequest{
UpdateACLAccessRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return false, err
}
@@ -38,3 +49,25 @@ func (a Account) UpdateACLAccess(ctx context.Context, req UpdateACLAccessRequest
return result, nil
}
// UpdateACLAccessAsync updates ACL access in an account in async mode
func (a Account) UpdateACLAccessAsync(ctx context.Context, req UpdateACLAccessRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/update_acl_access"
reqWrapped := wrapperUpdateACLAccessRequest{
UpdateACLAccessRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
@@ -20,6 +20,12 @@ type UpdateComputeFeaturesRequest struct {
ComputeFeatures []string `url:"computeFeatures,omitempty" json:"computeFeatures,omitempty" validate:"omitempty,computeFeatures"`
}
type wrapperUpdateComputeFeaturesRequest struct {
UpdateComputeFeaturesRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// UpdateComputeFeatures updates advanced compute features
func (a Account) UpdateComputeFeatures(ctx context.Context, req UpdateComputeFeaturesRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -29,7 +35,12 @@ func (a Account) UpdateComputeFeatures(ctx context.Context, req UpdateComputeFea
url := "/cloudbroker/account/updateComputeFeatures"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperUpdateComputeFeaturesRequest{
UpdateComputeFeaturesRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -41,3 +52,25 @@ func (a Account) UpdateComputeFeatures(ctx context.Context, req UpdateComputeFea
return result, nil
}
// UpdateComputeFeaturesAsync updates advanced compute features in async mode
func (a Account) UpdateComputeFeaturesAsync(ctx context.Context, req UpdateComputeFeaturesRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/updateComputeFeatures"
reqWrapped := wrapperUpdateComputeFeaturesRequest{
UpdateComputeFeaturesRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
@@ -26,6 +26,13 @@ type UpdateResourceTypesRequest struct {
ResTypes []string `url:"resourceTypes" json:"resourceTypes" validate:"min=1,resTypes"`
}
type wrapperUpdateResourceTypesRequest struct {
UpdateResourceTypesRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// UpdateResourceTypes updates resource types in account
func (a Account) UpdateResourceTypes(ctx context.Context, req UpdateResourceTypesRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -34,7 +41,12 @@ func (a Account) UpdateResourceTypes(ctx context.Context, req UpdateResourceType
url := "/cloudbroker/account/updateResourceTypes"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperUpdateResourceTypesRequest{
UpdateResourceTypesRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -46,3 +58,25 @@ func (a Account) UpdateResourceTypes(ctx context.Context, req UpdateResourceType
return result, nil
}
// UpdateResourceTypesAsync updates resource types in account in async mode
func (a Account) UpdateResourceTypesAsync(ctx context.Context, req UpdateResourceTypesRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/updateResourceTypes"
reqWrapped := wrapperUpdateResourceTypesRequest{
UpdateResourceTypesRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+37 -2
View File
@@ -26,9 +26,15 @@ type UpdateUserRequest struct {
AccessType string `url:"accesstype" json:"accesstype" validate:"accessType"`
}
type wrapperUpdateUserRequest struct {
UpdateUserRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// UpdateUser updates user access rights
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (a Account) UpdateUser(ctx context.Context, req UpdateUserRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -37,7 +43,12 @@ func (a Account) UpdateUser(ctx context.Context, req UpdateUserRequest) (bool, e
url := "/cloudbroker/account/updateUser"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperUpdateUserRequest{
UpdateUserRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -49,3 +60,27 @@ func (a Account) UpdateUser(ctx context.Context, req UpdateUserRequest) (bool, e
return result, nil
}
// UpdateUserAsync updates user access rights in async mode
//
// Deprecated: will be removed in SDK v17.0
func (a Account) UpdateUserAsync(ctx context.Context, req UpdateUserRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/updateUser"
reqWrapped := wrapperUpdateUserRequest{
UpdateUserRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
+1
View File
@@ -168,6 +168,7 @@ type CloudBrokerEndpoints struct {
AuditCollector interface{} `json:"auditcollector,omitempty"`
Backup interface{} `json:"backup,omitempty"`
BackupCreator interface{} `json:"backupcreator,omitempty"`
BasisMPM interface{} `json:"basis_mpm,omitempty"`
BService interface{} `json:"bservice,omitempty"`
Compute interface{} `json:"compute,omitempty"`
Disks interface{} `json:"disks,omitempty"`
+1 -1
View File
@@ -25,7 +25,7 @@ type UserListRequest struct {
// UserList gets a list of users currently included in the specified group.
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (a APIAccess) UserList(ctx context.Context, req UserListRequest) ([]string, error) {
err := validators.ValidateRequest(req)
if err != nil {
+6
View File
@@ -77,6 +77,9 @@ type ItemAudit struct {
// Persistent disk IDs associated with the operation
DiskIDs []uint64 `json:"disk_ids"`
// VM folder ID
VMFolderID uint64 `json:"vmfolder_id"`
// API task ID for asynchronous calls
APITask string `json:"apitask"`
}
@@ -146,6 +149,9 @@ type RecordAudit struct {
// Compute ID
ComputeID uint64 `json:"compute_id"`
// VM folder ID
VMFolderID uint64 `json:"vmfolder_id"`
}
// List of Linked Jobs
+10
View File
@@ -0,0 +1,10 @@
package cloudbroker
import (
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/pkg/cloudbroker/basismpm"
)
// Accessing the BasisMPM method group
func (cb *CloudBroker) BasisMPM() *basismpm.BasisMPM {
return basismpm.New(cb.client)
}
+17
View File
@@ -0,0 +1,17 @@
package basismpm
import (
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/interfaces"
)
// Structure for creating request to Basis mpm
type BasisMPM struct {
client interfaces.Caller
}
// BasisMPM for Basis mpm endpoints
func New(client interfaces.Caller) *BasisMPM {
return &BasisMPM{
client: client,
}
}
+36
View File
@@ -0,0 +1,36 @@
package basismpm
type MemInfo struct {
// Total amount of memory
MemTotal string `json:"MemTotal"`
// Amount of free memory
MemFree string `json:"MemFree"`
// Amount of available memory
MemAvailable string `json:"MemAvailable"`
// Amount of available memory (in percent)
MemAvailablePercent float64 `json:"MemAvailablePercent"`
}
// Basis MPM service status
type RecordBasisMPM struct {
// Whether the service is installed
ServiceInstalled bool `json:"service_installed"`
// Whether the config exists
ConfigExists bool `json:"config_exists"`
// Whether the service is active
ServiceActive bool `json:"service_active"`
// Service state
ServiceState string `json:"service_state"`
// Config
Config interface{} `json:"config"`
// Memory info
MemInfo MemInfo `json:"meminfo"`
}
+110
View File
@@ -0,0 +1,110 @@
package basismpm
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// StartRequest to start basis_mpm service on a node
type StartRequest struct {
// Node ID
// Required: true
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
// Memory pressure threshold (%)
// Required: false
// Default: 20
PressureThreshold float64 `url:"pressure_threshold,omitempty" json:"pressure_threshold,omitempty" validate:"omitempty,pressureThreshold"`
// Deflate threshold (%)
// Required: false
// Default: 30
DeflateThreshold float64 `url:"deflate_threshold,omitempty" json:"deflate_threshold,omitempty" validate:"omitempty,deflateThreshold"`
// Host reserved memory
// Required: false
// Default: "8GB+5%"
HostReserved string `url:"host_reserved,omitempty" json:"host_reserved,omitempty"`
// Buffer percentage (%)
// Required: false
// Default: 20
BufferPCT float64 `url:"buffer_pct,omitempty" json:"buffer_pct,omitempty" validate:"omitempty,bufferPCT"`
// Guaranteed memory percentage (%)
// Required: false
// Default: 25
GuaranteedPCT float64 `url:"guaranteed_pct,omitempty" json:"guaranteed_pct,omitempty" validate:"omitempty,guaranteedPCT"`
// Absolute minimum guaranteed memory (MB)
// Required: false
// Default: 512
GuaranteedABSMin uint64 `url:"guaranteed_abs_min,omitempty" json:"guaranteed_abs_min,omitempty" validate:"omitempty,guaranteedABSMin"`
// Shrink threshold percentage (%)
// Required: false
// Default: 50
ShrinkThresholdPCT float64 `url:"shrink_threshold_pct,omitempty" json:"shrink_threshold_pct,omitempty" validate:"omitempty,shrinkThresholdPCT"`
// Max shrink percentage per cycle (%)
// Required: false
// Default: 10
BalloonMaxShrinkPCT float64 `url:"balloon_max_shrink_pct,omitempty" json:"balloon_max_shrink_pct,omitempty" validate:"omitempty,balloonMaxShrinkPCT"`
// Max grow percentage per cycle (%)
// Required: false
// Default: 10
BalloonMaxGrowPCT float64 `url:"balloon_max_grow_pct,omitempty" json:"balloon_max_grow_pct,omitempty" validate:"omitempty,balloonMaxGrowPCT"`
// VM change cooldown (seconds)
// Required: false
// Default: 60
VMChangeCooldown uint64 `url:"vm_change_cooldown,omitempty" json:"vm_change_cooldown,omitempty" validate:"omitempty,vmChangeCooldown"`
// Emergency return cooldown (seconds)
// Required: false
// Default: 300
EmergencyReturnCooldown uint64 `url:"emergency_return_cooldown,omitempty" json:"emergency_return_cooldown,omitempty"`
// Major fault increase per cycle that triggers emergency memory return
// Required: false
// Default: 100
MajorFaultThreshold uint64 `url:"major_fault_threshold,omitempty" json:"major_fault_threshold,omitempty" validate:"omitempty,majorFaultThreshold"`
// Daemon log level
// Required: false
// Default: INFO
// Options:
// - DEBUG
// - INFO
// - WARNING
// - ERROR
// - CRITICAL
LogLevel string `url:"log_level,omitempty" json:"log_level,omitempty" validate:"omitempty,logLevel"`
}
// Start starts basis_mpm service on a node
func (bm BasisMPM) Start(ctx context.Context, req StartRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/basis_mpm/start"
res, err := bm.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
}
+47
View File
@@ -0,0 +1,47 @@
package basismpm
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// StatusRequest to get basis_mpm service status on a node
type StatusRequest struct {
// Node ID
// Required: true
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
}
// Status gets basis_mpm service status on a node
func (bm BasisMPM) Status(ctx context.Context, req StatusRequest) (*RecordBasisMPM, error) {
res, err := bm.StatusRaw(ctx, req)
if err != nil {
return nil, err
}
info := RecordBasisMPM{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}
// StatusRaw gets basis_mpm service status on a node as an array of bites
func (bm BasisMPM) StatusRaw(ctx context.Context, req StatusRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/basis_mpm/status"
res, err := bm.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
return res, err
}
+44
View File
@@ -0,0 +1,44 @@
package basismpm
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// StopRequest to stop basis_mpm service on a node
type StopRequest struct {
// Node ID
// Required: true
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
// Restore VM memory before stopping
// Required: false
// Default: true
RestoreMemory interface{} `url:"restore_memory,omitempty" json:"restore_memory,omitempty" validate:"omitempty,isBool"`
}
// Stop stops basis_mpm service on a node
func (bm BasisMPM) Stop(ctx context.Context, req StopRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/basis_mpm/stop"
res, err := bm.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
}
+109
View File
@@ -0,0 +1,109 @@
package basismpm
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// UpdateRequest to update basis_mpm service configuration on a node
type UpdateRequest struct {
// Node ID
// Required: true
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
// Memory pressure threshold (%)
// Required: false
// Default: 20
PressureThreshold float64 `url:"pressure_threshold,omitempty" json:"pressure_threshold,omitempty" validate:"omitempty,pressureThreshold"`
// Deflate threshold (%)
// Required: false
// Default: 30
DeflateThreshold float64 `url:"deflate_threshold,omitempty" json:"deflate_threshold,omitempty" validate:"omitempty,deflateThreshold"`
// Host reserved memory
// Required: false
// Default: "8GB+5%"
HostReserved string `url:"host_reserved,omitempty" json:"host_reserved,omitempty"`
// Buffer percentage (%)
// Required: false
// Default: 20
BufferPCT float64 `url:"buffer_pct,omitempty" json:"buffer_pct,omitempty" validate:"omitempty,bufferPCT"`
// Guaranteed memory percentage (%)
// Required: false
// Default: 25
GuaranteedPCT float64 `url:"guaranteed_pct,omitempty" json:"guaranteed_pct,omitempty" validate:"omitempty,guaranteedPCT"`
// Absolute minimum guaranteed memory (MB)
// Required: false
// Default: 512
GuaranteedABSMin uint64 `url:"guaranteed_abs_min,omitempty" json:"guaranteed_abs_min,omitempty" validate:"omitempty,guaranteedABSMin"`
// Shrink threshold percentage (%)
// Required: false
// Default: 50
ShrinkThresholdPCT float64 `url:"shrink_threshold_pct,omitempty" json:"shrink_threshold_pct,omitempty" validate:"omitempty,shrinkThresholdPCT"`
// Max shrink percentage per cycle (%)
// Required: false
// Default: 10
BalloonMaxShrinkPCT float64 `url:"balloon_max_shrink_pct,omitempty" json:"balloon_max_shrink_pct,omitempty" validate:"omitempty,balloonMaxShrinkPCT"`
// Max grow percentage per cycle (%)
// Required: false
// Default: 10
BalloonMaxGrowPCT float64 `url:"balloon_max_grow_pct,omitempty" json:"balloon_max_grow_pct,omitempty" validate:"omitempty,balloonMaxGrowPCT"`
// VM change cooldown (seconds)
// Required: false
// Default: 60
VMChangeCooldown uint64 `url:"vm_change_cooldown,omitempty" json:"vm_change_cooldown,omitempty" validate:"omitempty,vmChangeCooldown"`
// Emergency return cooldown (seconds)
// Required: false
// Default: 300
EmergencyReturnCooldown uint64 `url:"emergency_return_cooldown,omitempty" json:"emergency_return_cooldown,omitempty" validate:"omitempty,emergencyReturnCooldown"`
// Major fault increase per cycle that triggers emergency memory return
// Required: false
// Default: 100
MajorFaultThreshold uint64 `url:"major_fault_threshold,omitempty" json:"major_fault_threshold,omitempty" validate:"omitempty,majorFaultThreshold"`
// Daemon log level
// Required: false
// Default: INFO
// Options:
// - DEBUG
// - INFO
// - WARNING
// - ERROR
// - CRITICAL
LogLevel string `url:"log_level,omitempty" json:"log_level,omitempty" validate:"omitempty,logLevel"`
}
func (bm BasisMPM) Update(ctx context.Context, req UpdateRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/basis_mpm/update"
res, err := bm.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
@@ -26,6 +26,8 @@ type wrapperCreateTemplateRequest struct {
}
// CreateTemplate create template from compute instance
//
// Deprecated: will be removed in SDK v17.0
func (c Compute) CreateTemplate(ctx context.Context, req CreateTemplateRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -50,6 +52,8 @@ func (c Compute) CreateTemplate(ctx context.Context, req CreateTemplateRequest)
}
// CreateTemplateAsync create template from compute instance with AsyncMode
//
// Deprecated: will be removed in SDK v17.0
func (c Compute) CreateTemplateAsync(ctx context.Context, req CreateTemplateRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -60,6 +60,8 @@ type wrapperCreateTemplateFromBlankRequest struct {
// CreateTemplateFromBlank creates template from boot disk of current compute in sync mode.
// It returns id of created compute and error.
//
// Deprecated: will be removed in SDK v17.0
func (c Compute) CreateTemplateFromBlank(ctx context.Context, req CreateTemplateFromBlankRequest) (uint64, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -88,6 +90,8 @@ func (c Compute) CreateTemplateFromBlank(ctx context.Context, req CreateTemplate
// CreateTemplateFromBlankAsync creates template from boot disk of current compute in async mode.
// It returns guid of task and error.
//
// Deprecated: will be removed in SDK v17.0
func (c Compute) CreateTemplateFromBlankAsync(ctx context.Context, req CreateTemplateFromBlankRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
+2 -2
View File
@@ -31,7 +31,7 @@ type wrapperDiskQOSRequest struct {
// DiskQOS changes QOS of the disk
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) DiskQOS(ctx context.Context, req DiskQOSRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -60,7 +60,7 @@ func (c Compute) DiskQOS(ctx context.Context, req DiskQOSRequest) (bool, error)
// DiskQOSAsync changes QOS of the disk with AsyncMode
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) DiskQOSAsync(ctx context.Context, req DiskQOSRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -0,0 +1,64 @@
package compute
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
type Pin struct {
// ID of the compute instance
// Required: true
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
// Target node ID. Required for stopped computes.
// For started computes it is optional;
// if it differs from the current node, allow_migration must be true,
// otherwise the compute is reported with migration_not_allowed error.
// Required: false
NodeID uint64 `url:"node_id,omitempty" json:"node_id,omitempty"`
}
// MassPinToNodeRequest to pin multiple computes to nodes in a single call
type MassPinToNodeRequest struct {
// Computes to pin, at most 200 items per request
// Required: true
Pins []Pin `url:"pins" json:"pins" validate:"required,min=1,max=200,dive"`
// Allow live migration of started computes to the requested node_id
// Default: false
// Required: false
AllowMigration interface{} `url:"allow_migration,omitempty" json:"allow_migration,omitempty" validate:"omitempty,isBool"`
// Start compute after node exits from MAINTENANCE state
// Default: false
// Required: false
AutoStart interface{} `url:"auto_start,omitempty" json:"auto_start,omitempty" validate:"omitempty,isBool"`
}
// MassPinToNode pins multiple computes to nodes in a single call
func (c Compute) MassPinToNode(ctx context.Context, req MassPinToNodeRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/mass_pin_to_node"
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return "", err
}
var resp string
err = json.Unmarshal(res, &resp)
if err != nil {
return "", err
}
return resp, nil
}
+2 -2
View File
@@ -27,7 +27,7 @@ type AsyncWrapperMigrateRequest struct {
// Migrate migrates compute to another node
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) Migrate(ctx context.Context, req MigrateRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -53,7 +53,7 @@ func (c Compute) Migrate(ctx context.Context, req MigrateRequest) (bool, error)
// AsyncMigrate migrates compute to another node in async mode
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) AsyncMigrate(ctx context.Context, req MigrateRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
+2 -2
View File
@@ -23,7 +23,7 @@ type wrapperMigrateAbortRequest struct {
// MigrateAbort aborts compute migration
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) MigrateAbort(ctx context.Context, req MigrateAbortRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -49,7 +49,7 @@ func (c Compute) MigrateAbort(ctx context.Context, req MigrateAbortRequest) (str
// MigrateAbortAsync aborts compute migration with AsyncMode
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) MigrateAbortAsync(ctx context.Context, req MigrateAbortRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -28,7 +28,7 @@ type wrapperMigrateStorageAbortRequest struct {
// MigrateStorageAbort aborts complex compute migration job
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) MigrateStorageAbort(ctx context.Context, req MigrateStorageAbortRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -57,7 +57,7 @@ func (c Compute) MigrateStorageAbort(ctx context.Context, req MigrateStorageAbor
// MigrateStorageAbortAsync aborts complex compute migration job with AsyncMode
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) MigrateStorageAbortAsync(ctx context.Context, req MigrateStorageAbortRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -25,7 +25,7 @@ type wrapperMigrateStorageCleanUpRequest struct {
// If the migration was successful, then old disks will be removed, else new (target) disks will be removed.
// Do it wisely!
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) MigrateStorageCleanUp(ctx context.Context, req MigrateStorageCleanUpRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -54,7 +54,7 @@ func (c Compute) MigrateStorageCleanUp(ctx context.Context, req MigrateStorageCl
// MigrateStorageCleanUpAsync cleanup resources after finished migration with AsyncMode
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) MigrateStorageCleanUpAsync(ctx context.Context, req MigrateStorageCleanUpRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -17,7 +17,7 @@ type MigrateStorageInfoRequest struct {
// MigrateStorageInfo gets info about last (include ongoing) storage migration
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) MigrateStorageInfo(ctx context.Context, req MigrateStorageInfoRequest) (*RecordMigrateStorageInfo, error) {
res, err := c.MigrateStorageInfoRaw(ctx, req)
if err != nil {
@@ -36,7 +36,7 @@ func (c Compute) MigrateStorageInfo(ctx context.Context, req MigrateStorageInfoR
// MigrateStorageInfoRaw gets info about last (include ongoing) storage migration as an array of bytes
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) MigrateStorageInfoRaw(ctx context.Context, req MigrateStorageInfoRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -33,7 +33,7 @@ type MigrateStorageListRequest struct {
// MigrateStorageList gets list of the jobs.
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) MigrateStorageList(ctx context.Context, req MigrateStorageListRequest) (*ListMigrateStorage, error) {
if err := validators.ValidateRequest(req); err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
+13 -4
View File
@@ -23,7 +23,8 @@ type Target struct {
// Required: false
StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"`
// Disk IDs
// Disk IDs. May be omitted if Targets contains one element (all persistent disks are migrated).
// Required if Targets contains two or more elements; disk IDs must not overlap between targets.
// Required: false
DiskIDs []uint64 `url:"disk_ids,omitempty" json:"disk_ids,omitempty"`
}
@@ -31,8 +32,8 @@ type Target struct {
// Storage describes a destination for a disk
type Storage struct {
// Target for migration
// Required: false
Targets []Target `url:"targets,omitempty" json:"targets,omitempty"`
// Required: true
Targets []Target `url:"targets" json:"targets" validate:"required,min=1,dive"`
// Whether a separate source-disk cleanup job should be started after full success
// Required: false
@@ -55,7 +56,15 @@ type MigrateV2Request struct {
// Destination for a disk
// Required: false
Storage Storage `url:"storage,omitempty" json:"storage,omitempty"`
Storage *Storage `url:"storage,omitempty" json:"storage,omitempty"`
// Maximum simultaneous disk copies in this migration. Available only for STOPPED VMs in disks mode.
// Required: false
CopyParallelism uint64 `url:"copy_parallelism,omitempty" json:"copy_parallelism,omitempty"`
// Optional copy bandwidth limit in bytes/s, per copied disk (104857600 = 100 MiB/s). During VM migration it also limits the RAM transfer.
// Required: false
BandwidthBytesPerSecond uint64 `url:"bandwidth_bytes_per_second,omitempty" json:"bandwidth_bytes_per_second,omitempty"`
}
// MigrateV2 starts a migration of a compute or a disk
@@ -34,6 +34,34 @@ type MigrateV2ListRequest struct {
// Required: false
CleanupRequired interface{} `url:"cleanup_required,omitempty" json:"cleanup_required,omitempty" validate:"omitempty,isBool"`
// Account ID at migration start
// Required: false
AccountID uint64 `url:"account_id,omitempty" json:"account_id,omitempty"`
// Resource group ID at migration start
// Required: false
RGID uint64 `url:"rg_id,omitempty" json:"rg_id,omitempty"`
// Initiating username; case-sensitive
// Required: false
User string `url:"user,omitempty" json:"user,omitempty"`
// Match the username exactly or by literal prefix
// Required: false
UserMatch string `url:"user_match,omitempty" json:"user_match,omitempty" validate:"omitempty,userMatch"`
// True selects migrations without a user; false selects those with a user. Cannot be combined with user
// Required: false
UserIsNull interface{} `url:"user_is_null,omitempty" json:"user_is_null,omitempty" validate:"omitempty,isBool"`
// True selects migrations without a source node; false selects those with one. Cannot be combined with source_node_id
// Required: false
SourceNodeIDIsNull interface{} `url:"source_node_id_is_null,omitempty" json:"source_node_id_is_null,omitempty" validate:"omitempty,isBool"`
// True selects migrations without a target node; false selects those with one. Cannot be combined with target_node_id
// Required: false
TargetNodeIDIsNull interface{} `url:"target_node_id_is_null,omitempty" json:"target_node_id_is_null,omitempty" validate:"omitempty,isBool"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
@@ -18,6 +18,10 @@ type MigrateV2ResolveRequest struct {
// Take over cleanup
// Required: false
TakeOverCleanup interface{} `url:"take_over_cleanup,omitempty" json:"take_over_cleanup,omitempty" validate:"omitempty,isBool"`
// Take over resources
// Required: false
TakeOverResources interface{} `url:"take_over_resources,omitempty" json:"take_over_resources,omitempty" validate:"omitempty,isBool"`
}
// MigrateV2Resolve resolves a migration of a compute
+214 -15
View File
@@ -2315,7 +2315,7 @@ type Origin struct {
type Observation struct {
// Updated at
UpdatedAt uint64 `json:"updated_at"`
UpdatedAt float64 `json:"updated_at"`
// Agent job ID
AgentJobID string `json:"agent_job_id"`
@@ -2329,13 +2329,13 @@ type Observation struct {
type Memory struct {
// Sampled at
SampledAt uint64 `json:"sampled_at"`
SampledAt float64 `json:"sampled_at"`
// Percent
Percent uint64 `json:"percent"`
Percent float64 `json:"percent"`
// Bytes per second
BytesPerSecond uint64 `json:"bytes_per_second"`
BytesPerSecond float64 `json:"bytes_per_second"`
// Processed bytes
ProcessedBytes uint64 `json:"processed_bytes"`
@@ -2345,26 +2345,93 @@ type Memory struct {
}
type ProgressDisks struct {
// Scope
Scope string `json:"scope"`
// Target devs
TargetDevs []string `json:"target_devs"`
// Sampled at
SampledAt uint64 `json:"sampled_at"`
SampledAt float64 `json:"sampled_at"`
// Percent
Percent uint64 `json:"percent"`
Percent float64 `json:"percent"`
// Bytes per second
BytesPerSecond uint64 `json:"bytes_per_second"`
BytesPerSecond float64 `json:"bytes_per_second"`
// Processed bytes
ProcessedBytes uint64 `json:"processed_bytes"`
// Remaining bytes
RemainingBytes uint64 `json:"remaining_bytes"`
// True when the server weights independent copy percentages by fixed logical source disk sizes
PercentIsEstimated bool `json:"percent_is_estimated"`
// Disks total
DisksTotal uint64 `json:"disks_total"`
// Disks completed
DisksCompleted uint64 `json:"disks_completed"`
// Items
Items []ProgressDiskItem `json:"items"`
}
type ProgressDiskItem struct {
// Transfer observation time in UTC Unix seconds, or null
SampledAt float64 `json:"sampled_at"`
// Last transfer percentage, not overall workflow completion or remaining time
Percent float64 `json:"percent"`
// Provider-measured throughput, not the configured limit.
BytesPerSecond float64 `json:"bytes_per_second"`
// Provider-reported transferred bytes, never inferred from percent or logical disk size
ProcessedBytes uint64 `json:"processed_bytes"`
// Remaining bytes
RemainingBytes uint64 `json:"remaining_bytes"`
// Kind
Kind string `json:"kind"`
// Null for the local stateless system disk, which has no platform disk ID
SourceDiskID uint64 `json:"source_disk_id"`
// Null before allocation or for a stateless system disk
TargetDiskID uint64 `json:"target_disk_id"`
// Guest device such as vda
TargetDev string `json:"target_dev"`
// Last known state of this copy
State string `json:"state"`
}
type CompletedDisk struct {
// Source disk ID
SourceDiskID uint64 `json:"source_disk_id"`
// Target disk ID
TargetDiskID uint64 `json:"target_disk_id"`
// Target dev
TargetDev string `json:"target_dev"`
}
type CurrentDisk struct {
// Source disk ID
SourceDiskID uint64 `json:"source_disk_id"`
// Target disk ID
TargetDiskID uint64 `json:"target_disk_id"`
// Target dev
TargetDev string `json:"target_dev"`
// Percent
Percent float64 `json:"percent"`
// Sampled at
SampledAt float64 `json:"sampled_at"`
}
type SystemDisk struct {
@@ -2372,13 +2439,13 @@ type SystemDisk struct {
TargetDev string `json:"target_dev"`
// Sampled at
SampledAt uint64 `json:"sampled_at"`
SampledAt float64 `json:"sampled_at"`
// Percent
Percent uint64 `json:"percent"`
Percent float64 `json:"percent"`
// Bytes per second
BytesPerSecond uint64 `json:"bytes_per_second"`
BytesPerSecond float64 `json:"bytes_per_second"`
// Processed bytes
ProcessedBytes uint64 `json:"processed_bytes"`
@@ -2422,6 +2489,15 @@ type Disk struct {
// State
State string `json:"state"`
// Offline copy worker node, not the VM placement or its next start node
CopyNodeID uint64 `json:"copy_node_id"`
// Offline physical copy state, separate from the saved disk replacement stage
CopyState string `json:"copy_state"`
// Whether this offline copy writer was confirmed stopped
WriterStopped bool `json:"writer_stopped"`
}
type Cleanup struct {
@@ -2448,12 +2524,18 @@ type Resolution struct {
// Take over cleanup
TakeOverCleanup bool `json:"take_over_cleanup"`
// Take over resources
TakeOverResources bool `json:"take_over_resources"`
// Previous status
PreviousStatus string `json:"previous_status"`
// Previous cleanup required
PreviousCleanupRequired bool `json:"previous_cleanup_required"`
// Previous reserves compute resources
PreviousReservesComputeResources bool `json:"previous_reserves_compute_resources"`
// Previous error
PreviousError string `json:"previous_error"`
}
@@ -2518,6 +2600,27 @@ type MigrateV2Item struct {
// Updated at
UpdatedAt string `json:"updated_at"`
// Requested copy limit in bytes/s per disk and for RAM transfer when moving the VM
BandwidthBytesPerSecond uint64 `json:"bandwidth_bytes_per_second"`
// Requested maximum simultaneous offline disk copies in this migration. Null uses all assigned copy nodes, one copy per node. Applies only to offline disk copying.
CopyParallelism uint64 `json:"copy_parallelism"`
// Whether the complete copy plan passed validation and was saved
DiskPlanReady bool `json:"disk_plan_ready"`
// Null until the VM is inspected. Offline applies only to STOPPED VMs in disks mode; the VM remains stopped after copying
ExecutionKind string `json:"execution_kind"`
// Null for online execution. For offline execution, at least one disk replacement decision was saved in disks[].state as COPIED or MIGRATED; model updates may still be unfinished
OfflineCommitStarted bool `json:"offline_commit_started"`
// Requested storage destinations, retained even when preflight validation fails. Null means that no persistent-disk storage migration was requested
RequestedStorage RequestedStorage `json:"requested_storage"`
// Original persistent-disk locations before migration
SourceDisks []SourceDisk `json:"source_disks"`
}
type ListMigrateV2 struct {
@@ -2591,6 +2694,99 @@ type MigrateV2Record struct {
// Logs
Logs []string `json:"logs"`
// Requested copy limit in bytes/s per disk and for RAM transfer when moving the VM
BandwidthBytesPerSecond uint64 `json:"bandwidth_bytes_per_second"`
// Requested maximum simultaneous offline disk copies in this migration. Null uses all assigned copy nodes, one copy per node. Applies only to offline disk copying.
CopyParallelism uint64 `json:"copy_parallelism"`
// Whether the complete copy plan passed validation and was saved
DiskPlanReady bool `json:"disk_plan_ready"`
// Null until the VM is inspected. Offline applies only to STOPPED VMs in disks mode; the VM remains stopped after copying
ExecutionKind string `json:"execution_kind"`
// Null for online execution. For offline execution, at least one disk replacement decision was saved in disks[].state as COPIED or MIGRATED; model updates may still be unfinished
OfflineCommitStarted bool `json:"offline_commit_started"`
// Whether this migration still reserves extra CPU/RAM on target_node_id
ReservesComputeResources bool `json:"reserves_compute_resources"`
// Requested storage destinations, retained even when preflight validation fails. Null means that no persistent-disk storage migration was requested
RequestedStorage RequestedStorage `json:"requested_storage"`
}
type Targets struct {
// Selected source disks for this destination; null selects all persistent disks
DiskIDs []uint64 `json:"disk_ids"`
// SEP ID
SEPID uint64 `json:"sep_id"`
// Storage type learned during validation, or null if the destination was not inspected ye
SEPType string `json:"sep_type"`
// Pool name
PoolName string `json:"pool_name"`
// Requested policy; null preserves each source disk's storage policy
StoragePolicyID uint64 `json:"storage_policy_id"`
}
// Info about requested storage
type RequestedStorage struct {
// Whether automatic source-disk cleanup was requested after successful migration
AutoCleanup bool `json:"auto_cleanup"`
// Targets
Targets []Targets `json:"targets"`
}
// Info about source disks
type SourceDisk struct {
// Disk ID
DiskID uint64 `json:"disk_id"`
// SEP ID
SEPID uint64 `json:"sep_id"`
// SEP type
SEPType string `json:"sep_type"`
// Pool name
PoolName string `json:"pool_name"`
// Requested policy; null preserves each source disk's storage policy
StoragePolicyID uint64 `json:"storage_policy_id"`
}
// Info about saved VM resource parameters for target placement
type TargetShadowCompute struct {
// Compute ID
ID uint64 `json:"id"`
// Target node selected for the VM
NodeID uint64 `json:"node_id"`
// Number of vCPUs
CPUs uint64 `json:"cpus"`
// VM memory in MiB
RAM uint64 `json:"ram"`
// Whether CPU pinning was requested
CPUPin bool `json:"cpupin"`
// Saved NUMA affinity policy
NumaAffinity string `json:"numaAffinity"`
// Selected target NUMA node
NumaNodeID int64 `json:"numaNodeId"`
// Target host CPU IDs selected for pinning
ReservedNodeCPUs []uint64 `json:"reservedNodeCpus"`
}
// Migrate V2 resolve record
@@ -2607,6 +2803,9 @@ type MigrateV2ResolveRecord struct {
// Cleanup required
CleanupRequired bool `json:"cleanup_required"`
// Message
Message string `json:"message"`
// Resolution
Resolution Resolution `json:"resolution"`
}
+1 -1
View File
@@ -29,7 +29,7 @@ type UserGrantRequest struct {
// UserGrant grants user access to the compute
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) UserGrant(ctx context.Context, req UserGrantRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
+1 -1
View File
@@ -17,7 +17,7 @@ type UserListRequest struct {
// UserList gets users list for compute
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) UserList(ctx context.Context, req UserListRequest) (*ListUsers, error) {
err := validators.ValidateRequest(req)
if err != nil {
+1 -1
View File
@@ -21,7 +21,7 @@ type UserRevokeRequest struct {
// UserRevoke revokes user access to the compute
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) UserRevoke(ctx context.Context, req UserRevokeRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
+1 -1
View File
@@ -29,7 +29,7 @@ type UserUpdateRequest struct {
// UserUpdate updates user access to the compute
//
// Deprecated: will be removed in SDK v1.17
// Deprecated: will be removed in SDK v17.0
func (c Compute) UserUpdate(ctx context.Context, req UserUpdateRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -22,7 +22,7 @@ type ChangeDiskStoragePolicyRequest struct {
// Keep current disk I/O tune settings in the domain XML
// Required: false
// Default: false
KeepCurrentIOTune interface{} `url:"keep_current_iot,omitempty" json:"keep_current_iot,omitempty" validate:"omitempty,isBool"`
KeepCurrentIOTune interface{} `url:"keep_current_iotune,omitempty" json:"keep_current_iotune,omitempty" validate:"omitempty,isBool"`
}
type wrapperChangeDiskStoragePolicyRequest struct {
@@ -59,6 +59,8 @@ type wrapperFromPlatformDiskRequest struct {
// FromPlatformDisk creates template from platform disk in sync mode.
// It returns id of created disk and error.
//
// Deprecated: will be removed in SDK v17.0
func (d Disks) FromPlatformDisk(ctx context.Context, req FromPlatformDiskRequest) (uint64, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -87,6 +89,8 @@ func (d Disks) FromPlatformDisk(ctx context.Context, req FromPlatformDiskRequest
// FromPlatformDiskAsync creates template from platform disk in async mode.
// It returns guid of task and error.
//
// Deprecated: will be removed in SDK v17.0
func (d Disks) FromPlatformDiskAsync(ctx context.Context, req FromPlatformDiskRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
+80
View File
@@ -0,0 +1,80 @@
package disks
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// MigrateV2Target describes a target storage for a group of disks
type MigrateV2Target struct {
// IDs of detached disks to migrate
// Required: true
DiskIDs []uint64 `url:"disk_ids" json:"disk_ids" validate:"required,min=1,max=100,unique,dive,required"`
// SEP ID
// Required: true
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
// Name of a pool
// Required: true
PoolName string `url:"pool_name" json:"pool_name" validate:"required"`
// Storage policy ID
// Required: false
StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"`
}
// MigrateV2Storage describes a destination for disks
type MigrateV2Storage struct {
// Targets for migration
// Required: true
Targets []MigrateV2Target `url:"targets" json:"targets" validate:"required,min=1,dive"`
// Whether a separate source-disk cleanup job should be started after full success
// Default: true
// Required: false
AutoCleanup interface{} `url:"auto_cleanup,omitempty" json:"auto_cleanup,omitempty" validate:"omitempty,isBool"`
}
// MigrateV2Request struct to start an offline migration of a group of detached disks
type MigrateV2Request struct {
// Bandwidth limit in bytes per second
// Required: false
BandwidthBytesPerSecond uint64 `url:"bandwidth_bytes_per_second,omitempty" json:"bandwidth_bytes_per_second,omitempty"`
// Number of simultaneous copies
// Required: false
CopyParallelism uint64 `url:"copy_parallelism,omitempty" json:"copy_parallelism,omitempty"`
// Destination for disks
// Required: true
Storage MigrateV2Storage `url:"storage" json:"storage"`
}
// MigrateV2 starts an offline migration of a group of detached disks and returns workflow job ID
func (d Disks) MigrateV2(ctx context.Context, req MigrateV2Request) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/disks/migrate_v2"
res, err := d.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return "", err
}
var resp string
err = json.Unmarshal(res, &resp)
if err != nil {
return "", err
}
return resp, nil
}
+47
View File
@@ -0,0 +1,47 @@
package disks
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// MigrateV2AbortRequest struct to abort disks migrations
type MigrateV2AbortRequest struct {
// Migration workflow job IDs
// Required: true
WorkflowJobIDs []string `url:"workflow_job_ids" json:"workflow_job_ids" validate:"required,min=1,max=100,unique,dive,required"`
}
// MigrateV2Abort aborts disks migrations
func (d Disks) MigrateV2Abort(ctx context.Context, req MigrateV2AbortRequest) (*MigrateV2AbortRecord, error) {
res, err := d.MigrateV2AbortRaw(ctx, req)
if err != nil {
return nil, err
}
info := MigrateV2AbortRecord{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}
// MigrateV2AbortRaw aborts disks migrations and returns an array of bytes
func (d Disks) MigrateV2AbortRaw(ctx context.Context, req MigrateV2AbortRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/disks/migrate_v2_abort"
res, err := d.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
return res, err
}
@@ -0,0 +1,41 @@
package disks
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// MigrateV2CleanupRequest struct to clean up source disks after a disks migration
type MigrateV2CleanupRequest struct {
// Migration workflow job ID
// Required: true
WorkflowJobID string `url:"workflow_job_id" json:"workflow_job_id" validate:"required"`
}
// MigrateV2Cleanup cleans up source disks after a disks migration and returns cleanup job ID
func (d Disks) MigrateV2Cleanup(ctx context.Context, req MigrateV2CleanupRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/disks/migrate_v2_cleanup"
res, err := d.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return "", err
}
var resp string
err = json.Unmarshal(res, &resp)
if err != nil {
return "", err
}
return resp, nil
}
+46
View File
@@ -0,0 +1,46 @@
package disks
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// MigrateV2GetRequest struct to get information about a disks migration
type MigrateV2GetRequest struct {
// Migration workflow job ID
// Required: true
WorkflowJobID string `url:"workflow_job_id" json:"workflow_job_id" validate:"required"`
}
// MigrateV2Get gets information about a disks migration as a MigrateV2Record struct
func (d Disks) MigrateV2Get(ctx context.Context, req MigrateV2GetRequest) (*MigrateV2Record, error) {
res, err := d.MigrateV2GetRaw(ctx, req)
if err != nil {
return nil, err
}
info := MigrateV2Record{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}
// MigrateV2GetRaw gets information about a disks migration as an array of bytes
func (d Disks) MigrateV2GetRaw(ctx context.Context, req MigrateV2GetRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/disks/migrate_v2_get"
res, err := d.client.DecortApiCall(ctx, http.MethodGet, url, req)
return res, err
}
+101
View File
@@ -0,0 +1,101 @@
package disks
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// MigrateV2ListRequest struct to get list of disks migrations
type MigrateV2ListRequest struct {
// Migration workflow job ID
// Required: false
WorkflowJobID string `url:"workflow_job_id,omitempty" json:"workflow_job_id,omitempty"`
// Disk ID
// Required: false
DiskID uint64 `url:"disk_id,omitempty" json:"disk_id,omitempty"`
// Account ID
// Required: false
AccountID uint64 `url:"account_id,omitempty" json:"account_id,omitempty"`
// User name
// Required: false
User string `url:"user,omitempty" json:"user,omitempty"`
// User match mode
// Should be one of:
// - exact
// - prefix
// Default: exact
// Required: false
UserMatch string `url:"user_match,omitempty" json:"user_match,omitempty" validate:"omitempty,migrateV2UserMatch"`
// Find migrations without user
// Required: false
UserIsNull interface{} `url:"user_is_null,omitempty" json:"user_is_null,omitempty" validate:"omitempty,isBool"`
// Migration status
// Should be one of:
// - QUEUED
// - VALIDATING
// - PREPARING
// - MIGRATING
// - COMPLETING
// - ABORTING
// - NEEDS_ATTENTION
// - COMPLETED
// - PARTIALLY_COMPLETED
// - ABORTED
// - ERROR
// - RESOLVED
// Required: false
Status string `url:"status,omitempty" json:"status,omitempty" validate:"omitempty,migrateV2Status"`
// Whether retained source disks still require cleanup
// Required: false
CleanupRequired interface{} `url:"cleanup_required,omitempty" json:"cleanup_required,omitempty" validate:"omitempty,isBool"`
// Page number
// Default: 1
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
// Page size
// Default: 100
// Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty" validate:"omitempty,max=500"`
}
// MigrateV2List gets list of disks migrations as a ListMigrateV2 struct
func (d Disks) MigrateV2List(ctx context.Context, req MigrateV2ListRequest) (*ListMigrateV2, error) {
res, err := d.MigrateV2ListRaw(ctx, req)
if err != nil {
return nil, err
}
list := ListMigrateV2{}
err = json.Unmarshal(res, &list)
if err != nil {
return nil, err
}
return &list, nil
}
// MigrateV2ListRaw gets list of disks migrations as an array of bytes
func (d Disks) MigrateV2ListRaw(ctx context.Context, req MigrateV2ListRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/disks/migrate_v2_list"
res, err := d.client.DecortApiCall(ctx, http.MethodGet, url, req)
return res, err
}
@@ -0,0 +1,52 @@
package disks
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
// MigrateV2ResolveRequest struct to resolve a disks migration
type MigrateV2ResolveRequest struct {
// Migration workflow job ID
// Required: true
WorkflowJobID string `url:"workflow_job_id" json:"workflow_job_id" validate:"required"`
// Take over cleanup
// Default: false
// Required: false
TakeOverCleanup interface{} `url:"take_over_cleanup,omitempty" json:"take_over_cleanup,omitempty" validate:"omitempty,isBool"`
}
// MigrateV2Resolve resolves a disks migration
func (d Disks) MigrateV2Resolve(ctx context.Context, req MigrateV2ResolveRequest) (*MigrateV2ResolveRecord, error) {
res, err := d.MigrateV2ResolveRaw(ctx, req)
if err != nil {
return nil, err
}
info := MigrateV2ResolveRecord{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}
// MigrateV2ResolveRaw resolves a disks migration and returns an array of bytes
func (d Disks) MigrateV2ResolveRaw(ctx context.Context, req MigrateV2ResolveRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/disks/migrate_v2_resolve"
res, err := d.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
return res, err
}
+477
View File
@@ -40,6 +40,24 @@ type IOTune struct {
// WriteIOPSSecMax
WriteIOPSSecMax uint64 `json:"write_iops_sec_max"`
// ReadBytesSecMaxLength
ReadBytesSecMaxLength uint64 `json:"read_bytes_sec_max_length"`
// ReadIOPSSecMaxLength
ReadIOPSSecMaxLength uint64 `json:"read_iops_sec_max_length"`
// TotalBytesSecMaxLength
TotalBytesSecMaxLength uint64 `json:"total_bytes_sec_max_length"`
// TotalIOPSSecMaxLength
TotalIOPSSecMaxLength uint64 `json:"total_iops_sec_max_length"`
// WriteBytesSecMaxLength
WriteBytesSecMaxLength uint64 `json:"write_bytes_sec_max_length"`
// WriteIOPSSecMaxLength
WriteIOPSSecMaxLength uint64 `json:"write_iops_sec_max_length"`
}
// Main information about disks
@@ -205,21 +223,51 @@ type InfoDisk struct {
}
type ItemReplication struct {
// Bandwidth
Bandwidth uint64 `json:"bandwidth"`
// CopyRate
CopyRate uint64 `json:"copy_rate"`
// DiskID
DiskID uint64 `json:"diskId"`
// LastSync
LastSync uint64 `json:"last_sync"`
// PairID
PairID string `json:"pair_id"`
// PoolID
PoolID string `json:"poolId"`
// ProfileID
ProfileID uint64 `json:"profile_id"`
// Role
Role string `json:"role"`
// ScheduleID
ScheduleID uint64 `json:"schedule_id"`
// ScheduleName
ScheduleName string `json:"schedule_name"`
// SelfVolumeID
SelfVolumeID string `json:"selfVolumeId"`
// Status
Status string `json:"status"`
// StorageID
StorageID string `json:"storageId"`
// Target
Target string `json:"target"`
// Type
Type string `json:"type"`
// VolumeID
VolumeID string `json:"volumeId"`
}
@@ -353,3 +401,432 @@ type MigrateStatus struct {
// Operation status
Ready bool `json:"ready"`
}
// MigrateV2SourceDisk describes a source disk of a migration
type MigrateV2SourceDisk struct {
// Disk ID
DiskID uint64 `json:"disk_id"`
// SEP ID
SEPID uint64 `json:"sep_id"`
// SEP type
SEPType string `json:"sep_type"`
// Pool name
PoolName string `json:"pool_name"`
// Storage policy ID
StoragePolicyID uint64 `json:"storage_policy_id"`
}
// MigrateV2RequestedTarget describes a requested target of a migration
type MigrateV2RequestedTarget struct {
// Disk IDs
DiskIDs []uint64 `json:"disk_ids"`
// SEP ID
SEPID uint64 `json:"sep_id"`
// SEP type
SEPType string `json:"sep_type"`
// Pool name
PoolName string `json:"pool_name"`
// Storage policy ID
StoragePolicyID uint64 `json:"storage_policy_id"`
}
// MigrateV2RequestedStorage describes a requested storage of a migration
type MigrateV2RequestedStorage struct {
// Targets
Targets []MigrateV2RequestedTarget `json:"targets"`
// Auto cleanup
AutoCleanup bool `json:"auto_cleanup"`
}
// MigrateV2Origin describes an origin of a migration
type MigrateV2Origin struct {
// Type
Type string `json:"type"`
// Correlation ID
CorrelationID string `json:"correlation_id"`
}
// MigrateV2Observation describes an observation of a migration progress
type MigrateV2Observation struct {
// Updated at
UpdatedAt float64 `json:"updated_at"`
// Agent job ID
AgentJobID string `json:"agent_job_id"`
// Attempt
Attempt uint64 `json:"attempt"`
// Operation
Operation string `json:"operation"`
}
// MigrateV2Memory describes a memory progress of a migration
type MigrateV2Memory struct {
// Sampled at
SampledAt float64 `json:"sampled_at"`
// Percent
Percent float64 `json:"percent"`
// Bytes per second
BytesPerSecond float64 `json:"bytes_per_second"`
// Processed bytes
ProcessedBytes uint64 `json:"processed_bytes"`
// Remaining bytes
RemainingBytes uint64 `json:"remaining_bytes"`
}
// MigrateV2ProgressItem describes a progress of a disk copy
type MigrateV2ProgressItem struct {
// Kind
Kind string `json:"kind"`
// Source disk ID
SourceDiskID uint64 `json:"source_disk_id"`
// Target disk ID
TargetDiskID uint64 `json:"target_disk_id"`
// Target dev
TargetDev string `json:"target_dev"`
// State
State string `json:"state"`
// Sampled at
SampledAt float64 `json:"sampled_at"`
// Percent
Percent float64 `json:"percent"`
// Bytes per second
BytesPerSecond float64 `json:"bytes_per_second"`
// Processed bytes
ProcessedBytes uint64 `json:"processed_bytes"`
// Remaining bytes
RemainingBytes uint64 `json:"remaining_bytes"`
}
// MigrateV2ProgressDisks describes a disks progress of a migration
type MigrateV2ProgressDisks struct {
// Sampled at
SampledAt float64 `json:"sampled_at"`
// Percent
Percent float64 `json:"percent"`
// Bytes per second
BytesPerSecond float64 `json:"bytes_per_second"`
// Processed bytes
ProcessedBytes uint64 `json:"processed_bytes"`
// Remaining bytes
RemainingBytes uint64 `json:"remaining_bytes"`
// Percent is estimated
PercentIsEstimated bool `json:"percent_is_estimated"`
// Disks total
DisksTotal uint64 `json:"disks_total"`
// Disks completed
DisksCompleted uint64 `json:"disks_completed"`
// Items
Items []MigrateV2ProgressItem `json:"items"`
}
// MigrateV2Progress describes a progress of a migration
type MigrateV2Progress struct {
// Observation
Observation MigrateV2Observation `json:"observation"`
// Memory
Memory MigrateV2Memory `json:"memory"`
// Disks
Disks MigrateV2ProgressDisks `json:"disks"`
}
// MigrateV2Disk describes a disk of a migration
type MigrateV2Disk struct {
// Source disk ID
SourceDiskID uint64 `json:"source_disk_id"`
// Target disk ID
TargetDiskID uint64 `json:"target_disk_id"`
// SEP ID
SEPID uint64 `json:"sep_id"`
// Pool name
PoolName string `json:"pool_name"`
// Storage policy ID
StoragePolicyID uint64 `json:"storage_policy_id"`
// State
State string `json:"state"`
// Copy node ID
CopyNodeID uint64 `json:"copy_node_id"`
// Copy state
CopyState string `json:"copy_state"`
// Writer stopped
WriterStopped bool `json:"writer_stopped"`
}
// MigrateV2CleanupInfo describes a cleanup of a migration
type MigrateV2CleanupInfo struct {
// Job ID
JobID string `json:"job_id"`
// Status
Status string `json:"status"`
// Error
Error string `json:"error"`
}
// MigrateV2Resolution describes a resolution of a migration
type MigrateV2Resolution struct {
// Resolved at
ResolvedAt string `json:"resolved_at"`
// Resolved by
ResolvedBy string `json:"resolved_by"`
// Request ID
RequestID string `json:"request_id"`
// Take over cleanup
TakeOverCleanup bool `json:"take_over_cleanup"`
// Previous status
PreviousStatus string `json:"previous_status"`
// Previous cleanup required
PreviousCleanupRequired bool `json:"previous_cleanup_required"`
// Previous error
PreviousError string `json:"previous_error"`
}
// MigrateV2Item describes a disks migration in a list
type MigrateV2Item struct {
// Workflow job ID
WorkflowJobID string `json:"workflow_job_id"`
// User
User string `json:"user"`
// Execution kind
ExecutionKind string `json:"execution_kind"`
// Bandwidth bytes per second
BandwidthBytesPerSecond uint64 `json:"bandwidth_bytes_per_second"`
// Copy parallelism
CopyParallelism uint64 `json:"copy_parallelism"`
// Source disks
SourceDisks []MigrateV2SourceDisk `json:"source_disks"`
// Requested storage
RequestedStorage MigrateV2RequestedStorage `json:"requested_storage"`
// Disk plan ready
DiskPlanReady bool `json:"disk_plan_ready"`
// Disk IDs
DiskIDs []uint64 `json:"disk_ids"`
// Disk IDs not copied
DiskIDsNotCopied []uint64 `json:"disk_ids_not_copied"`
// Account ID
AccountID uint64 `json:"account_id"`
// Origin
Origin MigrateV2Origin `json:"origin"`
// Status
Status string `json:"status"`
// Progress
Progress MigrateV2Progress `json:"progress"`
// Migration result confirmed
MigrationResultConfirmed bool `json:"migration_result_confirmed"`
// Offline commit started
OfflineCommitStarted bool `json:"offline_commit_started"`
// Disks
Disks []MigrateV2Disk `json:"disks"`
// Error
Error string `json:"error"`
// Cleanup required
CleanupRequired bool `json:"cleanup_required"`
// Cleanup
Cleanup MigrateV2CleanupInfo `json:"cleanup"`
// Resolution
Resolution MigrateV2Resolution `json:"resolution"`
// Created at
CreatedAt string `json:"created_at"`
// Updated at
UpdatedAt string `json:"updated_at"`
}
// ListMigrateV2 is a list of disks migrations
type ListMigrateV2 struct {
// Entry count
EntryCount uint64 `json:"entry_count"`
// Data
Data []MigrateV2Item `json:"data"`
}
// MigrateV2Record describes detailed information about a disks migration
type MigrateV2Record struct {
// Workflow job ID
WorkflowJobID string `json:"workflow_job_id"`
// User
User string `json:"user"`
// Execution kind
ExecutionKind string `json:"execution_kind"`
// Bandwidth bytes per second
BandwidthBytesPerSecond uint64 `json:"bandwidth_bytes_per_second"`
// Copy parallelism
CopyParallelism uint64 `json:"copy_parallelism"`
// Source disks
SourceDisks []MigrateV2SourceDisk `json:"source_disks"`
// Requested storage
RequestedStorage MigrateV2RequestedStorage `json:"requested_storage"`
// Disk plan ready
DiskPlanReady bool `json:"disk_plan_ready"`
// Disk IDs
DiskIDs []uint64 `json:"disk_ids"`
// Disk IDs not copied
DiskIDsNotCopied []uint64 `json:"disk_ids_not_copied"`
// Account ID
AccountID uint64 `json:"account_id"`
// Origin
Origin MigrateV2Origin `json:"origin"`
// Status
Status string `json:"status"`
// Progress
Progress MigrateV2Progress `json:"progress"`
// Migration result confirmed
MigrationResultConfirmed bool `json:"migration_result_confirmed"`
// Offline commit started
OfflineCommitStarted bool `json:"offline_commit_started"`
// Disks
Disks []MigrateV2Disk `json:"disks"`
// Error
Error string `json:"error"`
// Cleanup required
CleanupRequired bool `json:"cleanup_required"`
// Cleanup
Cleanup MigrateV2CleanupInfo `json:"cleanup"`
// Resolution
Resolution MigrateV2Resolution `json:"resolution"`
// Created at
CreatedAt string `json:"created_at"`
// Updated at
UpdatedAt string `json:"updated_at"`
// Logs
Logs []string `json:"logs"`
}
// MigrateV2AbortResult describes a result of a migration abort
type MigrateV2AbortResult struct {
// Workflow job ID
WorkflowJobID string `json:"workflow_job_id"`
// Disk IDs
DiskIDs []uint64 `json:"disk_ids"`
// Status
Status string `json:"status"`
// Job ID
JobID string `json:"job_id"`
// Message
Message string `json:"message"`
}
// MigrateV2AbortRecord describes results of migrations abort
type MigrateV2AbortRecord struct {
// Results
Results []MigrateV2AbortResult `json:"results"`
}
// MigrateV2ResolveRecord describes a result of a migration resolve
type MigrateV2ResolveRecord struct {
// Workflow job ID
WorkflowJobID string `json:"workflow_job_id"`
// Disk IDs
DiskIDs []uint64 `json:"disk_ids"`
// Status
Status string `json:"status"`
// Cleanup required
CleanupRequired bool `json:"cleanup_required"`
// Resolution
Resolution MigrateV2Resolution `json:"resolution"`
// Message
Message string `json:"message"`
}
@@ -0,0 +1,39 @@
package disks
import (
"context"
"net/http"
"strconv"
"strings"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
)
type ReplicationCancelSyncRequest struct {
// Disk ID
// Required: true
DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"`
}
// ReplicationCancelSync cancels ongoing disk replication synchronization
func (d Disks) ReplicationCancelSync(ctx context.Context, req ReplicationCancelSyncRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/disks/replication_cancel_sync"
res, err := d.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(strings.TrimSpace(string(res)))
if err != nil {
return false, err
}
return result, nil
}
Loaded 100 of 114 files, more files were not shown because too many files have changed in this diff. Show more