Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5825bdfa9e | ||
|
|
70edc100d5 | ||
|
|
025a1274f4 |
No files matched your search
+65
-42
@@ -1,79 +1,102 @@
|
|||||||
## Version 16.5.0
|
## Version 16.8.0
|
||||||
|
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
Перечисленные методы будут удалены в `v17.0.0`
|
Перечисленные методы будут удалены в `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: |
|
||||||
|
|
||||||
|
|
||||||
### Добавлено
|
### Добавлено
|
||||||
|
|
||||||
#### audit
|
#### apiaccess
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-1072 | Вычисляемые поля `ResgroupID`, `AccountID`, `ComputeID`, `VINSID`, `ServiceID`, `K8SID`, `FLIPGroupID`, `LBID`, `SEPID`, `NodeIDs`, `DiskIDs` и `APITask` в структуру ответа `ItemAudit` в cloudapi/audit |
|
| BGOS-1123 | Вычисляемое поле `BasisMPM` в структуру ответа `CloudBrokerEndpoints` в cloudbroker/apiaccess |
|
||||||
| BGOS-1072 | Вычисляемые поля `ResgroupID`, `AccountID`, `ComputeID`, `VINSID`, `ServiceID`, `K8SID`, `FLIPGroupID`, `LBID`, `SEPID`, `NodeIDs`, `DiskIDs` и `APITask` в структуру ответа `ItemAudit` в cloudbroker/audit |
|
|
||||||
|
#### basismpm
|
||||||
|
| Идентификатор задачи | Описание |
|
||||||
|
| --- | --- |
|
||||||
|
| BGOS-1123 | Структура запроса `StartRequest` и метод `Start` в cloudbroker/basismpm |
|
||||||
|
| BGOS-1123 | Структура запроса `StatusRequest` и метод `Status` в cloudbroker/basismpm |
|
||||||
|
| BGOS-1123 | Структура запроса `StopRequest` и метод `Stop` в cloudbroker/basismpm |
|
||||||
|
| BGOS-1123 | Структура запроса `UpdateRequest` и метод `Update` в cloudbroker/basismpm |
|
||||||
|
| BGOS-1123 | Структуры ответа `MemInfo` и `RecordBasisMPM` в cloudbroker/basismpm |
|
||||||
|
|
||||||
|
|
||||||
|
#### image
|
||||||
|
| Идентификатор задачи | Описание |
|
||||||
|
| --- | --- |
|
||||||
|
| BGOS-1124 | Структура запроса `CreateFromDiskRequest` и методы `CreateFromDisk` и `CreateFromDiskAsync` в cloudapi/image |
|
||||||
|
| BGOS-1124 | Структура запроса `CreateFromDiskRequest` и методы `CreateFromDisk` и `CreateFromDiskAsync` в cloudbroker/image |
|
||||||
|
|
||||||
#### compute
|
#### compute
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-1069 | Вычисляемое поле `FolderID` в структуры ответа `RecordCompute` и `ItemCompute` в cloudapi/compute |
|
| BGOS-1126 | Вычисляемые поля `PreviousReservesComputeResources` и `TakeOverResources` в структуру ответа `Resolution` в cloudbroker/compute |
|
||||||
| BGOS-1069 | Вычисляемое поле `FolderID` в структуры ответа `RecordCompute` и `InfoCompute` в cloudapi/compute |
|
| BGOS-1126 | Опциональное поле `TakeOverResources` в структуру запроса `MigrateV2ResolveRequest` в cloudbroker/compute |
|
||||||
| BGOS-1068 | Структуры ответа `MigrationReport`, `MigrationReportItem`, `AffinityRuleAddResult` и `AntiAffinityRuleAddResult` в cloudapi/compute |
|
| BGOS-1126 | Вычисляемое поле `Message` в структуру ответа `MigrateV2ResolveRecord` в cloudbroker/compute |
|
||||||
| BGOS-1068 | Структуры ответа `MigrationReport`, `MigrationReportItem`, `AffinityRuleAddResult` и `AntiAffinityRuleAddResult` в cloudbroker/compute |
|
| BGOS-1126 | Вычисляемые поля `DisksCompleted`, `CompletedDisks`, `DisksTotal` и `CurrentDisk` в структуру ответа `ProgressDisks` в cloudbroker/compute |
|
||||||
| BGOS-1063 | Структуры запроса `MigrateV2Request`, `MigrateV2AbortRequest`, `MigrateV2CleanupRequest`, `MigrateV2GetRequest`, `MigrateV2ListRequest` и `MigrateV2ResolveRequest` и методы `MigrateV2`, `MigrateV2Abort`, `MigrateV2Cleanup`, `MigrateV2Get`, `MigrateV2List` и `MigrateV2ResolveRequest` в cloudbroker/compute |
|
| BGOS-1126 | Структуры ответа `CompletedDisk` и `CurrentDisk` в cloudbroker/compute |
|
||||||
| BGOS-1080 | Опциональное поле `AccountID` из структуры запроса `CreateTemplateFromBlankRequest` в cloudapi/compute |
|
|
||||||
|
|
||||||
|
#### zone
|
||||||
|
| Идентификатор задачи | Описание |
|
||||||
|
| --- | --- |
|
||||||
|
| BGOS-1127 | Вычисляемое поле `DRSPortSeed` в структуры ответа `ItemZone` и `RecordZone` в cloudbroker/zone |
|
||||||
|
|
||||||
|
|
||||||
|
### Изменено
|
||||||
|
|
||||||
|
#### compute
|
||||||
|
| Идентификатор задачи | Описание |
|
||||||
|
| --- | --- |
|
||||||
|
| BGOS-1126 | Тип вычисляемого поля `UpdatedAt` с `uint64` на `float64` в структуре ответа `Observation` в cloudbroker/compute |
|
||||||
|
| BGOS-1126 | Тип вычисляемых полей `SampledAt`, `Percent` и `BytesPerSecond` с `uint64` на `float64` в структуре ответа `Memory` в cloudbroker/compute |
|
||||||
|
| BGOS-1126 | Тип вычисляемых полей `SampledAt`, `Percent` и `BytesPerSecond` с `uint64` на `float64` в структуре ответа `ProgressDisks` в cloudbroker/compute |
|
||||||
|
| BGOS-1126 | Тип вычисляемых полей `SampledAt`, `Percent` и `BytesPerSecond` с `uint64` на `float64` в структуре ответа `SystemDisk` в cloudbroker/compute |
|
||||||
|
| BGOS-1126 | Тип опционального поля `Storage` со `Storage` на `*Storage` в структуре запроса `MigrateV2Request` в cloudbroker/compute |
|
||||||
|
| BGOS-1126 | Тип поля `Targets` с опционального на обязательный в структуре запроса `Storage` в cloudbroker/compute |
|
||||||
|
| BGOS-1126 | Тэги `url` и `json` поля `Targets` с `targets` на `targets` в структуре запроса `Storage` в cloudbroker/compute |
|
||||||
|
|
||||||
#### disks
|
#### disks
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-1080 | Опциональное поле `AccountID` из структуры запроса `FromPlatformDiskRequest` в cloudapi/disks |
|
| BGOS-1128 | Тэги `url` и `json` поля `KeepCurrentIOTune` с `keep_current_iot` на `keep_current_iotune` в структуре запроса `ChangeDiskStoragePolicyRequest` в cloudbroker/disks |
|
||||||
|
| BGOS-1128 | Тэги `url` и `json` поля `KeepCurrentIOTune` с `keep_current_iot` на `keep_current_iotune` в структуре запроса `ChangeDiskStoragePolicyRequest` в cloudapi/disks |
|
||||||
|
|
||||||
#### extnet
|
#### client sdk
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-1073 | Вычисляемое поле `AutoAssignable` в структуру ответа `ItemReservation` в cloudapi/extnet |
|
| BGOS-1134 | При получении от сервера ответа с HTTP-кодом ошибки клиенты `DecortClient`, `LegacyDecortClient` и `BVSDecortClient` теперь возвращают ошибку типа `HTTPError` с полями `StatusCode` и `Body`. Для проверки статусов добавлены функции `IsNotFound` и `HasStatusCode` |
|
||||||
| BGOS-1073 | Вычисляемые поля `AccountID` и `AutoAssignable` в структуру ответа `Excluded` в cloudapi/extnet |
|
|
||||||
| BGOS-1073 | Вычисляемое поле `AutoAssignable` в структуру ответа `ItemReservation` в cloudbroker/extnet |
|
|
||||||
|
|
||||||
#### grid
|
### Исправлено
|
||||||
|
|
||||||
|
#### client sdk
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-1074 | Вычисляемое поле `VMFoldersEnabled` в структуры ответа `RecordGrid` и `ItemGridList` в cloudbroker/grid |
|
| BGOS-1135 | Исправлена ошибка в сообщении об ошибке при отсутствии времени истечения токена в клиенте |
|
||||||
|
|
||||||
#### kvmx86
|
|
||||||
| Идентификатор задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| BGOS-1067 | Опциональное поле `PCIdevices` в структуры запросов `CreateRequest` и `CreateBlankRequest` в cloudapi/kvmx86 |
|
|
||||||
| BGOS-1067 | Опциональное поле `PCIdevices` в структуры запросов `CreateRequest` и `CreateBlankRequest` в cloudbroker/kvmx86 |
|
|
||||||
| BGOS-1081 | Опциональное поле `VGPUs` в структуры запросов `CreateRequest` и `CreateBlankRequest` в cloudapi/kvmx86 |
|
|
||||||
| BGOS-1081 | Опциональное поле `VGPUs` в структуры запросов `CreateRequest` и `CreateBlankRequest` в cloudbroker/kvmx86 |
|
|
||||||
|
|
||||||
### Изменено
|
|
||||||
|
|
||||||
#### apiaccess
|
|
||||||
| Идентификатор задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| BGOS-1082 | Тип поля `APIs` с опционального на обязательный в структуре запроса `UpdateRequest` в cloudbroker/apiaccess |
|
|
||||||
|
|
||||||
#### compute
|
|
||||||
| Идентификатор задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| BGOS-1068 | Тип ответа метода `AffinityRuleAdd` с `bool` на структуру `AffinityRuleAddResult` в cloudapi/compute |
|
|
||||||
| BGOS-1068 | Тип ответа метода `AffinityRuleAdd` с `bool` на структуру `AffinityRuleAddResult` в cloudbroker/compute |
|
|
||||||
| BGOS-1068 | Тип ответа метода `AntiAffinityRuleAdd` с `bool` на структуру `AntiAffinityRuleAddResult` в cloudapi/compute |
|
|
||||||
| BGOS-1068 | Тип ответа метода `AntiAffinityRuleAdd` с `bool` на структуру `AntiAffinityRuleAddResult` в cloudbroker/compute |
|
|
||||||
|
|
||||||
@@ -139,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` - управление виртуальными дисками;
|
||||||
@@ -352,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`
|
||||||
|
|||||||
@@ -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,70 @@ 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)
|
||||||
|
}
|
||||||
|
|
||||||
|
// pressureThresholdValidator checks if PressureThreshold is in range from 5 to 50
|
||||||
|
func pressureThresholdValidator(fe validator.FieldLevel) bool {
|
||||||
|
fieldValue := fe.Field().Uint()
|
||||||
|
return fieldValue >= uint64(pressureThresholdMin) && fieldValue <= uint64(pressureThresholdMax)
|
||||||
|
}
|
||||||
|
|
||||||
|
// deflateThresholdValidator checks if DeflateThreshold is in range from 10 to 70
|
||||||
|
func deflateThresholdValidator(fe validator.FieldLevel) bool {
|
||||||
|
fieldValue := fe.Field().Uint()
|
||||||
|
return fieldValue >= uint64(deflateThresholdMin) && fieldValue <= uint64(deflateThresholdMax)
|
||||||
|
}
|
||||||
|
|
||||||
|
func bufferPCTValidator(fe validator.FieldLevel) bool {
|
||||||
|
fieldValue := fe.Field().Uint()
|
||||||
|
return fieldValue >= uint64(bufferPCTMin) && fieldValue <= uint64(bufferPCTMax)
|
||||||
|
}
|
||||||
|
|
||||||
|
func guaranteedPCTValidator(fe validator.FieldLevel) bool {
|
||||||
|
fieldValue := fe.Field().Uint()
|
||||||
|
return fieldValue >= uint64(guaranteedPCTMin) && fieldValue <= uint64(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().Uint()
|
||||||
|
return fieldValue >= uint64(shrinkThresholdPCTMin) && fieldValue <= uint64(shrinkThresholdPCTMax)
|
||||||
|
}
|
||||||
|
|
||||||
|
func balloonMaxShrinkPCTValidator(fe validator.FieldLevel) bool {
|
||||||
|
fieldValue := fe.Field().Uint()
|
||||||
|
return fieldValue >= uint64(balloonMaxShrinkPCTMin) && fieldValue <= uint64(balloonMaxShrinkPCTMax)
|
||||||
|
}
|
||||||
|
|
||||||
|
func balloonMaxGrowPCTValidator(fe validator.FieldLevel) bool {
|
||||||
|
fieldValue := fe.Field().Uint()
|
||||||
|
return fieldValue >= uint64(balloonMaxGrowPCTMin) && fieldValue <= uint64(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)
|
||||||
|
}
|
||||||
@@ -336,5 +336,67 @@ 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
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -84,6 +84,10 @@ 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"}
|
||||||
|
|
||||||
|
logLevelValues = []string{"DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"}
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -92,4 +96,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 {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ type AddUserRequest struct {
|
|||||||
|
|
||||||
// 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 {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ type DeleteUserRequest struct {
|
|||||||
|
|
||||||
// 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 {
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ type UpdateUserRequest struct {
|
|||||||
|
|
||||||
// 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 {
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ type wrapperCreateTemplateRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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 {
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ type wrapperCreateTemplateFromBlankRequest struct {
|
|||||||
|
|
||||||
// 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 {
|
||||||
@@ -84,6 +86,8 @@ func (c Compute) CreateTemplateFromBlank(ctx context.Context, req CreateTemplate
|
|||||||
|
|
||||||
// CreateTemplateFromBlankAsync creates template from boot disk of current compute in async mode.
|
// 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 {
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ type wrapperDiskQOSRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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 {
|
||||||
|
|||||||
@@ -20,7 +20,11 @@ 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 {
|
||||||
|
|||||||
@@ -1107,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"`
|
||||||
|
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ type wrapperFromPlatformDiskRequest struct {
|
|||||||
|
|
||||||
// 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 {
|
||||||
@@ -83,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,6 +555,9 @@ 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 {
|
||||||
|
|||||||
@@ -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"`
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -254,7 +254,7 @@ 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
|
// List of vGPU IDs to attach to the VM
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ 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
|
// List of vGPU IDs to attach to the VM
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
type SetDataRequest struct {
|
type SetDataRequest struct {
|
||||||
// Data to set to user in json format
|
// Data to set to user in json format
|
||||||
// Required: true
|
// Required: true
|
||||||
Data string `url:"data" json:"data" validation:"required"`
|
Data string `url:"data" json:"data" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetData sets extra user information.
|
// SetData sets extra user information.
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ type ListRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
SortBy string `url:"sort_by,omitempty" json:"sort_by,omitempty" validate:"omitempty,sortBy"`
|
SortBy string `url:"sort_by,omitempty" json:"sort_by,omitempty" validate:"omitempty,sortBy"`
|
||||||
|
|
||||||
|
// Sort by name
|
||||||
|
// Required: false
|
||||||
|
Name string `url:"name,omitempty" json:"name,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"`
|
||||||
|
|||||||
@@ -54,6 +54,12 @@ type ItemVGPU struct {
|
|||||||
|
|
||||||
// Status
|
// Status
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// Node ID
|
||||||
|
NodeID uint64 `json:"node_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of VGPU
|
// List of VGPU
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ type CreateInAccountRequest struct {
|
|||||||
|
|
||||||
type asyncWrapperCreateInAccountRequest struct {
|
type asyncWrapperCreateInAccountRequest struct {
|
||||||
CreateInAccountRequest
|
CreateInAccountRequest
|
||||||
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateInAccount creates VINS in account level
|
// CreateInAccount creates VINS in account level
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ type CreateInRGRequest struct {
|
|||||||
|
|
||||||
type asyncWrapperCreateInRgRequest struct {
|
type asyncWrapperCreateInRgRequest struct {
|
||||||
CreateInRGRequest
|
CreateInRGRequest
|
||||||
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
|
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateInRG creates VINS in resource group level
|
// CreateInRG creates VINS in resource group level
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type EnableRequest struct {
|
|||||||
|
|
||||||
type asyncWrapperEnableRequest struct {
|
type asyncWrapperEnableRequest struct {
|
||||||
EnableRequest
|
EnableRequest
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable enables VINS
|
// Enable enables VINS
|
||||||
|
|||||||
@@ -340,6 +340,9 @@ type ItemVNFInterface struct {
|
|||||||
|
|
||||||
// List of VNF IDs
|
// List of VNF IDs
|
||||||
VNFs []uint64 `json:"vnfs"`
|
VNFs []uint64 `json:"vnfs"`
|
||||||
|
|
||||||
|
// Whether default gateway is enabled
|
||||||
|
EnableDefaultGateway bool `json:"enable_default_gateway"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main information about QOS
|
// Main information about QOS
|
||||||
@@ -630,6 +633,9 @@ type RecordDHCPConfig struct {
|
|||||||
|
|
||||||
// List of reservations
|
// List of reservations
|
||||||
Reservations ListReservations `json:"reservations"`
|
Reservations ListReservations `json:"reservations"`
|
||||||
|
|
||||||
|
// Whether default gateway is enabled
|
||||||
|
EnableDefaultGateway bool `json:"enable_default_gateway"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of static routes
|
// List of static routes
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type VNFDevRedeployRequest struct {
|
|||||||
|
|
||||||
type asyncWrapperVNFDevRedeployRequest struct {
|
type asyncWrapperVNFDevRedeployRequest struct {
|
||||||
VNFDevRedeployRequest
|
VNFDevRedeployRequest
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// VNFDevRedeploy redeploys VINS VNFDevs
|
// VNFDevRedeploy redeploys VINS VNFDevs
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type VNFDevRestartRequest struct {
|
|||||||
|
|
||||||
type asyncWrapperVNFDevRestartRequest struct {
|
type asyncWrapperVNFDevRestartRequest struct {
|
||||||
VNFDevRestartRequest
|
VNFDevRestartRequest
|
||||||
AsyncMode bool `url:"asyncMode"`
|
AsyncMode bool `url:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// VNFDevRestart reboots VINSes primary VNF device
|
// VNFDevRestart reboots VINSes primary VNF device
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ type AddUserRequest struct {
|
|||||||
|
|
||||||
// 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 {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ type DeleteUserRequest struct {
|
|||||||
|
|
||||||
// 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 {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ type UpdateUserRequest struct {
|
|||||||
|
|
||||||
// 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 {
|
||||||
|
|||||||
@@ -38,6 +38,10 @@ type ListRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
SortBy string `url:"sort_by,omitempty" json:"sort_by,omitempty" validate:"omitempty,sortBy"`
|
SortBy string `url:"sort_by,omitempty" json:"sort_by,omitempty" validate:"omitempty,sortBy"`
|
||||||
|
|
||||||
|
// Filter by user ID
|
||||||
|
// Required: false
|
||||||
|
UserID string `url:"user_id,omitempty" json:"user_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"`
|
||||||
|
|||||||
@@ -161,51 +161,52 @@ type CloudAPIEndpoints struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CloudBrokerEndpoints struct {
|
type CloudBrokerEndpoints struct {
|
||||||
Account []string `json:"account,omitempty"`
|
Account interface{} `json:"account,omitempty"`
|
||||||
APIAccess []string `json:"apiaccess,omitempty"`
|
APIAccess interface{} `json:"apiaccess,omitempty"`
|
||||||
Audit interface{} `json:"audit,omitempty"`
|
Audit interface{} `json:"audit,omitempty"`
|
||||||
AuditBeat []string `json:"auditbeat,omitempty"`
|
AuditBeat []string `json:"auditbeat,omitempty"`
|
||||||
AuditCollector []string `json:"auditcollector,omitempty"`
|
AuditCollector interface{} `json:"auditcollector,omitempty"`
|
||||||
Backup []string `json:"backup,omitempty"`
|
Backup interface{} `json:"backup,omitempty"`
|
||||||
BackupCreator []string `json:"backupcreator,omitempty"`
|
BackupCreator interface{} `json:"backupcreator,omitempty"`
|
||||||
BService []string `json:"bservice,omitempty"`
|
BasisMPM interface{} `json:"basis_mpm,omitempty"`
|
||||||
Compute []string `json:"compute,omitempty"`
|
BService interface{} `json:"bservice,omitempty"`
|
||||||
Disks []string `json:"disks,omitempty"`
|
Compute interface{} `json:"compute,omitempty"`
|
||||||
DPDKNet []string `json:"dpdknet,omitempty"`
|
Disks interface{} `json:"disks,omitempty"`
|
||||||
Eco []string `json:"eco,omitempty"`
|
DPDKNet interface{} `json:"dpdknet,omitempty"`
|
||||||
ExtNet []string `json:"extnet,omitempty"`
|
Eco interface{} `json:"eco,omitempty"`
|
||||||
FlIPgroup []string `json:"flipgroup,omitempty"`
|
ExtNet interface{} `json:"extnet,omitempty"`
|
||||||
Grid []string `json:"grid,omitempty"`
|
FlIPgroup interface{} `json:"flipgroup,omitempty"`
|
||||||
Group []string `json:"group,omitempty"`
|
Grid interface{} `json:"grid,omitempty"`
|
||||||
Health []string `json:"health,omitempty"`
|
Group interface{} `json:"group,omitempty"`
|
||||||
Image []string `json:"image,omitempty"`
|
Health interface{} `json:"health,omitempty"`
|
||||||
|
Image interface{} `json:"image,omitempty"`
|
||||||
Job interface{} `json:"job,omitempty"`
|
Job interface{} `json:"job,omitempty"`
|
||||||
K8CI []string `json:"k8ci,omitempty"`
|
K8CI interface{} `json:"k8ci,omitempty"`
|
||||||
K8S []string `json:"k8s,omitempty"`
|
K8S interface{} `json:"k8s,omitempty"`
|
||||||
KVMX86 []string `json:"kvmx86,omitempty"`
|
KVMX86 interface{} `json:"kvmx86,omitempty"`
|
||||||
LB []string `json:"lb,omitempty"`
|
LB interface{} `json:"lb,omitempty"`
|
||||||
Metering []string `json:"metering,omitempty"`
|
Metering interface{} `json:"metering,omitempty"`
|
||||||
Milestones []string `json:"milestones,omitempty"`
|
Milestones interface{} `json:"milestones,omitempty"`
|
||||||
Node []string `json:"node,omitempty"`
|
Node []string `json:"node,omitempty"`
|
||||||
PCIDevice []string `json:"pcidevice,omitempty"`
|
PCIDevice interface{} `json:"pcidevice,omitempty"`
|
||||||
PGPU []string `json:"pgpu,omitempty"`
|
PGPU interface{} `json:"pgpu,omitempty"`
|
||||||
Prometheus []string `json:"prometheus,omitempty"`
|
Prometheus interface{} `json:"prometheus,omitempty"`
|
||||||
Resmon interface{} `json:"resmon,omitempty"`
|
Resmon interface{} `json:"resmon,omitempty"`
|
||||||
RG []string `json:"rg,omitempty"`
|
RG interface{} `json:"rg,omitempty"`
|
||||||
SecurityGroup []string `json:"security_group,omitempty"`
|
SecurityGroup interface{} `json:"security_group,omitempty"`
|
||||||
Sep []string `json:"sep,omitempty"`
|
Sep interface{} `json:"sep,omitempty"`
|
||||||
StoragePolicy []string `json:"storage_policy,omitempty"`
|
StoragePolicy interface{} `json:"storage_policy,omitempty"`
|
||||||
Tasks []string `json:"tasks,omitempty"`
|
Tasks interface{} `json:"tasks,omitempty"`
|
||||||
TLock []string `json:"tlock,omitempty"`
|
TLock interface{} `json:"tlock,omitempty"`
|
||||||
Trunk []string `json:"trunk,omitempty"`
|
Trunk interface{} `json:"trunk,omitempty"`
|
||||||
User []string `json:"user,omitempty"`
|
User interface{} `json:"user,omitempty"`
|
||||||
VFPool []string `json:"vfpool,omitempty"`
|
VFPool interface{} `json:"vfpool,omitempty"`
|
||||||
VGPU []string `json:"vgpu,omitempty"`
|
VGPU interface{} `json:"vgpu,omitempty"`
|
||||||
VINS []string `json:"vins,omitempty"`
|
VINS interface{} `json:"vins,omitempty"`
|
||||||
VMFolder []string `json:"vmfolder,omitempty"`
|
VMFolder interface{} `json:"vmfolder,omitempty"`
|
||||||
VNFDev []string `json:"vnfdev,omitempty"`
|
VNFDev interface{} `json:"vnfdev,omitempty"`
|
||||||
ZeroAccess []string `json:"zeroaccess,omitempty"`
|
ZeroAccess interface{} `json:"zeroaccess,omitempty"`
|
||||||
Zone []string `json:"zone,omitempty"`
|
Zone interface{} `json:"zone,omitempty"`
|
||||||
All bool `json:"ALL,omitempty"`
|
All bool `json:"ALL,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ type UserListRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UserList gets a list of users currently included in the specified group.
|
// UserList gets a list of users currently included in the specified group.
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (a APIAccess) UserList(ctx context.Context, req UserListRequest) ([]string, error) {
|
func (a APIAccess) UserList(ctx context.Context, req UserListRequest) ([]string, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != 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"`
|
||||||
@@ -96,7 +104,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
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package cloudbroker
|
||||||
|
|
||||||
|
import (
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/pkg/cloudbroker/basismpm"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Accessing the BasisMPM method group
|
||||||
|
func (cb *CloudBroker) BasisMPM() *basismpm.BasisMPM {
|
||||||
|
return basismpm.New(cb.client)
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package basismpm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/interfaces"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Structure for creating request to Basis mpm
|
||||||
|
type BasisMPM struct {
|
||||||
|
client interfaces.Caller
|
||||||
|
}
|
||||||
|
|
||||||
|
// BasisMPM for Basis mpm endpoints
|
||||||
|
func New(client interfaces.Caller) *BasisMPM {
|
||||||
|
return &BasisMPM{
|
||||||
|
client: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package basismpm
|
||||||
|
|
||||||
|
type MemInfo struct {
|
||||||
|
// Total amount of memory
|
||||||
|
MemTotal string `json:"MemTotal"`
|
||||||
|
|
||||||
|
// Amount of free memory
|
||||||
|
MemFree string `json:"MemFree"`
|
||||||
|
|
||||||
|
// Amount of available memory
|
||||||
|
MemAvailable string `json:"MemAvailable"`
|
||||||
|
|
||||||
|
// Amount of available memory (in percent)
|
||||||
|
MemAvailablePercent float64 `json:"MemAvailablePercent"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Basis MPM service status
|
||||||
|
type RecordBasisMPM struct {
|
||||||
|
// Whether the service is installed
|
||||||
|
ServiceInstalled bool `json:"service_installed"`
|
||||||
|
|
||||||
|
// Whether the config exists
|
||||||
|
ConfigExists bool `json:"config_exists"`
|
||||||
|
|
||||||
|
// Whether the service is active
|
||||||
|
ServiceActive bool `json:"service_active"`
|
||||||
|
|
||||||
|
// Service state
|
||||||
|
ServiceState string `json:"service_state"`
|
||||||
|
|
||||||
|
// Config
|
||||||
|
Config interface{} `json:"config"`
|
||||||
|
|
||||||
|
// Memory info
|
||||||
|
MemInfo MemInfo `json:"meminfo"`
|
||||||
|
}
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
package basismpm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// StartRequest to start basis_mpm service on a node
|
||||||
|
type StartRequest struct {
|
||||||
|
// Node ID
|
||||||
|
// Required: true
|
||||||
|
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
|
||||||
|
|
||||||
|
// Memory pressure threshold (%)
|
||||||
|
// Required: false
|
||||||
|
// Default: 20
|
||||||
|
PressureThreshold uint64 `url:"pressure_threshold,omitempty" json:"pressure_threshold,omitempty" validate:"omitempty,pressureThreshold"`
|
||||||
|
|
||||||
|
// Deflate threshold (%)
|
||||||
|
// Required: false
|
||||||
|
// Default: 30
|
||||||
|
DeflateThreshold uint64 `url:"deflate_threshold,omitempty" json:"deflate_threshold,omitempty" validate:"omitempty,deflateThreshold"`
|
||||||
|
|
||||||
|
// Host reserved memory
|
||||||
|
// Required: false
|
||||||
|
// Default: "8GB+5%"
|
||||||
|
HostReserved string `url:"host_reserved,omitempty" json:"host_reserved,omitempty"`
|
||||||
|
|
||||||
|
// Buffer percentage (%)
|
||||||
|
// Required: false
|
||||||
|
// Default: 20
|
||||||
|
BufferPCT uint64 `url:"buffer_pct,omitempty" json:"buffer_pct,omitempty" validate:"omitempty,bufferPCT"`
|
||||||
|
|
||||||
|
// Guaranteed memory percentage (%)
|
||||||
|
// Required: false
|
||||||
|
// Default: 25
|
||||||
|
GuaranteedPCT uint64 `url:"guaranteed_pct,omitempty" json:"guaranteed_pct,omitempty" validate:"omitempty,guaranteedPCT"`
|
||||||
|
|
||||||
|
// Absolute minimum guaranteed memory (MB)
|
||||||
|
// Required: false
|
||||||
|
// Default: 512
|
||||||
|
GuaranteedABSMin uint64 `url:"guaranteed_abs_min,omitempty" json:"guaranteed_abs_min,omitempty" validate:"omitempty,guaranteedABSMin"`
|
||||||
|
|
||||||
|
// Shrink threshold percentage (%)
|
||||||
|
// Required: false
|
||||||
|
// Default: 50
|
||||||
|
ShrinkThresholdPCT uint64 `url:"shrink_threshold_pct,omitempty" json:"shrink_threshold_pct,omitempty" validate:"omitempty,shrinkThresholdPCT"`
|
||||||
|
|
||||||
|
// Max shrink percentage per cycle (%)
|
||||||
|
// Required: false
|
||||||
|
// Default: 10
|
||||||
|
BalloonMaxShrinkPCT uint64 `url:"balloon_max_shrink_pct,omitempty" json:"balloon_max_shrink_pct,omitempty" validate:"omitempty,balloonMaxShrinkPCT"`
|
||||||
|
|
||||||
|
// Max grow percentage per cycle (%)
|
||||||
|
// Required: false
|
||||||
|
// Default: 10
|
||||||
|
BalloonMaxGrowPCT uint64 `url:"balloon_max_grow_pct,omitempty" json:"balloon_max_grow_pct,omitempty" validate:"omitempty,balloonMaxGrowPCT"`
|
||||||
|
|
||||||
|
// VM change cooldown (seconds)
|
||||||
|
// Required: false
|
||||||
|
// Default: 60
|
||||||
|
VMChangeCooldown uint64 `url:"vm_change_cooldown,omitempty" json:"vm_change_cooldown,omitempty" validate:"omitempty,vmChangeCooldown"`
|
||||||
|
|
||||||
|
// Emergency return cooldown (seconds)
|
||||||
|
// Required: false
|
||||||
|
// Default: 300
|
||||||
|
EmergencyReturnCooldown uint64 `url:"emergency_return_cooldown,omitempty" json:"emergency_return_cooldown,omitempty"`
|
||||||
|
|
||||||
|
// Major fault increase per cycle that triggers emergency memory return
|
||||||
|
// Required: false
|
||||||
|
// Default: 100
|
||||||
|
MajorFaultThreshold uint64 `url:"major_fault_threshold,omitempty" json:"major_fault_threshold,omitempty" validate:"omitempty,majorFaultThreshold"`
|
||||||
|
|
||||||
|
// Daemon log level
|
||||||
|
// Required: false
|
||||||
|
// Default: INFO
|
||||||
|
// Options:
|
||||||
|
// - DEBUG
|
||||||
|
// - INFO
|
||||||
|
// - WARNING
|
||||||
|
// - ERROR
|
||||||
|
// - CRITICAL
|
||||||
|
LogLevel string `url:"log_level,omitempty" json:"log_level,omitempty" validate:"omitempty,logLevel"`
|
||||||
|
|
||||||
|
// Daemon log file path (empty for stdout only)
|
||||||
|
// Required: false
|
||||||
|
LogFile string `url:"log_file,omitempty" json:"log_file,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start starts basis_mpm service on a node
|
||||||
|
func (bm BasisMPM) Start(ctx context.Context, req StartRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/basis_mpm/start"
|
||||||
|
|
||||||
|
res, err := bm.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package basismpm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// StatusRequest to get basis_mpm service status on a node
|
||||||
|
type StatusRequest struct {
|
||||||
|
// Node ID
|
||||||
|
// Required: true
|
||||||
|
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Status gets basis_mpm service status on a node
|
||||||
|
func (bm BasisMPM) Status(ctx context.Context, req StatusRequest) (*RecordBasisMPM, error) {
|
||||||
|
res, err := bm.StatusRaw(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := RecordBasisMPM{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &info, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// StatusRaw gets basis_mpm service status on a node as an array of bites
|
||||||
|
func (bm BasisMPM) StatusRaw(ctx context.Context, req StatusRequest) ([]byte, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/basis_mpm/status"
|
||||||
|
|
||||||
|
res, err := bm.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package basismpm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// StopRequest to stop basis_mpm service on a node
|
||||||
|
type StopRequest struct {
|
||||||
|
// Node ID
|
||||||
|
// Required: true
|
||||||
|
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
|
||||||
|
|
||||||
|
// Restore VM memory before stopping
|
||||||
|
// Required: false
|
||||||
|
// Default: true
|
||||||
|
RestoreMemory interface{} `url:"restore_memory,omitempty" json:"restore_memory,omitempty" validate:"omitempty,isBool"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stop stops basis_mpm service on a node
|
||||||
|
func (bm BasisMPM) Stop(ctx context.Context, req StopRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/basis_mpm/stop"
|
||||||
|
|
||||||
|
res, err := bm.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
package basismpm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UpdateRequest to update basis_mpm service configuration on a node
|
||||||
|
type UpdateRequest struct {
|
||||||
|
// Node ID
|
||||||
|
// Required: true
|
||||||
|
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
|
||||||
|
|
||||||
|
// Memory pressure threshold (%)
|
||||||
|
// Required: false
|
||||||
|
// Default: 20
|
||||||
|
PressureThreshold uint64 `url:"pressure_threshold,omitempty" json:"pressure_threshold,omitempty" validate:"omitempty,pressureThreshold"`
|
||||||
|
|
||||||
|
// Deflate threshold (%)
|
||||||
|
// Required: false
|
||||||
|
// Default: 30
|
||||||
|
DeflateThreshold uint64 `url:"deflate_threshold,omitempty" json:"deflate_threshold,omitempty" validate:"omitempty,deflateThreshold"`
|
||||||
|
|
||||||
|
// Host reserved memory
|
||||||
|
// Required: false
|
||||||
|
// Default: "8GB+5%"
|
||||||
|
HostReserved string `url:"host_reserved,omitempty" json:"host_reserved,omitempty"`
|
||||||
|
|
||||||
|
// Buffer percentage (%)
|
||||||
|
// Required: false
|
||||||
|
// Default: 20
|
||||||
|
BufferPCT uint64 `url:"buffer_pct,omitempty" json:"buffer_pct,omitempty" validate:"omitempty,bufferPCT"`
|
||||||
|
|
||||||
|
// Guaranteed memory percentage (%)
|
||||||
|
// Required: false
|
||||||
|
// Default: 25
|
||||||
|
GuaranteedPCT uint64 `url:"guaranteed_pct,omitempty" json:"guaranteed_pct,omitempty" validate:"omitempty,guaranteedPCT"`
|
||||||
|
|
||||||
|
// Absolute minimum guaranteed memory (MB)
|
||||||
|
// Required: false
|
||||||
|
// Default: 512
|
||||||
|
GuaranteedABSMin uint64 `url:"guaranteed_abs_min,omitempty" json:"guaranteed_abs_min,omitempty" validate:"omitempty,guaranteedABSMin"`
|
||||||
|
|
||||||
|
// Shrink threshold percentage (%)
|
||||||
|
// Required: false
|
||||||
|
// Default: 50
|
||||||
|
ShrinkThresholdPCT uint64 `url:"shrink_threshold_pct,omitempty" json:"shrink_threshold_pct,omitempty" validate:"omitempty,shrinkThresholdPCT"`
|
||||||
|
|
||||||
|
// Max shrink percentage per cycle (%)
|
||||||
|
// Required: false
|
||||||
|
// Default: 10
|
||||||
|
BalloonMaxShrinkPCT uint64 `url:"balloon_max_shrink_pct,omitempty" json:"balloon_max_shrink_pct,omitempty" validate:"omitempty,balloonMaxShrinkPCT"`
|
||||||
|
|
||||||
|
// Max grow percentage per cycle (%)
|
||||||
|
// Required: false
|
||||||
|
// Default: 10
|
||||||
|
BalloonMaxGrowPCT uint64 `url:"balloon_max_grow_pct,omitempty" json:"balloon_max_grow_pct,omitempty" validate:"omitempty,balloonMaxGrowPCT"`
|
||||||
|
|
||||||
|
// VM change cooldown (seconds)
|
||||||
|
// Required: false
|
||||||
|
// Default: 60
|
||||||
|
VMChangeCooldown uint64 `url:"vm_change_cooldown,omitempty" json:"vm_change_cooldown,omitempty" validate:"omitempty,vmChangeCooldown"`
|
||||||
|
|
||||||
|
// Emergency return cooldown (seconds)
|
||||||
|
// Required: false
|
||||||
|
// Default: 300
|
||||||
|
EmergencyReturnCooldown uint64 `url:"emergency_return_cooldown,omitempty" json:"emergency_return_cooldown,omitempty" validate:"omitempty,emergencyReturnCooldown"`
|
||||||
|
|
||||||
|
// Major fault increase per cycle that triggers emergency memory return
|
||||||
|
// Required: false
|
||||||
|
// Default: 100
|
||||||
|
MajorFaultThreshold uint64 `url:"major_fault_threshold,omitempty" json:"major_fault_threshold,omitempty" validate:"omitempty,majorFaultThreshold"`
|
||||||
|
|
||||||
|
// Daemon log level
|
||||||
|
// Required: false
|
||||||
|
// Default: INFO
|
||||||
|
// Options:
|
||||||
|
// - DEBUG
|
||||||
|
// - INFO
|
||||||
|
// - WARNING
|
||||||
|
// - ERROR
|
||||||
|
// - CRITICAL
|
||||||
|
LogLevel string `url:"log_level,omitempty" json:"log_level,omitempty" validate:"omitempty,logLevel"`
|
||||||
|
|
||||||
|
// Daemon log file path (empty for stdout only)
|
||||||
|
// Required: false
|
||||||
|
LogFile string `url:"log_file,omitempty" json:"log_file,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (bm BasisMPM) Update(ctx context.Context, req UpdateRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/basis_mpm/update"
|
||||||
|
|
||||||
|
res, err := bm.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -26,6 +26,8 @@ type wrapperCreateTemplateRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CreateTemplate create template from compute instance
|
// 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 {
|
||||||
@@ -50,6 +52,8 @@ func (c Compute) CreateTemplate(ctx context.Context, req CreateTemplateRequest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CreateTemplateAsync create template from compute instance with AsyncMode
|
// CreateTemplateAsync create template from compute instance with AsyncMode
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) CreateTemplateAsync(ctx context.Context, req CreateTemplateRequest) (string, error) {
|
func (c Compute) CreateTemplateAsync(ctx context.Context, req CreateTemplateRequest) (string, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ type wrapperCreateTemplateFromBlankRequest struct {
|
|||||||
|
|
||||||
// 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 +90,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 {
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ type wrapperDiskQOSRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DiskQOS changes QOS of the disk
|
// DiskQOS changes 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 {
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ type DiskSwitchToReplicationRequest struct {
|
|||||||
// Delete replication relationship
|
// Delete replication relationship
|
||||||
// Required: false
|
// Required: false
|
||||||
StopReplication bool `url:"stopReplication" json:"stopReplication"`
|
StopReplication bool `url:"stopReplication" json:"stopReplication"`
|
||||||
|
|
||||||
|
// 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 {
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ type AsyncWrapperMigrateRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Migrate migrates compute to another node
|
// Migrate migrates compute to another node
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) Migrate(ctx context.Context, req MigrateRequest) (bool, error) {
|
func (c Compute) Migrate(ctx context.Context, req MigrateRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -50,6 +52,8 @@ func (c Compute) Migrate(ctx context.Context, req MigrateRequest) (bool, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AsyncMigrate migrates compute to another node in async mode
|
// AsyncMigrate migrates compute to another node in async mode
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) AsyncMigrate(ctx context.Context, req MigrateRequest) (string, error) {
|
func (c Compute) AsyncMigrate(ctx context.Context, req MigrateRequest) (string, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ type wrapperMigrateAbortRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MigrateAbort aborts compute migration
|
// MigrateAbort aborts compute migration
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) MigrateAbort(ctx context.Context, req MigrateAbortRequest) (string, error) {
|
func (c Compute) MigrateAbort(ctx context.Context, req MigrateAbortRequest) (string, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -46,6 +48,8 @@ func (c Compute) MigrateAbort(ctx context.Context, req MigrateAbortRequest) (str
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MigrateAbortAsync aborts compute migration with AsyncMode
|
// MigrateAbortAsync aborts compute migration with AsyncMode
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) MigrateAbortAsync(ctx context.Context, req MigrateAbortRequest) (string, error) {
|
func (c Compute) MigrateAbortAsync(ctx context.Context, req MigrateAbortRequest) (string, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package compute
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
@@ -25,17 +26,48 @@ type MigrateStorageRequest struct {
|
|||||||
// Target node ID
|
// Target node ID
|
||||||
// Required: true
|
// Required: true
|
||||||
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
|
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
// Async API call
|
type wrapperMigrateStorageRequest struct {
|
||||||
// Required: true
|
MigrateStorageRequest
|
||||||
Async interface{} `url:"async_mode" json:"async_mode" validate:"required,isBool"`
|
AsyncMode bool `url:"async_mode,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MigrateStorage gets complex compute migration
|
// MigrateStorage gets complex compute migration
|
||||||
// Compute will be migrated to specified node, and compute disks will
|
// Compute will be migrated to specified node, and compute disks will
|
||||||
// be migrated to specified SEP to specified pool.
|
// be migrated to specified SEP to specified pool.
|
||||||
// This action can take up to 84 hours
|
// This action can take up to 84 hours
|
||||||
func (c Compute) MigrateStorage(ctx context.Context, req MigrateStorageRequest) (string, error) {
|
func (c Compute) MigrateStorage(ctx context.Context, req MigrateStorageRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/compute/migrateStorage"
|
||||||
|
|
||||||
|
aReq := wrapperMigrateStorageRequest{
|
||||||
|
MigrateStorageRequest: req,
|
||||||
|
AsyncMode: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := c.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
|
||||||
|
}
|
||||||
|
|
||||||
|
// MigrateStorageAsync gets complex compute migration in async mode
|
||||||
|
// Compute will be migrated to specified node, and compute disks will
|
||||||
|
// be migrated to specified SEP to specified pool.
|
||||||
|
// This action can take up to 84 hours
|
||||||
|
func (c Compute) MigrateStorageAsync(ctx context.Context, req MigrateStorageRequest) (string, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
@@ -43,7 +75,12 @@ func (c Compute) MigrateStorage(ctx context.Context, req MigrateStorageRequest)
|
|||||||
|
|
||||||
url := "/cloudbroker/compute/migrateStorage"
|
url := "/cloudbroker/compute/migrateStorage"
|
||||||
|
|
||||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
aReq := wrapperMigrateStorageRequest{
|
||||||
|
MigrateStorageRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ type wrapperMigrateStorageAbortRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MigrateStorageAbort aborts complex compute migration job
|
// MigrateStorageAbort aborts complex compute migration job
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) MigrateStorageAbort(ctx context.Context, req MigrateStorageAbortRequest) (bool, error) {
|
func (c Compute) MigrateStorageAbort(ctx context.Context, req MigrateStorageAbortRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -54,6 +56,8 @@ func (c Compute) MigrateStorageAbort(ctx context.Context, req MigrateStorageAbor
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MigrateStorageAbortAsync aborts complex compute migration job with AsyncMode
|
// MigrateStorageAbortAsync aborts complex compute migration job with AsyncMode
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) MigrateStorageAbortAsync(ctx context.Context, req MigrateStorageAbortRequest) (string, error) {
|
func (c Compute) MigrateStorageAbortAsync(ctx context.Context, req MigrateStorageAbortRequest) (string, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ type wrapperMigrateStorageCleanUpRequest struct {
|
|||||||
// MigrateStorageCleanUp cleanup resources after finished (success of failed) complex compute migration.
|
// MigrateStorageCleanUp cleanup resources after finished (success of failed) complex compute migration.
|
||||||
// If the migration was successful, then old disks will be removed, else new (target) disks will be removed.
|
// If the migration was successful, then old disks will be removed, else new (target) disks will be removed.
|
||||||
// Do it wisely!
|
// Do it wisely!
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) MigrateStorageCleanUp(ctx context.Context, req MigrateStorageCleanUpRequest) (bool, error) {
|
func (c Compute) MigrateStorageCleanUp(ctx context.Context, req MigrateStorageCleanUpRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -51,6 +53,8 @@ func (c Compute) MigrateStorageCleanUp(ctx context.Context, req MigrateStorageCl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MigrateStorageCleanUpAsync cleanup resources after finished migration with AsyncMode
|
// MigrateStorageCleanUpAsync cleanup resources after finished migration with AsyncMode
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) MigrateStorageCleanUpAsync(ctx context.Context, req MigrateStorageCleanUpRequest) (string, error) {
|
func (c Compute) MigrateStorageCleanUpAsync(ctx context.Context, req MigrateStorageCleanUpRequest) (string, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ type MigrateStorageInfoRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MigrateStorageInfo gets info about last (include ongoing) storage migration
|
// MigrateStorageInfo gets info about last (include ongoing) storage migration
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) MigrateStorageInfo(ctx context.Context, req MigrateStorageInfoRequest) (*RecordMigrateStorageInfo, error) {
|
func (c Compute) MigrateStorageInfo(ctx context.Context, req MigrateStorageInfoRequest) (*RecordMigrateStorageInfo, error) {
|
||||||
res, err := c.MigrateStorageInfoRaw(ctx, req)
|
res, err := c.MigrateStorageInfoRaw(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -33,6 +35,8 @@ func (c Compute) MigrateStorageInfo(ctx context.Context, req MigrateStorageInfoR
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MigrateStorageInfoRaw gets info about last (include ongoing) storage migration as an array of bytes
|
// MigrateStorageInfoRaw gets info about last (include ongoing) storage migration as an array of bytes
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) MigrateStorageInfoRaw(ctx context.Context, req MigrateStorageInfoRequest) ([]byte, error) {
|
func (c Compute) MigrateStorageInfoRaw(ctx context.Context, req MigrateStorageInfoRequest) ([]byte, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ type MigrateStorageListRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MigrateStorageList gets list of the jobs.
|
// MigrateStorageList gets list of the jobs.
|
||||||
|
//
|
||||||
|
// Deprecated: will be removed in SDK v17.0
|
||||||
func (c Compute) MigrateStorageList(ctx context.Context, req MigrateStorageListRequest) (*ListMigrateStorage, error) {
|
func (c Compute) MigrateStorageList(ctx context.Context, req MigrateStorageListRequest) (*ListMigrateStorage, error) {
|
||||||
if err := validators.ValidateRequest(req); err != nil {
|
if err := validators.ValidateRequest(req); err != nil {
|
||||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ type Target struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"`
|
StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"`
|
||||||
|
|
||||||
// Disk IDs
|
// Disk IDs. May be omitted if Targets contains one element (all persistent disks are migrated).
|
||||||
|
// Required if Targets contains two or more elements; disk IDs must not overlap between targets.
|
||||||
// Required: false
|
// Required: false
|
||||||
DiskIDs []uint64 `url:"disk_ids,omitempty" json:"disk_ids,omitempty"`
|
DiskIDs []uint64 `url:"disk_ids,omitempty" json:"disk_ids,omitempty"`
|
||||||
}
|
}
|
||||||
@@ -31,8 +32,8 @@ type Target struct {
|
|||||||
// Storage describes a destination for a disk
|
// Storage describes a destination for a disk
|
||||||
type Storage struct {
|
type Storage struct {
|
||||||
// Target for migration
|
// Target for migration
|
||||||
// Required: false
|
// Required: true
|
||||||
Targets []Target `url:"targets,omitempty" json:"targets,omitempty"`
|
Targets []Target `url:"targets" json:"targets" validate:"required,min=1,dive"`
|
||||||
|
|
||||||
// Whether a separate source-disk cleanup job should be started after full success
|
// Whether a separate source-disk cleanup job should be started after full success
|
||||||
// Required: false
|
// Required: false
|
||||||
@@ -55,7 +56,7 @@ type MigrateV2Request struct {
|
|||||||
|
|
||||||
// Destination for a disk
|
// Destination for a disk
|
||||||
// Required: false
|
// Required: false
|
||||||
Storage Storage `url:"storage,omitempty" json:"storage,omitempty"`
|
Storage *Storage `url:"storage,omitempty" json:"storage,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MigrateV2 starts a migration of a compute or a disk
|
// MigrateV2 starts a migration of a compute or a disk
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ type MigrateV2ResolveRequest struct {
|
|||||||
// Take over cleanup
|
// Take over cleanup
|
||||||
// Required: false
|
// Required: false
|
||||||
TakeOverCleanup interface{} `url:"take_over_cleanup,omitempty" json:"take_over_cleanup,omitempty" validate:"omitempty,isBool"`
|
TakeOverCleanup interface{} `url:"take_over_cleanup,omitempty" json:"take_over_cleanup,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
|
// Take over resources
|
||||||
|
// Required: false
|
||||||
|
TakeOverResources interface{} `url:"take_over_resources,omitempty" json:"take_over_resources,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MigrateV2Resolve resolves a migration of a compute
|
// MigrateV2Resolve resolves a migration of a compute
|
||||||
|
|||||||
@@ -424,6 +424,9 @@ type ItemDisk 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"`
|
||||||
|
|
||||||
@@ -2312,7 +2315,7 @@ type Origin struct {
|
|||||||
|
|
||||||
type Observation struct {
|
type Observation struct {
|
||||||
// Updated at
|
// Updated at
|
||||||
UpdatedAt uint64 `json:"updated_at"`
|
UpdatedAt float64 `json:"updated_at"`
|
||||||
|
|
||||||
// Agent job ID
|
// Agent job ID
|
||||||
AgentJobID string `json:"agent_job_id"`
|
AgentJobID string `json:"agent_job_id"`
|
||||||
@@ -2326,13 +2329,13 @@ type Observation struct {
|
|||||||
|
|
||||||
type Memory struct {
|
type Memory struct {
|
||||||
// Sampled at
|
// Sampled at
|
||||||
SampledAt uint64 `json:"sampled_at"`
|
SampledAt float64 `json:"sampled_at"`
|
||||||
|
|
||||||
// Percent
|
// Percent
|
||||||
Percent uint64 `json:"percent"`
|
Percent float64 `json:"percent"`
|
||||||
|
|
||||||
// Bytes per second
|
// Bytes per second
|
||||||
BytesPerSecond uint64 `json:"bytes_per_second"`
|
BytesPerSecond float64 `json:"bytes_per_second"`
|
||||||
|
|
||||||
// Processed bytes
|
// Processed bytes
|
||||||
ProcessedBytes uint64 `json:"processed_bytes"`
|
ProcessedBytes uint64 `json:"processed_bytes"`
|
||||||
@@ -2349,19 +2352,59 @@ type ProgressDisks struct {
|
|||||||
TargetDevs []string `json:"target_devs"`
|
TargetDevs []string `json:"target_devs"`
|
||||||
|
|
||||||
// Sampled at
|
// Sampled at
|
||||||
SampledAt uint64 `json:"sampled_at"`
|
SampledAt float64 `json:"sampled_at"`
|
||||||
|
|
||||||
// Percent
|
// Percent
|
||||||
Percent uint64 `json:"percent"`
|
Percent float64 `json:"percent"`
|
||||||
|
|
||||||
// Bytes per second
|
// Bytes per second
|
||||||
BytesPerSecond uint64 `json:"bytes_per_second"`
|
BytesPerSecond float64 `json:"bytes_per_second"`
|
||||||
|
|
||||||
// Processed bytes
|
// Processed bytes
|
||||||
ProcessedBytes uint64 `json:"processed_bytes"`
|
ProcessedBytes uint64 `json:"processed_bytes"`
|
||||||
|
|
||||||
// Remaining bytes
|
// Remaining bytes
|
||||||
RemainingBytes uint64 `json:"remaining_bytes"`
|
RemainingBytes uint64 `json:"remaining_bytes"`
|
||||||
|
|
||||||
|
// Disks completed
|
||||||
|
DisksCompleted uint64 `json:"disks_completed"`
|
||||||
|
|
||||||
|
// Completed disks
|
||||||
|
CompletedDisks []CompletedDisk `json:"completed_disks"`
|
||||||
|
|
||||||
|
// Disks total
|
||||||
|
DisksTotal uint64 `json:"disks_total"`
|
||||||
|
|
||||||
|
// Current disk
|
||||||
|
CurrentDisk CurrentDisk `json:"current_disk"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CompletedDisk struct {
|
||||||
|
// Source disk ID
|
||||||
|
SourceDiskID uint64 `json:"source_disk_id"`
|
||||||
|
|
||||||
|
// Target disk ID
|
||||||
|
TargetDiskID uint64 `json:"target_disk_id"`
|
||||||
|
|
||||||
|
// Target dev
|
||||||
|
TargetDev string `json:"target_dev"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CurrentDisk struct {
|
||||||
|
// Source disk ID
|
||||||
|
SourceDiskID uint64 `json:"source_disk_id"`
|
||||||
|
|
||||||
|
// Target disk ID
|
||||||
|
TargetDiskID uint64 `json:"target_disk_id"`
|
||||||
|
|
||||||
|
// Target dev
|
||||||
|
TargetDev string `json:"target_dev"`
|
||||||
|
|
||||||
|
// Percent
|
||||||
|
Percent float64 `json:"percent"`
|
||||||
|
|
||||||
|
// Sampled at
|
||||||
|
SampledAt float64 `json:"sampled_at"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SystemDisk struct {
|
type SystemDisk struct {
|
||||||
@@ -2369,13 +2412,13 @@ type SystemDisk struct {
|
|||||||
TargetDev string `json:"target_dev"`
|
TargetDev string `json:"target_dev"`
|
||||||
|
|
||||||
// Sampled at
|
// Sampled at
|
||||||
SampledAt uint64 `json:"sampled_at"`
|
SampledAt float64 `json:"sampled_at"`
|
||||||
|
|
||||||
// Percent
|
// Percent
|
||||||
Percent uint64 `json:"percent"`
|
Percent float64 `json:"percent"`
|
||||||
|
|
||||||
// Bytes per second
|
// Bytes per second
|
||||||
BytesPerSecond uint64 `json:"bytes_per_second"`
|
BytesPerSecond float64 `json:"bytes_per_second"`
|
||||||
|
|
||||||
// Processed bytes
|
// Processed bytes
|
||||||
ProcessedBytes uint64 `json:"processed_bytes"`
|
ProcessedBytes uint64 `json:"processed_bytes"`
|
||||||
@@ -2445,12 +2488,18 @@ type Resolution struct {
|
|||||||
// Take over cleanup
|
// Take over cleanup
|
||||||
TakeOverCleanup bool `json:"take_over_cleanup"`
|
TakeOverCleanup bool `json:"take_over_cleanup"`
|
||||||
|
|
||||||
|
// Take over resources
|
||||||
|
TakeOverResources bool `json:"take_over_resources"`
|
||||||
|
|
||||||
// Previous status
|
// Previous status
|
||||||
PreviousStatus string `json:"previous_status"`
|
PreviousStatus string `json:"previous_status"`
|
||||||
|
|
||||||
// Previous cleanup required
|
// Previous cleanup required
|
||||||
PreviousCleanupRequired bool `json:"previous_cleanup_required"`
|
PreviousCleanupRequired bool `json:"previous_cleanup_required"`
|
||||||
|
|
||||||
|
// Previous reserves compute resources
|
||||||
|
PreviousReservesComputeResources bool `json:"previous_reserves_compute_resources"`
|
||||||
|
|
||||||
// Previous error
|
// Previous error
|
||||||
PreviousError string `json:"previous_error"`
|
PreviousError string `json:"previous_error"`
|
||||||
}
|
}
|
||||||
@@ -2604,6 +2653,9 @@ type MigrateV2ResolveRecord struct {
|
|||||||
// Cleanup required
|
// Cleanup required
|
||||||
CleanupRequired bool `json:"cleanup_required"`
|
CleanupRequired bool `json:"cleanup_required"`
|
||||||
|
|
||||||
|
// Message
|
||||||
|
Message string `json:"message"`
|
||||||
|
|
||||||
// Resolution
|
// Resolution
|
||||||
Resolution Resolution `json:"resolution"`
|
Resolution Resolution `json:"resolution"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,15 +18,11 @@ type SnapshotEvictDiskRequest struct {
|
|||||||
// ID of the disk instance
|
// ID of the disk instance
|
||||||
// Required: true
|
// Required: true
|
||||||
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
|
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
|
||||||
|
|
||||||
// Is mode async
|
|
||||||
// Required: false
|
|
||||||
AsyncMode interface{} `url:"async_mode,omitempty" json:"async_mode,omitempty" validate:"omitempty,isBool"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type asyncWrapperSnapshotEvictDiskRequest struct {
|
type asyncWrapperSnapshotEvictDiskRequest struct {
|
||||||
SnapshotEvictDiskRequest
|
SnapshotEvictDiskRequest
|
||||||
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
|
AsyncMode bool `url:"async_mode,omitempty" json:"async_mode,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SnapshotEvictDisk evicts specified disk from all snapshots of a compute instance
|
// SnapshotEvictDisk evicts specified disk from all snapshots of a compute instance
|
||||||
|
|||||||
@@ -86,7 +86,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 account
|
// ID of the storage policy to which to connect account
|
||||||
// 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 {
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ type wrapperFromPlatformDiskRequest struct {
|
|||||||
|
|
||||||
// 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 +89,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"`
|
||||||
|
|||||||
@@ -199,6 +199,9 @@ type InfoDisk 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 {
|
||||||
|
|||||||
@@ -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"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReplicationDisableSchedule 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 := "/cloudbroker/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,46 @@
|
|||||||
|
package disks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ReplicationEnableScheduleRequest to apply a replication profile schedule to an asynchronous replication pair
|
||||||
|
type ReplicationEnableScheduleRequest 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"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReplicationEnableSchedule applies a replication profile schedule to an asynchronous replication pair
|
||||||
|
func (d Disks) ReplicationEnableSchedule(ctx context.Context, req ReplicationEnableScheduleRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/disks/replication_enable_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,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 := "/cloudbroker/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 := "/cloudbroker/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,11 @@ 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
|
||||||
|
// Default: true
|
||||||
|
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 := "/cloudbroker/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
|
||||||
|
}
|
||||||
@@ -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 {
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package disks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ReplicationSyncNowRequest to start manual synchronization of an asynchronous replication pair
|
||||||
|
type ReplicationSyncNowRequest struct {
|
||||||
|
// Disk ID
|
||||||
|
// Required: true
|
||||||
|
DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReplicationSyncNow starts manual synchronization of an asynchronous replication pair
|
||||||
|
func (d Disks) ReplicationSyncNow(ctx context.Context, req ReplicationSyncNowRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/disks/replication_sync_now"
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package extnet
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -15,6 +16,11 @@ type EnableRequest struct {
|
|||||||
NetID uint64 `url:"net_id" json:"net_id" validate:"required"`
|
NetID uint64 `url:"net_id" json:"net_id" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type asyncWrapperEnableRequest struct {
|
||||||
|
EnableRequest
|
||||||
|
AsyncMode bool `url:"async_mode"`
|
||||||
|
}
|
||||||
|
|
||||||
// Enable enables external networks
|
// Enable enables external networks
|
||||||
func (e ExtNet) Enable(ctx context.Context, req EnableRequest) (bool, error) {
|
func (e ExtNet) Enable(ctx context.Context, req EnableRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -24,7 +30,12 @@ func (e ExtNet) Enable(ctx context.Context, req EnableRequest) (bool, error) {
|
|||||||
|
|
||||||
url := "/cloudbroker/extnet/enable"
|
url := "/cloudbroker/extnet/enable"
|
||||||
|
|
||||||
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
aReq := asyncWrapperEnableRequest{
|
||||||
|
EnableRequest: req,
|
||||||
|
AsyncMode: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -36,3 +47,32 @@ func (e ExtNet) Enable(ctx context.Context, req EnableRequest) (bool, error) {
|
|||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EnableAsync enables external networks in async mode
|
||||||
|
func (e ExtNet) EnableAsync(ctx context.Context, req EnableRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/extnet/enable"
|
||||||
|
|
||||||
|
aReq := asyncWrapperEnableRequest{
|
||||||
|
EnableRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := e.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
|
||||||
|
}
|
||||||
@@ -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 := "/cloudbroker/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 := "/cloudbroker/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
|
||||||
|
}
|
||||||
Loaded 100 of 150 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user