Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee7a8ebb55 | ||
|
|
00994516ba | ||
|
|
bc8c2b40e9 | ||
|
|
5825bdfa9e | ||
|
|
70edc100d5 | ||
|
|
025a1274f4 | ||
|
|
dca445b69a | ||
|
|
2c7f0d29df |
No files matched your search
+16
-25
@@ -1,48 +1,39 @@
|
|||||||
## Version 16.3.0
|
## Version 16.11.0
|
||||||
|
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
Перечисленные методы будут удалены в `v1.17`
|
Перечисленные методы будут удалены в `v17.0`
|
||||||
|
|
||||||
| Метод | CloudAPI | CloudBroker |
|
| Метод | CloudAPI | CloudBroker |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| `account/AddUser` | :heavy_check_mark: | :heavy_check_mark: |
|
| `account/AddUser` | :heavy_check_mark: | :heavy_check_mark: |
|
||||||
| `account/DeleteUser` | :heavy_check_mark: | :heavy_check_mark: |
|
| `account/DeleteUser` | :heavy_check_mark: | :heavy_check_mark: |
|
||||||
| `account/UpdateUser` | :heavy_check_mark: | :heavy_check_mark: |
|
| `account/UpdateUser` | :heavy_check_mark: | :heavy_check_mark: |
|
||||||
|
| `compute/CreateTemplate` | :heavy_check_mark: | :heavy_check_mark: |
|
||||||
|
| `compute/CreateTemplateFromBlank` | :heavy_check_mark: | :heavy_check_mark: |
|
||||||
|
| `compute/DiskQOS` | :heavy_check_mark: | :heavy_check_mark: |
|
||||||
|
| `compute/Migrate` | :x: | :heavy_check_mark: |
|
||||||
|
| `compute/MigrateAbort` | :x: | :heavy_check_mark: |
|
||||||
|
| `compute/MigrateStorage` | :x: | :heavy_check_mark: |
|
||||||
|
| `compute/MigrateStorageAbort` | :x: | :heavy_check_mark: |
|
||||||
|
| `compute/MigrateStorageCleanUp` | :x: | :heavy_check_mark: |
|
||||||
|
| `compute/MigrateStorageInfo` | :x: | :heavy_check_mark: |
|
||||||
|
| `compute/MigrateStorageList` | :x: | :heavy_check_mark: |
|
||||||
| `compute/UserGrant` | :heavy_check_mark: | :heavy_check_mark: |
|
| `compute/UserGrant` | :heavy_check_mark: | :heavy_check_mark: |
|
||||||
| `compute/UserList` | :heavy_check_mark: | :heavy_check_mark: |
|
| `compute/UserList` | :heavy_check_mark: | :heavy_check_mark: |
|
||||||
| `compute/UserRevoke` | :heavy_check_mark: | :heavy_check_mark: |
|
| `compute/UserRevoke` | :heavy_check_mark: | :heavy_check_mark: |
|
||||||
| `compute/UserUpdate` | :heavy_check_mark: | :heavy_check_mark: |
|
| `compute/UserUpdate` | :heavy_check_mark: | :heavy_check_mark: |
|
||||||
|
| `disks/FromPlatformDisk` | :heavy_check_mark: | :heavy_check_mark: |
|
||||||
| `rg/AccessGrant` | :heavy_check_mark: | :heavy_check_mark: |
|
| `rg/AccessGrant` | :heavy_check_mark: | :heavy_check_mark: |
|
||||||
| `rg/AccessRevoke` | :heavy_check_mark: | :heavy_check_mark: |
|
| `rg/AccessRevoke` | :heavy_check_mark: | :heavy_check_mark: |
|
||||||
| `sep/ConfigFieldEdit` | :x: | :heavy_check_mark: |
|
| `sep/ConfigFieldEdit` | :x: | :heavy_check_mark: |
|
||||||
|
| `apiaccess/userList` | :x: | :heavy_check_mark: |
|
||||||
|
|
||||||
|
|
||||||
### Добавлено
|
### Исправлено
|
||||||
|
|
||||||
#### extnet
|
#### extnet
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-1034 | Методы `AsyncCreate`, `AsyncDeviceDeploy` и `AsyncSetHAMode` в cloudbroker/extnet |
|
| BGOS-1167 | Значение поля `AsyncMode` с `true` на `false` в структуре запроса `asyncWrapperCreateRequest` в методе `Create` в cloudbroker/extnet |
|
||||||
|
|
||||||
|
|
||||||
#### locations
|
|
||||||
| Идентификатор задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| BGOS-1032 | Вычисляемое поле `VMFoldersEnabled` в структуру ответа `ItemLocation` в cloudapi/locations |
|
|
||||||
|
|
||||||
#### vins
|
|
||||||
| Идентификатор задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| BGOS-1033 | Методы `AsyncCreateInAccount`, `AsyncCreateInRG`, `AsyncEnable`, `AsyncVNFDevRedeploy` и `AsyncVNFDevRestart` в cloudapi/vins |
|
|
||||||
| BGOS-1033 | Методы `AsyncCreateInAccount`, `AsyncCreateInRG`, `AsyncEnable`, `AsyncVNFDevRedeploy`, `AsyncVNFDevRestart` и `AsyncVNFDevStart` в cloudbroker/vins |
|
|
||||||
| BGOS-1033 | Структура запроса `DisableRequest` и метод `Disable` в cloudapi/vins |
|
|
||||||
| BGOS-1033 | Структура запроса `EnableRequest` и метод `Enable` в cloudapi/vins |
|
|
||||||
|
|
||||||
### Исправлено
|
|
||||||
|
|
||||||
#### kvmx86
|
|
||||||
| Идентификатор задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| BGOS-1040 | JSON-тэг опционального поля `AsyncMode` с `asyncMode` на `async_mode` в структуре запроса `CreateRequest` в cloudapi/kvmx86 и cloudbroker/kvmx86 |
|
|
||||||
@@ -126,6 +126,7 @@ go get -u repository.basistech.ru/BASIS/dynamix-golang-sdk/v16
|
|||||||
- `Trunk` - получение информации о транковых портах;
|
- `Trunk` - получение информации о транковых портах;
|
||||||
- `VFPool` - управление пулом виртуальных сетевых функций;
|
- `VFPool` - управление пулом виртуальных сетевых функций;
|
||||||
- `VINS` - управление виртуальными изолированными сетями;
|
- `VINS` - управление виртуальными изолированными сетями;
|
||||||
|
- `VMFolder` – управление директориями ВМ;
|
||||||
- `VGPU` - управление виртуальными графическими процессорами;
|
- `VGPU` - управление виртуальными графическими процессорами;
|
||||||
- `Zone` - управление зонами.
|
- `Zone` - управление зонами.
|
||||||
|
|
||||||
@@ -138,6 +139,7 @@ go get -u repository.basistech.ru/BASIS/dynamix-golang-sdk/v16
|
|||||||
- `Audit` - получение информации о событиях системы;
|
- `Audit` - получение информации о событиях системы;
|
||||||
- `APIAccess` - управление доступом к API и его объектам;
|
- `APIAccess` - управление доступом к API и его объектам;
|
||||||
- `Backup` - управление резервным копированием;
|
- `Backup` - управление резервным копированием;
|
||||||
|
- `BasisMPM` - управление в случае нехватки памяти;
|
||||||
- `BService` - управление группами виртуальных машин (computes);
|
- `BService` - управление группами виртуальных машин (computes);
|
||||||
- `Compute` - управление виртуальными машинами (индивидуально);
|
- `Compute` - управление виртуальными машинами (индивидуально);
|
||||||
- `Disks` - управление виртуальными дисками;
|
- `Disks` - управление виртуальными дисками;
|
||||||
@@ -166,7 +168,8 @@ go get -u repository.basistech.ru/BASIS/dynamix-golang-sdk/v16
|
|||||||
- `User` - управление пользователями (индивидуально);
|
- `User` - управление пользователями (индивидуально);
|
||||||
- `VGPU` - управление виртуальными графическими процессорами;
|
- `VGPU` - управление виртуальными графическими процессорами;
|
||||||
- `VFPool` - управление пулом виртуальных сетевых функций;
|
- `VFPool` - управление пулом виртуальных сетевых функций;
|
||||||
- `VINS` - управление виртуальными изолированными сетями.
|
- `VINS` - управление виртуальными изолированными сетями;
|
||||||
|
- `VMFolder` – управление директориями ВМ;
|
||||||
- `Zone` - управление зонами.
|
- `Zone` - управление зонами.
|
||||||
|
|
||||||
### SDN
|
### SDN
|
||||||
@@ -342,6 +345,7 @@ func main() {
|
|||||||
- `pkg/cloudapi/trunk` - для `Trunk`
|
- `pkg/cloudapi/trunk` - для `Trunk`
|
||||||
- `pkg/cloudapi/vfpool` - для `VFPool`
|
- `pkg/cloudapi/vfpool` - для `VFPool`
|
||||||
- `pkg/cloudapi/vins` - для `VINS`
|
- `pkg/cloudapi/vins` - для `VINS`
|
||||||
|
- `pkg/cloudapi/vmfolder` - для `VMFolder`
|
||||||
- `pkg/cloudapi/vgpu` - для `VGPU`
|
- `pkg/cloudapi/vgpu` - для `VGPU`
|
||||||
- `pkg/cloudapi/zone` - для `Zone`
|
- `pkg/cloudapi/zone` - для `Zone`
|
||||||
- **cloudbroker**:
|
- **cloudbroker**:
|
||||||
@@ -349,6 +353,7 @@ func main() {
|
|||||||
- `pkg/cloudbroker/audit` - для `Audit`
|
- `pkg/cloudbroker/audit` - для `Audit`
|
||||||
- `pkg/cloudbroker/apiaccess` - для `APIAccess`
|
- `pkg/cloudbroker/apiaccess` - для `APIAccess`
|
||||||
- `pkg/cloudbroker/backup` - для `Backup`
|
- `pkg/cloudbroker/backup` - для `Backup`
|
||||||
|
- `pkg/cloudbroker/basismpm` - для `BasisMPM`
|
||||||
- `pkg/cloudbroker/bservice` - для `Basic Service`
|
- `pkg/cloudbroker/bservice` - для `Basic Service`
|
||||||
- `pkg/cloudbroker/compute` - для `Compute`
|
- `pkg/cloudbroker/compute` - для `Compute`
|
||||||
- `pkg/cloudbroker/disks` - для `Disks`
|
- `pkg/cloudbroker/disks` - для `Disks`
|
||||||
@@ -378,6 +383,7 @@ func main() {
|
|||||||
- `pkg/cloudbroker/vgpu` - для `VGPU`
|
- `pkg/cloudbroker/vgpu` - для `VGPU`
|
||||||
- `pkg/cloudbroker/vfpool` - для `VFPool`
|
- `pkg/cloudbroker/vfpool` - для `VFPool`
|
||||||
- `pkg/cloudbroker/vins` - для `VINS`
|
- `pkg/cloudbroker/vins` - для `VINS`
|
||||||
|
- `pkg/cloudbroker/vmfolder` - для `VMFolder`
|
||||||
- `pkg/cloudbroker/zone` - для `Zone`
|
- `pkg/cloudbroker/zone` - для `Zone`
|
||||||
- **sdn**:
|
- **sdn**:
|
||||||
- `pkg/sdn/acsgroups` - для `Access groups`
|
- `pkg/sdn/acsgroups` - для `Access groups`
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ func (dc *DecortClient) getToken(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if resp.StatusCode != 200 {
|
if resp.StatusCode != 200 {
|
||||||
return fmt.Errorf("cannot get token: %s", tokenBytes)
|
return newHTTPError("cannot get token", resp.StatusCode, tokenBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// save token in config
|
// save token in config
|
||||||
@@ -297,8 +297,7 @@ func (dc *DecortClient) do(req *http.Request, ctype string) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle errors with status code other than 200
|
// handle errors with status code other than 200
|
||||||
err = fmt.Errorf("%s", respBytes)
|
return nil, newHTTPError("could not execute request", resp.StatusCode, respBytes)
|
||||||
return nil, fmt.Errorf("could not execute request: %w", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// isConnectionError checks if given error falls within specific and associated connection errors
|
// isConnectionError checks if given error falls within specific and associated connection errors
|
||||||
@@ -444,7 +443,7 @@ func getTokenExp(token string) (time.Time, error) {
|
|||||||
|
|
||||||
exp, ok := claims["exp"]
|
exp, ok := claims["exp"]
|
||||||
if !ok {
|
if !ok {
|
||||||
return time.Time{}, fmt.Errorf("exp time bot found")
|
return time.Time{}, fmt.Errorf("exp time not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
expTime := time.Unix(int64(exp.(float64)), 0)
|
expTime := time.Unix(int64(exp.(float64)), 0)
|
||||||
|
|||||||
+7
-13
@@ -5,7 +5,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -127,7 +126,7 @@ func (bdc *BVSDecortClient) DecortApiCall(ctx context.Context, method, url strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get token and retry in case of access denied
|
// get token and retry in case of access denied
|
||||||
if err.Error() == "access is denied" {
|
if HasStatusCode(err, http.StatusUnauthorized) {
|
||||||
_, err = bdc.GetToken(ctx)
|
_, err = bdc.GetToken(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -193,7 +192,7 @@ func (bdc *BVSDecortClient) DecortApiCallCtype(ctx context.Context, method, url,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get token and retry in case of access denied
|
// get token and retry in case of access denied
|
||||||
if err.Error() == "access is denied" {
|
if HasStatusCode(err, http.StatusUnauthorized) {
|
||||||
_, err = bdc.GetToken(ctx)
|
_, err = bdc.GetToken(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -243,7 +242,7 @@ func (bdc *BVSDecortClient) DecortApiCallMP(ctx context.Context, method, url str
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get token and retry in case of access denied
|
// get token and retry in case of access denied
|
||||||
if err.Error() == "access is denied" {
|
if HasStatusCode(err, http.StatusUnauthorized) {
|
||||||
_, err = bdc.GetToken(ctx)
|
_, err = bdc.GetToken(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -287,7 +286,7 @@ func (bdc *BVSDecortClient) GetToken(ctx context.Context) (config.Token, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if resp.StatusCode != 200 {
|
if resp.StatusCode != 200 {
|
||||||
return config.Token{}, fmt.Errorf("cannot get token: %s", tokenBytes)
|
return config.Token{}, newHTTPError("cannot get token", resp.StatusCode, tokenBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// save token in config
|
// save token in config
|
||||||
@@ -346,7 +345,7 @@ func (bdc *BVSDecortClient) RefreshToken(ctx context.Context) (config.Token, err
|
|||||||
}
|
}
|
||||||
|
|
||||||
if resp.StatusCode != 200 {
|
if resp.StatusCode != 200 {
|
||||||
return config.Token{}, fmt.Errorf("cannot refresh token: %s", tokenBytes)
|
return config.Token{}, newHTTPError("cannot refresh token", resp.StatusCode, tokenBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// save token in config
|
// save token in config
|
||||||
@@ -452,17 +451,12 @@ func (bdc *BVSDecortClient) do(req *http.Request, ctype string) ([]byte, error)
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle access denied and successful request
|
|
||||||
if resp.StatusCode == 401 {
|
|
||||||
return respBytes, errors.New("access is denied")
|
|
||||||
}
|
|
||||||
if resp.StatusCode == 200 {
|
if resp.StatusCode == 200 {
|
||||||
return respBytes, nil
|
return respBytes, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle errors with other status codes
|
// handle errors with status code other than 200 (401 triggers token refresh in callers)
|
||||||
err = fmt.Errorf("%s", respBytes)
|
return nil, newHTTPError("could not execute request", resp.StatusCode, respBytes)
|
||||||
return nil, fmt.Errorf("could not execute request: %w", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func trimBVSConfig(cfg *config.BVSConfig) config.BVSConfig {
|
func trimBVSConfig(cfg *config.BVSConfig) config.BVSConfig {
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package decortsdk
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// HTTPError is returned when the API responds with a non-successful status code.
|
||||||
|
type HTTPError struct {
|
||||||
|
StatusCode int
|
||||||
|
Body []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *HTTPError) Error() string {
|
||||||
|
return string(e.Body)
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsNotFound reports whether err contains an HTTPError with status 404.
|
||||||
|
func IsNotFound(err error) bool {
|
||||||
|
return HasStatusCode(err, http.StatusNotFound)
|
||||||
|
}
|
||||||
|
|
||||||
|
// HasStatusCode reports whether err contains an HTTPError with the given status code.
|
||||||
|
func HasStatusCode(err error, code int) bool {
|
||||||
|
var httpErr *HTTPError
|
||||||
|
return errors.As(err, &httpErr) && httpErr.StatusCode == code
|
||||||
|
}
|
||||||
|
|
||||||
|
func newHTTPError(prefix string, statusCode int, body []byte) error {
|
||||||
|
return fmt.Errorf("%s: %w", prefix, &HTTPError{StatusCode: statusCode, Body: body})
|
||||||
|
}
|
||||||
@@ -500,3 +500,90 @@ func memoryBalloonModeValidator(fe validator.FieldLevel) bool {
|
|||||||
|
|
||||||
return IsInSlice(fieldValue, memoryBalloonModeValues)
|
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)
|
||||||
|
}
|
||||||
@@ -367,6 +367,28 @@ func errorMessage(fe validator.FieldError) string {
|
|||||||
prefix,
|
prefix,
|
||||||
fe.Field(),
|
fe.Field(),
|
||||||
joinValues(sepTechStatusValues))
|
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()
|
return fe.Error()
|
||||||
|
|||||||
@@ -101,6 +101,11 @@ func registerAllValidators(validate *validator.Validate) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = validate.RegisterValidation("userMatch", userMatchValidator)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
err = validate.RegisterValidation("computeDataDisks", computeDataDisksValidator)
|
err = validate.RegisterValidation("computeDataDisks", computeDataDisksValidator)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -336,5 +341,82 @@ func registerAllValidators(validate *validator.Validate) error {
|
|||||||
return err
|
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
|
return nil
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ var (
|
|||||||
|
|
||||||
loaderTypeValues = []string{"linux", "windows", "unknown"}
|
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"}
|
languageValues = []string{"ru", "en"}
|
||||||
|
|
||||||
@@ -84,6 +84,18 @@ var (
|
|||||||
watchdogActionValues = []string{"reset", "shutdown", "poweroff", "pause", "none"}
|
watchdogActionValues = []string{"reset", "shutdown", "poweroff", "pause", "none"}
|
||||||
|
|
||||||
memoryBalloonModeValues = []string{"auto", "legacy", "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 (
|
const (
|
||||||
@@ -92,4 +104,37 @@ const (
|
|||||||
|
|
||||||
trunkTagsMin = 1
|
trunkTagsMin = 1
|
||||||
trunkTagsMax = 4095
|
trunkTagsMax = 4095
|
||||||
|
|
||||||
|
pressureThresholdMin = 5
|
||||||
|
pressureThresholdMax = 50
|
||||||
|
|
||||||
|
deflateThresholdMin = 10
|
||||||
|
deflateThresholdMax = 70
|
||||||
|
|
||||||
|
bufferPCTMin = 5
|
||||||
|
bufferPCTMax = 50
|
||||||
|
|
||||||
|
guaranteedPCTMin = 10
|
||||||
|
guaranteedPCTMax = 50
|
||||||
|
|
||||||
|
guaranteedABSMinMin = 256
|
||||||
|
guaranteedABSMinMax = 4096
|
||||||
|
|
||||||
|
shrinkThresholdPCTMin = 30
|
||||||
|
shrinkThresholdPCTMax = 90
|
||||||
|
|
||||||
|
balloonMaxShrinkPCTMin = 5
|
||||||
|
balloonMaxShrinkPCTMax = 25
|
||||||
|
|
||||||
|
balloonMaxGrowPCTMin = 5
|
||||||
|
balloonMaxGrowPCTMax = 25
|
||||||
|
|
||||||
|
vmChangeCooldownMin = 30
|
||||||
|
vmChangeCooldownMax = 300
|
||||||
|
|
||||||
|
emergencyReturnCooldownMin = 60
|
||||||
|
emergencyReturnCooldownMax = 1800
|
||||||
|
|
||||||
|
majorFaultThresholdMin = 1
|
||||||
|
majorFaultThresholdMax = 10000
|
||||||
)
|
)
|
||||||
+2
-3
@@ -210,7 +210,7 @@ func (ldc *LegacyDecortClient) getToken(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if resp.StatusCode != 200 {
|
if resp.StatusCode != 200 {
|
||||||
return fmt.Errorf("cannot get token: %s", tokenBytes)
|
return newHTTPError("cannot get token", resp.StatusCode, tokenBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// save token in config
|
// save token in config
|
||||||
@@ -291,8 +291,7 @@ func (ldc *LegacyDecortClient) do(req *http.Request, ctype string) ([]byte, erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle errors with status code other than 200
|
// handle errors with status code other than 200
|
||||||
err = fmt.Errorf("%s", respBytes)
|
return nil, newHTTPError("could not execute request", resp.StatusCode, respBytes)
|
||||||
return nil, fmt.Errorf("could not execute request: %w", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func trimLegacyConfig(cfg *config.LegacyConfig) config.LegacyConfig {
|
func trimLegacyConfig(cfg *config.LegacyConfig) config.LegacyConfig {
|
||||||
|
|||||||
@@ -17,6 +17,12 @@ type AddACLAccessRequest struct {
|
|||||||
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
|
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.
|
// AddACLAccess adds ACL access to an account.
|
||||||
func (a Account) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (bool, error) {
|
func (a Account) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -26,7 +32,12 @@ func (a Account) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (boo
|
|||||||
|
|
||||||
url := "/cloudapi/account/add_acl_access"
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -38,3 +49,25 @@ func (a Account) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (boo
|
|||||||
|
|
||||||
return result, nil
|
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
|
||||||
|
}
|
||||||
@@ -26,9 +26,15 @@ type AddUserRequest struct {
|
|||||||
AccessType string `url:"accesstype" json:"accesstype" validate:"required,accessType"`
|
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.
|
// 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) {
|
func (a Account) AddUser(ctx context.Context, req AddUserRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -37,7 +43,12 @@ func (a Account) AddUser(ctx context.Context, req AddUserRequest) (bool, error)
|
|||||||
|
|
||||||
url := "/cloudapi/account/addUser"
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -49,3 +60,27 @@ func (a Account) AddUser(ctx context.Context, req AddUserRequest) (bool, error)
|
|||||||
|
|
||||||
return result, nil
|
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
|
||||||
|
}
|
||||||
@@ -16,6 +16,12 @@ type DelACLAccessRequest struct {
|
|||||||
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
|
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.
|
// DelACLAccess deletes ACL access from an account.
|
||||||
func (a Account) DeleteACLAccess(ctx context.Context, req DelACLAccessRequest) (bool, error) {
|
func (a Account) DeleteACLAccess(ctx context.Context, req DelACLAccessRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -25,7 +31,12 @@ func (a Account) DeleteACLAccess(ctx context.Context, req DelACLAccessRequest) (
|
|||||||
|
|
||||||
url := "/cloudapi/account/del_acl_access"
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -37,3 +48,25 @@ func (a Account) DeleteACLAccess(ctx context.Context, req DelACLAccessRequest) (
|
|||||||
|
|
||||||
return result, nil
|
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
|
||||||
|
}
|
||||||
@@ -19,9 +19,15 @@ type DeleteUserRequest struct {
|
|||||||
UserID string `url:"userId" json:"userId" validate:"required"`
|
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
|
// 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) {
|
func (a Account) DeleteUser(ctx context.Context, req DeleteUserRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -30,7 +36,12 @@ func (a Account) DeleteUser(ctx context.Context, req DeleteUserRequest) (bool, e
|
|||||||
|
|
||||||
url := "/cloudapi/account/deleteUser"
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -42,3 +53,27 @@ func (a Account) DeleteUser(ctx context.Context, req DeleteUserRequest) (bool, e
|
|||||||
|
|
||||||
return result, nil
|
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
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@ type ListVINSRequest struct {
|
|||||||
|
|
||||||
// Find by VINS ID
|
// Find by VINS ID
|
||||||
// Required: false
|
// Required: false
|
||||||
VINSID uint64 `url:"vins,omitempty" json:"vinsId,omitempty"`
|
VINSID uint64 `url:"vinsId,omitempty" json:"vinsId,omitempty"`
|
||||||
|
|
||||||
// Find by name
|
// Find by name
|
||||||
// Required: false
|
// Required: false
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ type RestoreRequest struct {
|
|||||||
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
|
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
|
// Restore restores a deleted account
|
||||||
func (a Account) Restore(ctx context.Context, req RestoreRequest) (string, error) {
|
func (a Account) Restore(ctx context.Context, req RestoreRequest) (string, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -23,10 +29,37 @@ func (a Account) Restore(ctx context.Context, req RestoreRequest) (string, error
|
|||||||
|
|
||||||
url := "/cloudapi/account/restore"
|
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 {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
return string(result), nil
|
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
|
||||||
|
}
|
||||||
@@ -56,6 +56,12 @@ type UpdateRequest struct {
|
|||||||
DefaultZoneID uint64 `url:"defaultZoneId,omitempty" json:"defaultZoneId,omitempty"`
|
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
|
// Update updates an account name and resource types and limits
|
||||||
func (a Account) Update(ctx context.Context, req UpdateRequest) (bool, error) {
|
func (a Account) Update(ctx context.Context, req UpdateRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -65,7 +71,12 @@ func (a Account) Update(ctx context.Context, req UpdateRequest) (bool, error) {
|
|||||||
|
|
||||||
url := "/cloudapi/account/update"
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -77,3 +88,25 @@ func (a Account) Update(ctx context.Context, req UpdateRequest) (bool, error) {
|
|||||||
|
|
||||||
return result, nil
|
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
|
||||||
|
}
|
||||||
@@ -17,6 +17,12 @@ type UpdateACLAccessRequest struct {
|
|||||||
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
|
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.
|
// UpdateACLAccess updates ACL access in an account.
|
||||||
func (a Account) UpdateACLAccess(ctx context.Context, req UpdateACLAccessRequest) (bool, error) {
|
func (a Account) UpdateACLAccess(ctx context.Context, req UpdateACLAccessRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -26,7 +32,12 @@ func (a Account) UpdateACLAccess(ctx context.Context, req UpdateACLAccessRequest
|
|||||||
|
|
||||||
url := "/cloudapi/account/update_acl_access"
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -38,3 +49,25 @@ func (a Account) UpdateACLAccess(ctx context.Context, req UpdateACLAccessRequest
|
|||||||
|
|
||||||
return result, nil
|
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
|
||||||
|
}
|
||||||
@@ -26,9 +26,15 @@ type UpdateUserRequest struct {
|
|||||||
AccessType string `url:"accesstype" json:"accesstype" validate:"required,accessType"`
|
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
|
// 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) {
|
func (a Account) UpdateUser(ctx context.Context, req UpdateUserRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -37,7 +43,12 @@ func (a Account) UpdateUser(ctx context.Context, req UpdateUserRequest) (bool, e
|
|||||||
|
|
||||||
url := "/cloudapi/account/updateUser"
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -49,3 +60,27 @@ func (a Account) UpdateUser(ctx context.Context, req UpdateUserRequest) (bool, e
|
|||||||
|
|
||||||
return result, nil
|
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
|
||||||
|
}
|
||||||
@@ -63,6 +63,14 @@ type ListRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
AccountID uint64 `url:"account_id,omitempty" json:"account_id,omitempty"`
|
AccountID uint64 `url:"account_id,omitempty" json:"account_id,omitempty"`
|
||||||
|
|
||||||
|
// Find by disk id
|
||||||
|
// Required: false
|
||||||
|
DiskID uint64 `url:"disk_id,omitempty" json:"disk_id,omitempty"`
|
||||||
|
|
||||||
|
// Find by vm folder id
|
||||||
|
// Required: false
|
||||||
|
VMFolderID uint64 `url:"vmfolder_id,omitempty" json:"vmfolder_id,omitempty"`
|
||||||
|
|
||||||
// Find by vins id
|
// Find by vins id
|
||||||
// Required: false
|
// Required: false
|
||||||
VINSID uint64 `url:"vins_id,omitempty" json:"vins_id,omitempty"`
|
VINSID uint64 `url:"vins_id,omitempty" json:"vins_id,omitempty"`
|
||||||
@@ -92,7 +100,7 @@ type ListRequest struct {
|
|||||||
ExcludeAuditLines bool `url:"exclude_audit_lines,omitempty" json:"exclude_audit_lines,omitempty"`
|
ExcludeAuditLines bool `url:"exclude_audit_lines,omitempty" json:"exclude_audit_lines,omitempty"`
|
||||||
|
|
||||||
// Public Session ID
|
// Public Session ID
|
||||||
PublicSessionID string `json:"public_session_id"`
|
PublicSessionID string `url:"public_session_id,omitempty" json:"public_session_id,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List gets audit records for the specified account object
|
// List gets audit records for the specified account object
|
||||||
|
|||||||
@@ -88,6 +88,45 @@ type ItemAudit struct {
|
|||||||
|
|
||||||
// TTL
|
// TTL
|
||||||
TTL string `json:"_ttl"`
|
TTL string `json:"_ttl"`
|
||||||
|
|
||||||
|
// Resource group ID
|
||||||
|
ResgroupID uint64 `json:"resgroup_id"`
|
||||||
|
|
||||||
|
// Account ID
|
||||||
|
AccountID uint64 `json:"account_id"`
|
||||||
|
|
||||||
|
// Compute ID
|
||||||
|
ComputeID uint64 `json:"compute_id"`
|
||||||
|
|
||||||
|
// VINS ID
|
||||||
|
VINSID uint64 `json:"vins_id"`
|
||||||
|
|
||||||
|
// Service ID
|
||||||
|
ServiceID uint64 `json:"service_id"`
|
||||||
|
|
||||||
|
// K8S ID
|
||||||
|
K8SID uint64 `json:"k8s_id"`
|
||||||
|
|
||||||
|
// FLIPGroup ID
|
||||||
|
FLIPGroupID uint64 `json:"flipgroup_id"`
|
||||||
|
|
||||||
|
// Load balancer ID
|
||||||
|
LBID uint64 `json:"lb_id"`
|
||||||
|
|
||||||
|
// SEP ID
|
||||||
|
SEPID uint64 `json:"sep_id"`
|
||||||
|
|
||||||
|
// Node IDs
|
||||||
|
NodeIDs []uint64 `json:"node_ids"`
|
||||||
|
|
||||||
|
// Persistent disk IDs associated with the operation
|
||||||
|
DiskIDs []uint64 `json:"disk_ids"`
|
||||||
|
|
||||||
|
// VM folder ID
|
||||||
|
VMFolderID uint64 `json:"vmfolder_id"`
|
||||||
|
|
||||||
|
// API task ID for asynchronous calls
|
||||||
|
APITask string `json:"apitask"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of audits
|
// List of audits
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ type AbortSharedSnapshotMergeRequest struct {
|
|||||||
|
|
||||||
type wrapperAbortSharedSnapshotMergeRequest struct {
|
type wrapperAbortSharedSnapshotMergeRequest struct {
|
||||||
AbortSharedSnapshotMergeRequest
|
AbortSharedSnapshotMergeRequest
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// AbortSharedSnapshotMerge shared snapshots merge abort
|
// AbortSharedSnapshotMerge shared snapshots merge abort
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ package compute
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -40,26 +42,78 @@ type AffinityRuleAddRequest struct {
|
|||||||
// Value that must match the key to be taken into account when analyzing this rule
|
// Value that must match the key to be taken into account when analyzing this rule
|
||||||
// Required: true
|
// Required: true
|
||||||
Value string `url:"value" json:"value" validate:"required"`
|
Value string `url:"value" json:"value" validate:"required"`
|
||||||
|
|
||||||
|
// Migrate compute according to the rule
|
||||||
|
// Default: false
|
||||||
|
// Required: false
|
||||||
|
Migrate bool `url:"migrate" json:"migrate"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type wrapperAffinityRuleAddRequest struct {
|
||||||
|
AffinityRuleAddRequest
|
||||||
|
|
||||||
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// AffinityRuleAdd add affinity rule
|
// AffinityRuleAdd add affinity rule
|
||||||
func (c Compute) AffinityRuleAdd(ctx context.Context, req AffinityRuleAddRequest) (bool, error) {
|
func (c Compute) AffinityRuleAdd(ctx context.Context, req AffinityRuleAddRequest) (AffinityRuleAddResult, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
return AffinityRuleAddResult{}, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
url := "/cloudapi/compute/affinityRuleAdd"
|
url := "/cloudapi/compute/affinityRuleAdd"
|
||||||
|
|
||||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
aReq := wrapperAffinityRuleAddRequest{
|
||||||
if err != nil {
|
AffinityRuleAddRequest: req,
|
||||||
return false, err
|
AsyncMode: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, aReq)
|
||||||
|
if err != nil {
|
||||||
|
return AffinityRuleAddResult{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if !req.Migrate {
|
||||||
result, err := strconv.ParseBool(string(res))
|
result, err := strconv.ParseBool(string(res))
|
||||||
if err != nil {
|
return AffinityRuleAddResult{Ok: result}, err
|
||||||
return false, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, nil
|
var report MigrationReport
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &report)
|
||||||
|
if err != nil {
|
||||||
|
return AffinityRuleAddResult{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return AffinityRuleAddResult{Ok: report.Applied, MigrationReport: &report}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AsyncAffinityRuleAdd add affinity rule in async mode
|
||||||
|
func (c Compute) AsyncAffinityRuleAdd(ctx context.Context, req AffinityRuleAddRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/compute/affinityRuleAdd"
|
||||||
|
|
||||||
|
aReq := wrapperAffinityRuleAddRequest{
|
||||||
|
AffinityRuleAddRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, aReq)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
var resp string
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &resp)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
}
|
}
|
||||||
@@ -2,9 +2,11 @@ package compute
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -40,26 +42,78 @@ type AntiAffinityRuleAddRequest struct {
|
|||||||
// Value that must match the key to be taken into account when analyzing this rule
|
// Value that must match the key to be taken into account when analyzing this rule
|
||||||
// Required: true
|
// Required: true
|
||||||
Value string `url:"value" json:"value" validate:"required"`
|
Value string `url:"value" json:"value" validate:"required"`
|
||||||
|
|
||||||
|
// Migrate compute according to the rule
|
||||||
|
// Default: false
|
||||||
|
// Required: false
|
||||||
|
Migrate bool `url:"migrate" json:"migrate"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type wrapperAntiAffinityRuleAddRequest struct {
|
||||||
|
AntiAffinityRuleAddRequest
|
||||||
|
|
||||||
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// AntiAffinityRuleAdd add anti affinity rule
|
// AntiAffinityRuleAdd add anti affinity rule
|
||||||
func (c Compute) AntiAffinityRuleAdd(ctx context.Context, req AntiAffinityRuleAddRequest) (bool, error) {
|
func (c Compute) AntiAffinityRuleAdd(ctx context.Context, req AntiAffinityRuleAddRequest) (AntiAffinityRuleAddResult, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
return AntiAffinityRuleAddResult{}, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
url := "/cloudapi/compute/antiAffinityRuleAdd"
|
url := "/cloudapi/compute/antiAffinityRuleAdd"
|
||||||
|
|
||||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
aReq := wrapperAntiAffinityRuleAddRequest{
|
||||||
if err != nil {
|
AntiAffinityRuleAddRequest: req,
|
||||||
return false, err
|
AsyncMode: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, aReq)
|
||||||
|
if err != nil {
|
||||||
|
return AntiAffinityRuleAddResult{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if !req.Migrate {
|
||||||
result, err := strconv.ParseBool(string(res))
|
result, err := strconv.ParseBool(string(res))
|
||||||
if err != nil {
|
return AntiAffinityRuleAddResult{Ok: result}, err
|
||||||
return false, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, nil
|
var report MigrationReport
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &report)
|
||||||
|
if err != nil {
|
||||||
|
return AntiAffinityRuleAddResult{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return AntiAffinityRuleAddResult{Ok: report.Applied, MigrationReport: &report}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AsyncAntiAffinityRuleAdd add anti affinity rule in async mode
|
||||||
|
func (c Compute) AsyncAntiAffinityRuleAdd(ctx context.Context, req AntiAffinityRuleAddRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/compute/antiAffinityRuleAdd"
|
||||||
|
|
||||||
|
aReq := wrapperAntiAffinityRuleAddRequest{
|
||||||
|
AntiAffinityRuleAddRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, aReq)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
var resp string
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &resp)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@ type CDEjectRequest struct {
|
|||||||
type wrapperCDEjectRequest struct {
|
type wrapperCDEjectRequest struct {
|
||||||
CDEjectRequest
|
CDEjectRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CDEject eject CD image to compute's CD-ROM
|
// CDEject eject CD image to compute's CD-ROM
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ type CDInsertRequest struct {
|
|||||||
type wrapperCDInsertRequest struct {
|
type wrapperCDInsertRequest struct {
|
||||||
CDInsertRequest
|
CDInsertRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CDInsert insert new CD image to compute's CD-ROM
|
// CDInsert insert new CD image to compute's CD-ROM
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ type ChangeIPRequest struct {
|
|||||||
type wrapperChangeIPRequest struct {
|
type wrapperChangeIPRequest struct {
|
||||||
ChangeIPRequest
|
ChangeIPRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChangeIP change reserved IP for compute instance
|
// ChangeIP change reserved IP for compute instance
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ type ChangeLinkStateRequest struct {
|
|||||||
type wrapperChangeLinkStateRequest struct {
|
type wrapperChangeLinkStateRequest struct {
|
||||||
ChangeLinkStateRequest
|
ChangeLinkStateRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChangeLinkState changes the status link virtual of compute
|
// ChangeLinkState changes the status link virtual of compute
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type ChangeMTURequest struct {
|
|||||||
type wrapperChangeMTURequest struct {
|
type wrapperChangeMTURequest struct {
|
||||||
ChangeMTURequest
|
ChangeMTURequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChangeMTU change MTU for compute instance
|
// ChangeMTU change MTU for compute instance
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type ChangeQoSPoliciesRequest struct {
|
|||||||
type wrapperChangeQoSPoliciesRequest struct {
|
type wrapperChangeQoSPoliciesRequest struct {
|
||||||
ChangeQoSPoliciesRequest
|
ChangeQoSPoliciesRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChangeQoSPolicies change qos policies for compute
|
// ChangeQoSPolicies change qos policies for compute
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ type ChangeSecGroupsRequest struct {
|
|||||||
type wrapperChangeSecGroupsRequest struct {
|
type wrapperChangeSecGroupsRequest struct {
|
||||||
ChangeSecGroupsRequest
|
ChangeSecGroupsRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChangeSecGroups changes security groups for compute
|
// ChangeSecGroups changes security groups for compute
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ type CloneRequest struct {
|
|||||||
type wrapperCloneRequest struct {
|
type wrapperCloneRequest struct {
|
||||||
CloneRequest
|
CloneRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clone clones compute instance
|
// Clone clones compute instance
|
||||||
|
|||||||
@@ -22,10 +22,12 @@ type CreateTemplateRequest struct {
|
|||||||
type wrapperCreateTemplateRequest struct {
|
type wrapperCreateTemplateRequest struct {
|
||||||
CreateTemplateRequest
|
CreateTemplateRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateTemplate create template from compute instance
|
// CreateTemplate create template from compute instance
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) CreateTemplate(ctx context.Context, req CreateTemplateRequest) (string, error) {
|
func (c Compute) CreateTemplate(ctx context.Context, req CreateTemplateRequest) (string, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -39,10 +39,6 @@ type CreateTemplateFromBlankRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
Password string `url:"password,omitempty" json:"password,omitempty"`
|
Password string `url:"password,omitempty" json:"password,omitempty"`
|
||||||
|
|
||||||
// Account ID to make the image exclusive
|
|
||||||
// Required: false
|
|
||||||
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
|
|
||||||
|
|
||||||
// Pool for image create
|
// Pool for image create
|
||||||
// Required: false
|
// Required: false
|
||||||
PoolName string `url:"poolName,omitempty" json:"poolName,omitempty"`
|
PoolName string `url:"poolName,omitempty" json:"poolName,omitempty"`
|
||||||
@@ -55,11 +51,13 @@ type CreateTemplateFromBlankRequest struct {
|
|||||||
|
|
||||||
type wrapperCreateTemplateFromBlankRequest struct {
|
type wrapperCreateTemplateFromBlankRequest struct {
|
||||||
CreateTemplateFromBlankRequest
|
CreateTemplateFromBlankRequest
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateTemplateFromBlank creates template from boot disk of current compute in sync mode.
|
// CreateTemplateFromBlank creates template from boot disk of current compute in sync mode.
|
||||||
// It returns id of created compute and error.
|
// It returns id of created compute and error.
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) CreateTemplateFromBlank(ctx context.Context, req CreateTemplateFromBlankRequest) (uint64, error) {
|
func (c Compute) CreateTemplateFromBlank(ctx context.Context, req CreateTemplateFromBlankRequest) (uint64, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -88,6 +86,8 @@ func (c Compute) CreateTemplateFromBlank(ctx context.Context, req CreateTemplate
|
|||||||
|
|
||||||
// CreateTemplateFromBlankAsync creates template from boot disk of current compute in async mode.
|
// CreateTemplateFromBlankAsync creates template from boot disk of current compute in async mode.
|
||||||
// It returns guid of task and error.
|
// It returns guid of task and error.
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) CreateTemplateFromBlankAsync(ctx context.Context, req CreateTemplateFromBlankRequest) (string, error) {
|
func (c Compute) CreateTemplateFromBlankAsync(ctx context.Context, req CreateTemplateFromBlankRequest) (string, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type DeleteRequest struct {
|
|||||||
type wrapperDeleteRequest struct {
|
type wrapperDeleteRequest struct {
|
||||||
DeleteRequest
|
DeleteRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete deletes compute
|
// Delete deletes compute
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type DisableRequest struct {
|
|||||||
type wrapperDisableRequest struct {
|
type wrapperDisableRequest struct {
|
||||||
DisableRequest
|
DisableRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable disables compute
|
// Disable disables compute
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ type DiskAddRequest struct {
|
|||||||
type wrapperDiskAddRequest struct {
|
type wrapperDiskAddRequest struct {
|
||||||
DiskAddRequest
|
DiskAddRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiskAdd creates new disk and attach to compute
|
// DiskAdd creates new disk and attach to compute
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ type DiskAttachRequest struct {
|
|||||||
type wrapperDiskAttachRequest struct {
|
type wrapperDiskAttachRequest struct {
|
||||||
DiskAttachRequest
|
DiskAttachRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiskAttach attach disk to compute
|
// DiskAttach attach disk to compute
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type DiskDelRequest struct {
|
|||||||
type wrapperDiskDelRequest struct {
|
type wrapperDiskDelRequest struct {
|
||||||
DiskDelRequest
|
DiskDelRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiskDel delete disk and detach from compute
|
// DiskDel delete disk and detach from compute
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ type DiskDetachRequest struct {
|
|||||||
type wrapperDiskDetachRequest struct {
|
type wrapperDiskDetachRequest struct {
|
||||||
DiskDetachRequest
|
DiskDetachRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiskDetach detach disk from compute
|
// DiskDetach detach disk from compute
|
||||||
|
|||||||
@@ -26,10 +26,12 @@ type DiskQOSRequest struct {
|
|||||||
type wrapperDiskQOSRequest struct {
|
type wrapperDiskQOSRequest struct {
|
||||||
DiskQOSRequest
|
DiskQOSRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiskQOS change QoS of the disk
|
// DiskQOS change QoS of the disk
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) DiskQOS(ctx context.Context, req DiskQOSRequest) (bool, error) {
|
func (c Compute) DiskQOS(ctx context.Context, req DiskQOSRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -57,6 +59,8 @@ func (c Compute) DiskQOS(ctx context.Context, req DiskQOSRequest) (bool, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DiskQOSAsync changes QoS of the disk with AsyncMode
|
// DiskQOSAsync changes QoS of the disk with AsyncMode
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) DiskQOSAsync(ctx context.Context, req DiskQOSRequest) (string, error) {
|
func (c Compute) DiskQOSAsync(ctx context.Context, req DiskQOSRequest) (string, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type DiskResizeRequest struct {
|
|||||||
type wrapperDiskResizeRequest struct {
|
type wrapperDiskResizeRequest struct {
|
||||||
DiskResizeRequest
|
DiskResizeRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiskResize change disk size
|
// DiskResize change disk size
|
||||||
|
|||||||
@@ -20,13 +20,17 @@ type DiskSwitchToReplicationRequest struct {
|
|||||||
|
|
||||||
// Delete replication relationship
|
// Delete replication relationship
|
||||||
// Required: false
|
// Required: false
|
||||||
StopReplication bool `url:"stopReplication" json:"stopReplication"`
|
StopReplication bool `url:"stopReplication,omitempty" json:"stopReplication,omitempty"`
|
||||||
|
|
||||||
|
// Use planned failover for asynchronous replication
|
||||||
|
// Required: false
|
||||||
|
Planned interface{} `url:"planned,omitempty" json:"planned,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type wrapperDiskSwitchToReplicationRequest struct {
|
type wrapperDiskSwitchToReplicationRequest struct {
|
||||||
DiskSwitchToReplicationRequest
|
DiskSwitchToReplicationRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiskSwitchToReplication switches disk to it's replication
|
// DiskSwitchToReplication switches disk to it's replication
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type GuestAgentDisableRequest struct {
|
|||||||
type wrapperGuestAgentDisableRequest struct {
|
type wrapperGuestAgentDisableRequest struct {
|
||||||
GuestAgentDisableRequest
|
GuestAgentDisableRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable guest agent at a specific compute
|
// Disable guest agent at a specific compute
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type GuestAgentEnableRequest struct {
|
|||||||
type wrapperGuestAgentEnableRequest struct {
|
type wrapperGuestAgentEnableRequest struct {
|
||||||
GuestAgentEnableRequest
|
GuestAgentEnableRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable guest agent at a specific compute
|
// Enable guest agent at a specific compute
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type GuestAgentExecuteRequest struct {
|
|||||||
type wrapperGuestAgentExecuteRequest struct {
|
type wrapperGuestAgentExecuteRequest struct {
|
||||||
GuestAgentExecuteRequest
|
GuestAgentExecuteRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute guest agent command
|
// Execute guest agent command
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type GuestAgentFeatureUpdateRequest struct {
|
|||||||
type wrapperGuestAgentFeatureUpdateRequest struct {
|
type wrapperGuestAgentFeatureUpdateRequest struct {
|
||||||
GuestAgentFeatureUpdateRequest
|
GuestAgentFeatureUpdateRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Feature update guest agent
|
// Feature update guest agent
|
||||||
|
|||||||
@@ -63,6 +63,14 @@ type ListRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
ZoneID uint64 `url:"zone_id,omitempty" json:"zone_id,omitempty"`
|
ZoneID uint64 `url:"zone_id,omitempty" json:"zone_id,omitempty"`
|
||||||
|
|
||||||
|
// Find by VM folder ID
|
||||||
|
// Required: false
|
||||||
|
FolderID uint64 `url:"folder_id,omitempty" json:"folder_id,omitempty"`
|
||||||
|
|
||||||
|
// Include computes from descendant folders.
|
||||||
|
// Required: false
|
||||||
|
IncludeDescendants interface{} `url:"include_descendants,omitempty" json:"include_descendants,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
// Page number
|
// Page number
|
||||||
// Required: false
|
// Required: false
|
||||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ type MigrateToZoneRequest struct {
|
|||||||
type wrapperMigrateToZoneRequest struct {
|
type wrapperMigrateToZoneRequest struct {
|
||||||
MigrateToZoneRequest
|
MigrateToZoneRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MoveToRG moves compute instance to new resource group
|
// MoveToRG moves compute instance to new resource group
|
||||||
|
|||||||
@@ -575,6 +575,9 @@ type RecordCompute struct {
|
|||||||
// Zone ID
|
// Zone ID
|
||||||
// Required: false
|
// Required: false
|
||||||
ZoneID uint64 `json:"zoneId"`
|
ZoneID uint64 `json:"zoneId"`
|
||||||
|
|
||||||
|
// Folder ID
|
||||||
|
FolderID uint64 `json:"folder_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detailed information about ACL Access in a compute
|
// Detailed information about ACL Access in a compute
|
||||||
@@ -1104,6 +1107,9 @@ type ItemComputeDisk struct {
|
|||||||
// Created time
|
// Created time
|
||||||
CreatedTime uint64 `json:"createdTime"`
|
CreatedTime uint64 `json:"createdTime"`
|
||||||
|
|
||||||
|
// Whether CRT tracking is enabled
|
||||||
|
CRTTracking bool `json:"crt_tracking"`
|
||||||
|
|
||||||
// Device name
|
// Device name
|
||||||
DeviceName string `json:"devicename"`
|
DeviceName string `json:"devicename"`
|
||||||
|
|
||||||
@@ -1564,6 +1570,9 @@ type ItemCompute struct {
|
|||||||
|
|
||||||
// Zone ID
|
// Zone ID
|
||||||
ZoneID uint64 `json:"zoneId"`
|
ZoneID uint64 `json:"zoneId"`
|
||||||
|
|
||||||
|
// Folder ID
|
||||||
|
FolderID uint64 `json:"folder_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListInfoDisks
|
// ListInfoDisks
|
||||||
@@ -1743,3 +1752,47 @@ type CloneStatus struct {
|
|||||||
// Progress percent
|
// Progress percent
|
||||||
ProgressPercent int `json:"progress_percent"`
|
ProgressPercent int `json:"progress_percent"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type MigrationReportItem struct {
|
||||||
|
// ID of the compute instance
|
||||||
|
ComputeID uint64 `json:"compute_id"`
|
||||||
|
|
||||||
|
// Per-VM action result, not workflow status
|
||||||
|
// Should be one of:
|
||||||
|
// - migrated: migration completed; the rule may still be unsatisfied
|
||||||
|
// - skipped: migration was not needed or applicable
|
||||||
|
// - not_started: submission was not attempted
|
||||||
|
// - not_completed: completion is unconfirmed; the VM may have moved
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Action details, errors and final rule-placement warnings
|
||||||
|
Message string `json:"message"`
|
||||||
|
|
||||||
|
// Workflow ID for tracking, or nil if submission was not attempted.
|
||||||
|
// A non-nil ID does not confirm job acceptance
|
||||||
|
WorkflowJobID *string `json:"workflow_job_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MigrationReport struct {
|
||||||
|
// Rules were saved; does not confirm migration success or rule satisfaction
|
||||||
|
Applied bool `json:"applied"`
|
||||||
|
|
||||||
|
// Per-compute migration results
|
||||||
|
Migrations []MigrationReportItem `json:"migrations"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AffinityRuleAddResult struct {
|
||||||
|
// Result of the rule addition
|
||||||
|
Ok bool
|
||||||
|
|
||||||
|
// Migration report. Populated only when the request was made with Migrate=true, nil otherwise
|
||||||
|
MigrationReport *MigrationReport
|
||||||
|
}
|
||||||
|
|
||||||
|
type AntiAffinityRuleAddResult struct {
|
||||||
|
// Result of the rule addition
|
||||||
|
Ok bool
|
||||||
|
|
||||||
|
// Migration report. Populated only when the request was made with Migrate=true, nil otherwise
|
||||||
|
MigrationReport *MigrationReport
|
||||||
|
}
|
||||||
@@ -37,7 +37,7 @@ type MoveToRGRequest struct {
|
|||||||
type wrapperMoveToRGRequest struct {
|
type wrapperMoveToRGRequest struct {
|
||||||
MoveToRGRequest
|
MoveToRGRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MoveToRG moves compute instance to new resource group
|
// MoveToRG moves compute instance to new resource group
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ type NetAttachRequest struct {
|
|||||||
type wrapperNetAttachRequest struct {
|
type wrapperNetAttachRequest struct {
|
||||||
NetAttachRequest
|
NetAttachRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetAttach attaches network to compute and gets info about network
|
// NetAttach attaches network to compute and gets info about network
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type NetDetachRequest struct {
|
|||||||
type wrapperNetDetachRequest struct {
|
type wrapperNetDetachRequest struct {
|
||||||
NetDetachRequest
|
NetDetachRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetDetach detaches network from compute
|
// NetDetach detaches network from compute
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type PauseRequest struct {
|
|||||||
type wrapperPauseRequest struct {
|
type wrapperPauseRequest struct {
|
||||||
PauseRequest
|
PauseRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pause pause compute
|
// Pause pause compute
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ type PFWAddRequest struct {
|
|||||||
type wrapperPFWAddRequest struct {
|
type wrapperPFWAddRequest struct {
|
||||||
PFWAddRequest
|
PFWAddRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PFWAdd add port forward rule
|
// PFWAdd add port forward rule
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ type PFWDelRequest struct {
|
|||||||
type wrapperPFWDelRequest struct {
|
type wrapperPFWDelRequest struct {
|
||||||
PFWDelRequest
|
PFWDelRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PFWDel deletes port forward rule
|
// PFWDel deletes port forward rule
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ type PinToNodeRequest struct {
|
|||||||
type wrapperPinToNodeRequest struct {
|
type wrapperPinToNodeRequest struct {
|
||||||
PinToNodeRequest
|
PinToNodeRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PinToNode pin compute to current node
|
// PinToNode pin compute to current node
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type PowerCycleRequest struct {
|
|||||||
type wrapperPowerCycleRequest struct {
|
type wrapperPowerCycleRequest struct {
|
||||||
PowerCycleRequest
|
PowerCycleRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PowerCycle makes force stop and start compute
|
// PowerCycle makes force stop and start compute
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type RebootRequest struct {
|
|||||||
type wrapperRebootRequest struct {
|
type wrapperRebootRequest struct {
|
||||||
RebootRequest
|
RebootRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reboot reboots compute
|
// Reboot reboots compute
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ type RedeployRequest struct {
|
|||||||
type wrapperRedeployRequest struct {
|
type wrapperRedeployRequest struct {
|
||||||
RedeployRequest
|
RedeployRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redeploy redeploys compute
|
// Redeploy redeploys compute
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type ResetRequest struct {
|
|||||||
type wrapperResetRequest struct {
|
type wrapperResetRequest struct {
|
||||||
ResetRequest
|
ResetRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset resets compute
|
// Reset resets compute
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ func (r ResizeRequest) GetRAM() map[string]uint64 {
|
|||||||
type wrapperResizeRequest struct {
|
type wrapperResizeRequest struct {
|
||||||
ResizeRequest
|
ResizeRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resize resizes compute instance
|
// Resize resizes compute instance
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type RestoreRequest struct {
|
|||||||
type wrapperRestoreRequest struct {
|
type wrapperRestoreRequest struct {
|
||||||
RestoreRequest
|
RestoreRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore restores compute from recycle bin
|
// Restore restores compute from recycle bin
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type ResumeRequest struct {
|
|||||||
type wrapperResumeRequest struct {
|
type wrapperResumeRequest struct {
|
||||||
ResumeRequest
|
ResumeRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resume resume Compute from paused state
|
// Resume resume Compute from paused state
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ type SnapshotCreateRequest struct {
|
|||||||
|
|
||||||
type wrapperSnapshotCreateRequest struct {
|
type wrapperSnapshotCreateRequest struct {
|
||||||
SnapshotCreateRequest
|
SnapshotCreateRequest
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SnapshotCreate creates compute snapshot
|
// SnapshotCreate creates compute snapshot
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ type SnapshotDeleteRequest struct {
|
|||||||
type wrapperSnapshotDeleteRequeststruct struct {
|
type wrapperSnapshotDeleteRequeststruct struct {
|
||||||
SnapshotDeleteRequest
|
SnapshotDeleteRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SnapshotDelete deletes specified compute snapshot
|
// SnapshotDelete deletes specified compute snapshot
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type SnapshotRollbackRequest struct {
|
|||||||
|
|
||||||
type wrapperSnapshotRollbackRequest struct {
|
type wrapperSnapshotRollbackRequest struct {
|
||||||
SnapshotRollbackRequest
|
SnapshotRollbackRequest
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SnapshotRollback rollbacks specified compute snapshot
|
// SnapshotRollback rollbacks specified compute snapshot
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ type StartRequest struct {
|
|||||||
type wrapperStartRequest struct {
|
type wrapperStartRequest struct {
|
||||||
StartRequest
|
StartRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start starts compute
|
// Start starts compute
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ type StopRequest struct {
|
|||||||
type wrapperStopRequest struct {
|
type wrapperStopRequest struct {
|
||||||
StopRequest
|
StopRequest
|
||||||
|
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop stops compute
|
// Stop stops compute
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ type UpdateRequest struct {
|
|||||||
|
|
||||||
// Memory balloon mode. One of ["auto","legacy","none"]
|
// Memory balloon mode. One of ["auto","legacy","none"]
|
||||||
// Required: false
|
// Required: false
|
||||||
// Default: "auto"
|
// Default: none
|
||||||
MemoryBalloonMode string `url:"memory_balloon_mode,omitempty" json:"memory_balloon_mode,omitempty" validate:"omitempty,memoryBalloonMode"`
|
MemoryBalloonMode string `url:"memory_balloon_mode,omitempty" json:"memory_balloon_mode,omitempty" validate:"omitempty,memoryBalloonMode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ type UserGrantRequest struct {
|
|||||||
|
|
||||||
// UserGrant grants user access to the compute
|
// 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) {
|
func (c Compute) UserGrant(ctx context.Context, req UserGrantRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ type UserListRequest struct {
|
|||||||
|
|
||||||
// UserList gets users list for compute
|
// 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) {
|
func (c Compute) UserList(ctx context.Context, req UserListRequest) (*ListUsers, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ type UserRevokeRequest struct {
|
|||||||
|
|
||||||
// UserRevoke revokes user access to the compute
|
// 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) {
|
func (c Compute) UserRevoke(ctx context.Context, req UserRevokeRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ type UserUpdateRequest struct {
|
|||||||
|
|
||||||
// UserUpdate updates user access to the compute
|
// 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) {
|
func (c Compute) UserUpdate(ctx context.Context, req UserUpdateRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -18,6 +18,11 @@ type ChangeDiskStoragePolicyRequest struct {
|
|||||||
// ID of the storage policy to which to connect for disk
|
// ID of the storage policy to which to connect for disk
|
||||||
// Required: true
|
// Required: true
|
||||||
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
|
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
|
||||||
|
|
||||||
|
// Keep current disk I/O tune settings in the domain XML
|
||||||
|
// Required: false
|
||||||
|
// Default: false
|
||||||
|
KeepCurrentIOTune interface{} `url:"keep_current_iotune,omitempty" json:"keep_current_iotune,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type wrapperChangeDiskStoragePolicyRequest struct {
|
type wrapperChangeDiskStoragePolicyRequest struct {
|
||||||
|
|||||||
@@ -35,10 +35,6 @@ type FromPlatformDiskRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
Password string `url:"password,omitempty" json:"password,omitempty"`
|
Password string `url:"password,omitempty" json:"password,omitempty"`
|
||||||
|
|
||||||
// Account ID to make the image exclusive
|
|
||||||
// Required: false
|
|
||||||
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
|
|
||||||
|
|
||||||
// Pool for image create
|
// Pool for image create
|
||||||
// Required: false
|
// Required: false
|
||||||
PoolName string `url:"poolName,omitempty" json:"poolName,omitempty"`
|
PoolName string `url:"poolName,omitempty" json:"poolName,omitempty"`
|
||||||
@@ -54,11 +50,13 @@ type FromPlatformDiskRequest struct {
|
|||||||
|
|
||||||
type wrapperFromPlatformDiskRequest struct {
|
type wrapperFromPlatformDiskRequest struct {
|
||||||
FromPlatformDiskRequest
|
FromPlatformDiskRequest
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// FromPlatformDisk creates template from platform disk in sync mode.
|
// FromPlatformDisk creates template from platform disk in sync mode.
|
||||||
// It returns id of created disk and error.
|
// It returns id of created disk and error.
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (d Disks) FromPlatformDisk(ctx context.Context, req FromPlatformDiskRequest) (uint64, error) {
|
func (d Disks) FromPlatformDisk(ctx context.Context, req FromPlatformDiskRequest) (uint64, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -87,6 +85,8 @@ func (d Disks) FromPlatformDisk(ctx context.Context, req FromPlatformDiskRequest
|
|||||||
|
|
||||||
// FromPlatformDiskAsync creates template from platform disk in async mode.
|
// FromPlatformDiskAsync creates template from platform disk in async mode.
|
||||||
// It returns guid of task and error.
|
// It returns guid of task and error.
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (d Disks) FromPlatformDiskAsync(ctx context.Context, req FromPlatformDiskRequest) (string, error) {
|
func (d Disks) FromPlatformDiskAsync(ctx context.Context, req FromPlatformDiskRequest) (string, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -67,6 +67,30 @@ type LimitIORequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
WriteIOPSSecMax uint64 `url:"write_iops_sec_max,omitempty" json:"write_iops_sec_max,omitempty"`
|
WriteIOPSSecMax uint64 `url:"write_iops_sec_max,omitempty" json:"write_iops_sec_max,omitempty"`
|
||||||
|
|
||||||
|
// Duration in seconds of the total bytes burst. Requires TotalBytesSecMax
|
||||||
|
// Required: false
|
||||||
|
TotalBytesSecMaxLength uint64 `url:"total_bytes_sec_max_length,omitempty" json:"total_bytes_sec_max_length,omitempty"`
|
||||||
|
|
||||||
|
// Duration in seconds of the read bytes burst. Requires ReadBytesSecMax
|
||||||
|
// Required: false
|
||||||
|
ReadBytesSecMaxLength uint64 `url:"read_bytes_sec_max_length,omitempty" json:"read_bytes_sec_max_length,omitempty"`
|
||||||
|
|
||||||
|
// Duration in seconds of the write bytes burst. Requires WriteBytesSecMax
|
||||||
|
// Required: false
|
||||||
|
WriteBytesSecMaxLength uint64 `url:"write_bytes_sec_max_length,omitempty" json:"write_bytes_sec_max_length,omitempty"`
|
||||||
|
|
||||||
|
// Duration in seconds of the total IOPS burst. Requires TotalIOPSSecMax
|
||||||
|
// Required: false
|
||||||
|
TotalIOPSSecMaxLength uint64 `url:"total_iops_sec_max_length,omitempty" json:"total_iops_sec_max_length,omitempty"`
|
||||||
|
|
||||||
|
// Duration in seconds of the read IOPS burst. Requires ReadIOPSSecMax
|
||||||
|
// Required: false
|
||||||
|
ReadIOPSSecMaxLength uint64 `url:"read_iops_sec_max_length,omitempty" json:"read_iops_sec_max_length,omitempty"`
|
||||||
|
|
||||||
|
// Duration in seconds of the write IOPS burst. Requires WriteIOPSSecMax
|
||||||
|
// Required: false
|
||||||
|
WriteIOPSSecMaxLength uint64 `url:"write_iops_sec_max_length,omitempty" json:"write_iops_sec_max_length,omitempty"`
|
||||||
|
|
||||||
// SizeIOPSSec
|
// SizeIOPSSec
|
||||||
// Required: false
|
// Required: false
|
||||||
SizeIOPSSec uint64 `url:"size_iops_sec,omitempty" json:"size_iops_sec,omitempty"`
|
SizeIOPSSec uint64 `url:"size_iops_sec,omitempty" json:"size_iops_sec,omitempty"`
|
||||||
|
|||||||
@@ -154,6 +154,9 @@ type ItemDisk struct {
|
|||||||
|
|
||||||
// Cache mode of disk
|
// Cache mode of disk
|
||||||
Cache string `json:"cache"`
|
Cache string `json:"cache"`
|
||||||
|
|
||||||
|
// Whether CRT is tracked
|
||||||
|
CRTTracking bool `json:"crt_tracking"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ItemDiskUnattached struct {
|
type ItemDiskUnattached struct {
|
||||||
@@ -300,6 +303,9 @@ type ItemDiskUnattached struct {
|
|||||||
|
|
||||||
// Virtual machine ID
|
// Virtual machine ID
|
||||||
VMID uint64 `json:"vmid"`
|
VMID uint64 `json:"vmid"`
|
||||||
|
|
||||||
|
// Whether CRT is tracked
|
||||||
|
CRTTracking bool `json:"crt_tracking"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of disks searched
|
// List of disks searched
|
||||||
@@ -549,24 +555,57 @@ type RecordDisk struct {
|
|||||||
|
|
||||||
// Cache mode of disk
|
// Cache mode of disk
|
||||||
Cache string `json:"cache"`
|
Cache string `json:"cache"`
|
||||||
|
|
||||||
|
// Whether CRT is tracked
|
||||||
|
CRTTracking bool `json:"crt_tracking"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ItemReplication struct {
|
type ItemReplication struct {
|
||||||
|
// Bandwidth
|
||||||
|
Bandwidth uint64 `json:"bandwidth"`
|
||||||
|
|
||||||
|
// CopyRate
|
||||||
|
CopyRate uint64 `json:"copy_rate"`
|
||||||
|
|
||||||
// DiskID
|
// DiskID
|
||||||
DiskID uint64 `json:"diskId"`
|
DiskID uint64 `json:"diskId"`
|
||||||
|
|
||||||
|
// LastSync
|
||||||
|
LastSync uint64 `json:"last_sync"`
|
||||||
|
|
||||||
|
// PairID
|
||||||
|
PairID string `json:"pair_id"`
|
||||||
|
|
||||||
// PoolID
|
// PoolID
|
||||||
PoolID string `json:"poolId"`
|
PoolID string `json:"poolId"`
|
||||||
|
|
||||||
|
// ProfileID
|
||||||
|
ProfileID uint64 `json:"profile_id"`
|
||||||
|
|
||||||
// Role
|
// Role
|
||||||
Role string `json:"role"`
|
Role string `json:"role"`
|
||||||
|
|
||||||
|
// ScheduleID
|
||||||
|
ScheduleID uint64 `json:"schedule_id"`
|
||||||
|
|
||||||
|
// ScheduleName
|
||||||
|
ScheduleName string `json:"schedule_name"`
|
||||||
|
|
||||||
// SelfVolumeID
|
// SelfVolumeID
|
||||||
SelfVolumeID string `json:"selfVolumeId"`
|
SelfVolumeID string `json:"selfVolumeId"`
|
||||||
|
|
||||||
|
// Status
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
// StorageID
|
// StorageID
|
||||||
StorageID string `json:"storageId"`
|
StorageID string `json:"storageId"`
|
||||||
|
|
||||||
|
// Target
|
||||||
|
Target string `json:"target"`
|
||||||
|
|
||||||
|
// Type
|
||||||
|
Type string `json:"type"`
|
||||||
|
|
||||||
// VolumeID
|
// VolumeID
|
||||||
VolumeID string `json:"volumeId"`
|
VolumeID string `json:"volumeId"`
|
||||||
}
|
}
|
||||||
@@ -30,6 +30,14 @@ type ReplicateRequest struct {
|
|||||||
// ID of the storage policy under the disk will be created
|
// ID of the storage policy under the disk will be created
|
||||||
// Required: true
|
// Required: true
|
||||||
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
|
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
|
||||||
|
|
||||||
|
// Copy rate for an asynchronous replication pair (in MB/s)
|
||||||
|
// Required: false
|
||||||
|
CopyRate uint64 `url:"copy_rate,omitempty" json:"copy_rate,omitempty"`
|
||||||
|
|
||||||
|
// Name of the schedule from the replication profile
|
||||||
|
// Required: false
|
||||||
|
Schedule string `url:"schedule,omitempty" json:"schedule,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type wrapperReplicateRequest struct {
|
type wrapperReplicateRequest struct {
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package disks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ReplicationDisableScheduleRequest to remove the schedule from an asynchronous replication pair
|
||||||
|
type ReplicationDisableScheduleRequest struct {
|
||||||
|
// Disk ID
|
||||||
|
// Required: true
|
||||||
|
DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReplicationDisableScheduleRequest removes the schedule from an asynchronous replication pair
|
||||||
|
func (d Disks) ReplicationDisableSchedule(ctx context.Context, req ReplicationDisableScheduleRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/disks/replication_disable_schedule"
|
||||||
|
|
||||||
|
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package disks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ReplicationManualSyncRequest to start manual synchronization of an asynchronous replication pair
|
||||||
|
type ReplicationManualSyncRequest struct {
|
||||||
|
// Disk ID
|
||||||
|
// Required: true
|
||||||
|
DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReplicationManualSync starts manual synchronization of an asynchronous replication pair
|
||||||
|
func (d Disks) ReplicationManualSync(ctx context.Context, req ReplicationManualSyncRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/disks/replication_manual_sync"
|
||||||
|
|
||||||
|
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package disks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ReplicationPromoteRequest to promote the primary side of an asynchronous replication pair
|
||||||
|
type ReplicationPromoteRequest struct {
|
||||||
|
// Disk ID
|
||||||
|
// Required: true
|
||||||
|
DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type wrapperReplicationPromoteRequest struct {
|
||||||
|
ReplicationPromoteRequest
|
||||||
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReplicationPromote promotes the primary side of an asynchronous replication pair
|
||||||
|
func (d Disks) ReplicationPromote(ctx context.Context, req ReplicationPromoteRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/disks/replication_promote"
|
||||||
|
|
||||||
|
aReq := wrapperReplicationPromoteRequest{
|
||||||
|
ReplicationPromoteRequest: req,
|
||||||
|
AsyncMode: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReplicationPromoteAsync promotes the primary side of an asynchronous replication pair in async mode
|
||||||
|
func (d Disks) ReplicationPromoteAsync(ctx context.Context, req ReplicationPromoteRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/disks/replication_promote"
|
||||||
|
|
||||||
|
aReq := wrapperReplicationPromoteRequest{
|
||||||
|
ReplicationPromoteRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
var resp string
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &resp)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
@@ -14,6 +14,10 @@ type ReplicationReverseRequest struct {
|
|||||||
// Id of the disk
|
// Id of the disk
|
||||||
// Required: true
|
// Required: true
|
||||||
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
|
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
|
||||||
|
|
||||||
|
// Use planned failover for asynchronous replication
|
||||||
|
// Required: false
|
||||||
|
Planned interface{} `url:"planned,omitempty" json:"planned,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type wrapperReplicationReverseRequest struct {
|
type wrapperReplicationReverseRequest struct {
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package disks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ReplicationSetCopyRateRequest to set the copy rate of an asynchronous replication pair
|
||||||
|
type ReplicationSetCopyRateRequest struct {
|
||||||
|
// Disk ID
|
||||||
|
// Required: true
|
||||||
|
DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"`
|
||||||
|
|
||||||
|
// Copy rate in MB/s
|
||||||
|
// Required: true
|
||||||
|
CopyRate uint64 `url:"copy_rate" json:"copy_rate" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReplicationSetCopyRate sets the copy rate of an asynchronous replication pair
|
||||||
|
func (d Disks) ReplicationSetCopyRate(ctx context.Context, req ReplicationSetCopyRateRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/disks/replication_set_copy_rate"
|
||||||
|
|
||||||
|
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package disks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ReplicationSetScheduleRequest to apply a replication profile schedule to an asynchronous replication pair
|
||||||
|
type ReplicationSetScheduleRequest struct {
|
||||||
|
// Disk ID
|
||||||
|
// Required: true
|
||||||
|
DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"`
|
||||||
|
|
||||||
|
// ID of the replication profile assigned to the pair
|
||||||
|
// Required: true
|
||||||
|
ProfileID uint64 `url:"profile_id" json:"profile_id" validate:"required"`
|
||||||
|
|
||||||
|
// Name of the interval or calendar schedule from the profile
|
||||||
|
// Required: true
|
||||||
|
ScheduleName string `url:"schedule_name" json:"schedule_name" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReplicationSetSchedule applies a replication profile schedule to an asynchronous replication pair
|
||||||
|
func (d Disks) ReplicationSetSchedule(ctx context.Context, req ReplicationSetScheduleRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/disks/replication_set_schedule"
|
||||||
|
|
||||||
|
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -18,6 +18,14 @@ type ReplicationStartRequest struct {
|
|||||||
// ID of target disk. Secondary disk in replication
|
// ID of target disk. Secondary disk in replication
|
||||||
// Required: true
|
// Required: true
|
||||||
TargetDiskID uint64 `url:"targetDiskId" json:"targetDiskId" validate:"required"`
|
TargetDiskID uint64 `url:"targetDiskId" json:"targetDiskId" validate:"required"`
|
||||||
|
|
||||||
|
// Copy rate for an asynchronous replication pair (in MB/s)
|
||||||
|
// Required: false
|
||||||
|
CopyRate uint64 `url:"copy_rate,omitempty" json:"copy_rate,omitempty"`
|
||||||
|
|
||||||
|
// Name of the schedule from the replication profile
|
||||||
|
// Required: false
|
||||||
|
Schedule string `url:"schedule,omitempty" json:"schedule,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type wrapperReplicationStartRequest struct {
|
type wrapperReplicationStartRequest struct {
|
||||||
|
|||||||
@@ -34,6 +34,14 @@ type ListRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
ComputeIDs []uint64 `url:"computeIds,omitempty" json:"computeIds,omitempty"`
|
ComputeIDs []uint64 `url:"computeIds,omitempty" json:"computeIds,omitempty"`
|
||||||
|
|
||||||
|
// Find by account access
|
||||||
|
// Required: false
|
||||||
|
AccountAccess []uint64 `url:"accountAccess,omitempty" json:"accountAccess,omitempty"`
|
||||||
|
|
||||||
|
// Find by resource group access
|
||||||
|
// Required: false
|
||||||
|
RGAccess []uint64 `url:"rgAccess,omitempty" json:"rgAccess,omitempty"`
|
||||||
|
|
||||||
// Sort by one of supported fields, format +|-(field)
|
// Sort by one of supported fields, format +|-(field)
|
||||||
// Required: false
|
// Required: false
|
||||||
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
|
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
|
||||||
|
|||||||
@@ -93,6 +93,9 @@ type ItemReservation struct {
|
|||||||
// Account ID
|
// Account ID
|
||||||
AccountID uint64 `json:"account_id"`
|
AccountID uint64 `json:"account_id"`
|
||||||
|
|
||||||
|
// Auto assignable
|
||||||
|
AutoAssignable bool `json:"auto_assignable"`
|
||||||
|
|
||||||
// ClientType
|
// ClientType
|
||||||
ClientType string `json:"clientType"`
|
ClientType string `json:"clientType"`
|
||||||
|
|
||||||
@@ -127,6 +130,12 @@ type VNFs struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Excluded struct {
|
type Excluded struct {
|
||||||
|
// Account ID
|
||||||
|
AccountID uint64 `json:"account_id"`
|
||||||
|
|
||||||
|
// Auto assignable
|
||||||
|
AutoAssignable bool `json:"auto_assignable"`
|
||||||
|
|
||||||
// ClientType
|
// ClientType
|
||||||
ClientType string `json:"clientType"`
|
ClientType string `json:"clientType"`
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ type CreateRequest struct {
|
|||||||
|
|
||||||
type asyncWrapperCreateRequest struct {
|
type asyncWrapperCreateRequest struct {
|
||||||
CreateRequest
|
CreateRequest
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create creates image from a media identified by URL
|
// Create creates image from a media identified by URL
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -59,6 +59,14 @@ type ListRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
|
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
|
// Page number
|
||||||
// Required: false
|
// Required: false
|
||||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ type ItemImage struct {
|
|||||||
// Link to
|
// Link to
|
||||||
LinkTo uint64 `json:"linkTo"`
|
LinkTo uint64 `json:"linkTo"`
|
||||||
|
|
||||||
|
// Links to
|
||||||
|
LinksTo []uint64 `json:"linksTo"`
|
||||||
|
|
||||||
// Name
|
// Name
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|
||||||
@@ -214,4 +217,7 @@ type RecordImage struct {
|
|||||||
|
|
||||||
// Version
|
// Version
|
||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
|
|
||||||
|
// Real size of the image
|
||||||
|
RealSize uint64 `json:"real_size"`
|
||||||
}
|
}
|
||||||
@@ -230,6 +230,10 @@ type CreateRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
PreferredCPU []int64 `url:"preferredCpu,omitempty" json:"preferredCpu,omitempty" validate:"omitempty,preferredCPU"`
|
PreferredCPU []int64 `url:"preferredCpu,omitempty" json:"preferredCpu,omitempty" validate:"omitempty,preferredCPU"`
|
||||||
|
|
||||||
|
// List of PCI device IDs to attach to this VM
|
||||||
|
// Required: false
|
||||||
|
PCIdevices []uint64 `url:"pcidevices,omitempty" json:"pcidevices,omitempty"`
|
||||||
|
|
||||||
// Zone ID
|
// Zone ID
|
||||||
// Required: false
|
// Required: false
|
||||||
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
|
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
|
||||||
@@ -250,8 +254,12 @@ type CreateRequest struct {
|
|||||||
|
|
||||||
// Memory balloon mode. One of ["auto","legacy","none"]
|
// Memory balloon mode. One of ["auto","legacy","none"]
|
||||||
// Required: false
|
// Required: false
|
||||||
// Default: "auto"
|
// Default: none
|
||||||
MemoryBalloonMode string `url:"memory_balloon_mode,omitempty" json:"memory_balloon_mode,omitempty" validate:"omitempty,memoryBalloonMode"`
|
MemoryBalloonMode string `url:"memory_balloon_mode,omitempty" json:"memory_balloon_mode,omitempty" validate:"omitempty,memoryBalloonMode"`
|
||||||
|
|
||||||
|
// List of vGPU IDs to attach to the VM
|
||||||
|
// Required: false
|
||||||
|
VGPUs []uint64 `url:"vgpus,omitempty" json:"vgpus,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRAM returns RAM field values
|
// GetRAM returns RAM field values
|
||||||
|
|||||||
@@ -92,6 +92,10 @@ type CreateBlankRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
PreferredCPU []int64 `url:"preferredCpu,omitempty" json:"preferredCpu,omitempty" validate:"omitempty,preferredCPU"`
|
PreferredCPU []int64 `url:"preferredCpu,omitempty" json:"preferredCpu,omitempty" validate:"omitempty,preferredCPU"`
|
||||||
|
|
||||||
|
// List of PCI device IDs to attach to this VM
|
||||||
|
// Required: false
|
||||||
|
PCIdevices []uint64 `url:"pcidevices,omitempty" json:"pcidevices,omitempty"`
|
||||||
|
|
||||||
// VM type linux, windows or unknown
|
// VM type linux, windows or unknown
|
||||||
// Required: false
|
// Required: false
|
||||||
LoaderType string `url:"loaderType,omitempty" json:"loaderType,omitempty" validate:"omitempty,loaderType"`
|
LoaderType string `url:"loaderType,omitempty" json:"loaderType,omitempty" validate:"omitempty,loaderType"`
|
||||||
@@ -132,8 +136,12 @@ type CreateBlankRequest struct {
|
|||||||
|
|
||||||
// Memory balloon mode. One of ["auto","legacy","none"]
|
// Memory balloon mode. One of ["auto","legacy","none"]
|
||||||
// Required: false
|
// Required: false
|
||||||
// Default: "auto"
|
// Default: none
|
||||||
MemoryBalloonMode string `url:"memory_balloon_mode,omitempty" json:"memory_balloon_mode,omitempty" validate:"omitempty,memoryBalloonMode"`
|
MemoryBalloonMode string `url:"memory_balloon_mode,omitempty" json:"memory_balloon_mode,omitempty" validate:"omitempty,memoryBalloonMode"`
|
||||||
|
|
||||||
|
// List of vGPU IDs to attach to the VM
|
||||||
|
// Required: false
|
||||||
|
VGPUs []uint64 `url:"vgpus,omitempty" json:"vgpus,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRAM returns RAM field values
|
// GetRAM returns RAM field values
|
||||||
|
|||||||
@@ -46,6 +46,12 @@ type ItemLocation struct {
|
|||||||
|
|
||||||
// Are VM Folders enabled
|
// Are VM Folders enabled
|
||||||
VMFoldersEnabled bool `json:"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
|
// List of locations
|
||||||
@@ -56,3 +62,27 @@ type ListLocations struct {
|
|||||||
// Entry count
|
// Entry count
|
||||||
EntryCount uint64 `json:"entryCount"`
|
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"`
|
||||||
|
}
|
||||||
@@ -34,6 +34,10 @@ type ListRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
|
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
|
||||||
|
|
||||||
|
// Sort by node ID
|
||||||
|
// Required: false
|
||||||
|
NodeID uint64 `url:"node_id,omitempty" json:"node_id,omitempty"`
|
||||||
|
|
||||||
// Page number
|
// Page number
|
||||||
// Required: false
|
// Required: false
|
||||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ type AccessGrantRequest struct {
|
|||||||
|
|
||||||
// AccessGrant grants user or group access to the resource group as specified
|
// 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) {
|
func (r RG) AccessGrant(ctx context.Context, req AccessGrantRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ type AccessRevokeRequest struct {
|
|||||||
|
|
||||||
// AccessRevoke revokes specified user or group access from the resource group
|
// 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) {
|
func (r RG) AccessRevoke(ctx context.Context, req AccessRevokeRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ type Resource struct {
|
|||||||
|
|
||||||
// SEPs
|
// SEPs
|
||||||
SEPs map[string]map[string]DiskUsage `json:"seps"`
|
SEPs map[string]map[string]DiskUsage `json:"seps"`
|
||||||
|
|
||||||
|
// Policies
|
||||||
|
Policies map[string]PolicyUsage `json:"policies"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disk usage
|
// Disk usage
|
||||||
@@ -33,6 +36,21 @@ type DiskUsage struct {
|
|||||||
DiskSizeMax float64 `json:"disksizemax"`
|
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
|
// Information about resources
|
||||||
type Resources struct {
|
type Resources struct {
|
||||||
// Current information about resources
|
// Current information about resources
|
||||||
@@ -51,10 +69,31 @@ type ItemResourceConsumption struct {
|
|||||||
Reserved Resource `json:"reserved"`
|
Reserved Resource `json:"reserved"`
|
||||||
|
|
||||||
// Resource limits
|
// Resource limits
|
||||||
ResourceLimits ResourceLimits `json:"resourceLimits"`
|
ResourceLimits ResourceConsumptionLimits `json:"resourceLimits"`
|
||||||
|
|
||||||
// Resource group ID
|
// 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 {
|
type ListResourceConsumption struct {
|
||||||
@@ -892,4 +931,7 @@ type RecordResourceUsage struct {
|
|||||||
|
|
||||||
// SEPs
|
// SEPs
|
||||||
SEPs map[string]map[string]DiskUsage `json:"seps"`
|
SEPs map[string]map[string]DiskUsage `json:"seps"`
|
||||||
|
|
||||||
|
// Policies
|
||||||
|
Policies map[string]PolicyUsage `json:"policies"`
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package stpolicy
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetReplicationProfileRequest struct to get replication profile
|
||||||
|
type GetReplicationProfileRequest struct {
|
||||||
|
// ID of replication profile
|
||||||
|
// Required: true
|
||||||
|
ProfileID uint64 `url:"profile_id" json:"profile_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetReplicationProfile gets replication profile as an InfoReplicationProfile struct
|
||||||
|
func (sp StPolicy) GetReplicationProfile(ctx context.Context, req GetReplicationProfileRequest) (*InfoReplicationProfile, error) {
|
||||||
|
res, err := sp.GetReplicationProfileRaw(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := InfoReplicationProfile{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &info, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetReplicationProfileRaw gets replication profile as an array of bytes
|
||||||
|
func (sp StPolicy) GetReplicationProfileRaw(ctx context.Context, req GetReplicationProfileRequest) ([]byte, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/storage_policy/get_replication_profile"
|
||||||
|
|
||||||
|
res, err := sp.client.DecortApiCall(ctx, http.MethodGet, url, req)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
Loaded 100 of 337 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user