Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88b1fa1595 | ||
|
|
dba822085a | ||
|
|
cf93cd2d6d | ||
|
|
f34fa6055c | ||
|
|
1bf30e8778 | ||
|
|
77cbe6952b | ||
|
|
0595b5ae39 | ||
|
|
55fe76d12e | ||
|
|
db594a9d81 | ||
|
|
538f5cf026 |
No files matched your search
+15
-52
@@ -1,58 +1,21 @@
|
|||||||
## Version 15.1.0
|
## Version 15.10.0
|
||||||
|
|
||||||
Методы `Audits` в cloudapi/compute, cloudbroker/compute, cloudapi/account, cloudbroker/account, cloudapi/vins, cloudbroker/vins, cloudapi/rg и cloudbroker/rg стали deprecated и в следующих версиях будут удалены, вместо них необходимо использовать метод `List` в cloudapi/audit и cloudbroker/audit с соответствующими фильтрами
|
Методы `Audits` в cloudapi/compute, cloudbroker/compute, cloudapi/account, cloudbroker/account, cloudapi/vins, cloudbroker/vins, cloudapi/rg и cloudbroker/rg стали deprecated и будут удалены в версии 16.0, вместо них необходимо использовать метод `List` в cloudapi/audit и cloudbroker/audit с соответствующими фильтрами
|
||||||
Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke`, `AccessRevokeToPool` в cloudbroker/sep стали deprecated и в следующих версиях будут удалены
|
Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke`, `AccessRevokeToPool` в cloudbroker/sep стали deprecated и будут удалены в версии 16.0
|
||||||
Методы `ComputeCISet`, `ComputeCIUnset`, `GetAudits` в cloudbroker/compute и `GetAudits` в cloudapi/compute стали deprecated и будут удалены в следующих версиях
|
Методы `ComputeCISet`, `ComputeCIUnset`, `GetAudits` в cloudbroker/compute и `GetAudits` в cloudapi/compute стали deprecated и будут удалены в версии 16.0
|
||||||
Методы `ComputeCISet`, `ComputeCIUnset` в cloudbroker/image стали deprecated и будут удалены в следующих версиях
|
Методы `ComputeCISet`, `ComputeCIUnset` в cloudbroker/image стали deprecated и будут удалены в версии 16.0
|
||||||
|
Методы `Delete`, `Disable`, `Enable`, `GetConsumedCloudUnitsByType`, `GetReservedAccountUnits` в cloudapi/account стали deprecated и будут удалены в версии 16.0
|
||||||
|
Методы `Disable`, `Enable` в cloudbroker/account стали deprecated и будут удалены в версии 16.0
|
||||||
|
Метод `IsValidInviteUserToken` в cloudapi/user стал deprecated и будет удален в версии 16.0
|
||||||
|
Метод `GetLog` в cloudbroker/compute стал deprecated и будет удален в версии 16.0
|
||||||
|
Методы `ExecuteMaintenanceScript`, `ListEmails`, `ServicesRestart` в cloudbroker/grid стали deprecated и будут удалены в версии 16.0
|
||||||
|
Метод `Get` в cloudbroker/group стал deprecated и будет удален в версии 16.0
|
||||||
|
|
||||||
Все методы группы `.SDN()` находятся в альфа-версии.
|
|
||||||
|
|
||||||
### Добавлено
|
|
||||||
|
|
||||||
#### Общее
|
### Исправлено
|
||||||
|
|
||||||
|
#### client sdk
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-899 | Добавлена валидация полей `ssoUrl` и `decortUrl` в конфигах `Config`, `BVSConfig` и `LegacyConfig`, а также поля `domain` в конфиге `BVSConfig` при вызове конструкторов `New`, `NewBVS`, `NewLegacy` |
|
| BGOS-1135 | Исправлена ошибка в сообщении об ошибке при отсутствии времени истечения токена в клиенте |
|
||||||
|
|
||||||
#### kvmx86
|
|
||||||
| Идентификатор задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| BGOS-903 | Структура ответа `MassCreateError` в cloudbroker/kvmx86 |
|
|
||||||
|
|
||||||
#### node
|
|
||||||
| Идентификатор задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| BGOS-906 | Метод `Install` и структура запроса `InstallRequest` в cloudbroker/node |
|
|
||||||
|
|
||||||
#### zone
|
|
||||||
| Идентификатор задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| BGOS-902 | Вычисляемое поле `SupportedCpuModels` в структуру ответа `TestCPUAlignmentProfileResult` в cloudbroker/zone |
|
|
||||||
| BGOS-902 | Структура ответа `SupportedCpuModel` в cloudbroker/zone |
|
|
||||||
|
|
||||||
### Изменено
|
|
||||||
|
|
||||||
#### compute
|
|
||||||
| Идентификатор задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| BGOS-905 | Тип полей `Login` и `Password` с опциональных на обязательные в структуре `OSUser` в cloudbroker/compute |
|
|
||||||
|
|
||||||
#### zone
|
|
||||||
| Идентификатор<br>задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| BGOS-902 | Тип поля `Percentage` с `uint64` на `float64` в структуре ответа `CpuAlignmentProfileCandidate` в cloudbroker/zone |
|
|
||||||
|
|
||||||
#### SDN logicalports
|
|
||||||
| Идентификатор задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| BGOS-907 | Тип поля `MAC` с опционального на обязательное в структуре `AddAddress` в sdn/logicalports |
|
|
||||||
|
|
||||||
|
|
||||||
### Удалено
|
|
||||||
|
|
||||||
#### compute
|
|
||||||
| Идентификатор задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| BGOS-904 | Опциональное поле `Force` из структуры запроса `MigrateRequest` в cloudbroker/compute |
|
|
||||||
|
|
||||||
|
|
||||||
@@ -124,6 +124,7 @@ go get -u repository.basistech.ru/BASIS/dynamix-golang-sdk/v15
|
|||||||
- `Trunk` - получение информации о транковых портах;
|
- `Trunk` - получение информации о транковых портах;
|
||||||
- `VFPool` - управление пулом виртуальных сетевых функций;
|
- `VFPool` - управление пулом виртуальных сетевых функций;
|
||||||
- `VINS` - управление виртуальными изолированными сетями;
|
- `VINS` - управление виртуальными изолированными сетями;
|
||||||
|
- `VMFolder` – управление директориями ВМ;
|
||||||
- `VGPU` - управление виртуальными графическими процессорами;
|
- `VGPU` - управление виртуальными графическими процессорами;
|
||||||
- `Zone` - управление зонами.
|
- `Zone` - управление зонами.
|
||||||
|
|
||||||
@@ -162,7 +163,8 @@ go get -u repository.basistech.ru/BASIS/dynamix-golang-sdk/v15
|
|||||||
- `User` - управление пользователями (индивидуально);
|
- `User` - управление пользователями (индивидуально);
|
||||||
- `VGPU` - управление виртуальными графическими процессорами;
|
- `VGPU` - управление виртуальными графическими процессорами;
|
||||||
- `VFPool` - управление пулом виртуальных сетевых функций;
|
- `VFPool` - управление пулом виртуальных сетевых функций;
|
||||||
- `VINS` - управление виртуальными изолированными сетями.
|
- `VINS` - управление виртуальными изолированными сетями;
|
||||||
|
- `VMFolder` – управление директориями ВМ;
|
||||||
- `Zone` - управление зонами.
|
- `Zone` - управление зонами.
|
||||||
|
|
||||||
### SDN
|
### SDN
|
||||||
@@ -338,6 +340,7 @@ func main() {
|
|||||||
- `pkg/cloudapi/vfpool` - для `VFPool`
|
- `pkg/cloudapi/vfpool` - для `VFPool`
|
||||||
- `pkg/cloudapi/vins` - для `VINS`
|
- `pkg/cloudapi/vins` - для `VINS`
|
||||||
- `pkg/cloudapi/vgpu` - для `VGPU`
|
- `pkg/cloudapi/vgpu` - для `VGPU`
|
||||||
|
- `pkg/cloudapi/vmfolder` - для `VMFolder`
|
||||||
- `pkg/cloudapi/zone` - для `Zone`
|
- `pkg/cloudapi/zone` - для `Zone`
|
||||||
- **cloudbroker**:
|
- **cloudbroker**:
|
||||||
- `pkg/cloudbroker/account` - для `Account`
|
- `pkg/cloudbroker/account` - для `Account`
|
||||||
@@ -371,6 +374,7 @@ func main() {
|
|||||||
- `pkg/cloudbroker/vgpu` - для `VGPU`
|
- `pkg/cloudbroker/vgpu` - для `VGPU`
|
||||||
- `pkg/cloudbroker/vfpool` - для `VFPool`
|
- `pkg/cloudbroker/vfpool` - для `VFPool`
|
||||||
- `pkg/cloudbroker/vins` - для `VINS`
|
- `pkg/cloudbroker/vins` - для `VINS`
|
||||||
|
- `pkg/cloudbroker/vmfolder` - для `VMFolder`
|
||||||
- `pkg/cloudbroker/zone` - для `Zone`
|
- `pkg/cloudbroker/zone` - для `Zone`
|
||||||
- **sdn**:
|
- **sdn**:
|
||||||
- `pkg/sdn/acsgroups` - для `Access groups`
|
- `pkg/sdn/acsgroups` - для `Access groups`
|
||||||
@@ -537,6 +541,7 @@ func main() {
|
|||||||
- `.VFPool()` - для работы с `VFPool`
|
- `.VFPool()` - для работы с `VFPool`
|
||||||
- `.VINS()` - для работы с `VINS`
|
- `.VINS()` - для работы с `VINS`
|
||||||
- `.VGPU()` - для работы с `VGPU`
|
- `.VGPU()` - для работы с `VGPU`
|
||||||
|
- `.VMFolder()` - для работы с `VMFolder`
|
||||||
- `.Zone()` - для работы с `Zone`
|
- `.Zone()` - для работы с `Zone`
|
||||||
|
|
||||||
Доступные методы для `.CloudBroker()`:
|
Доступные методы для `.CloudBroker()`:
|
||||||
@@ -572,6 +577,7 @@ func main() {
|
|||||||
- `.VGPU()` - для работы с `VGPU`
|
- `.VGPU()` - для работы с `VGPU`
|
||||||
- `.VFPool()` - для работы с `VFPool`
|
- `.VFPool()` - для работы с `VFPool`
|
||||||
- `.VINS()` - для работы с `VINS`
|
- `.VINS()` - для работы с `VINS`
|
||||||
|
- `.VMFolder()` - для работы с `VMFolder`
|
||||||
- `.Zone()` - для работы с `Zone`
|
- `.Zone()` - для работы с `Zone`
|
||||||
|
|
||||||
Доступные методы для `.SDN()`:
|
Доступные методы для `.SDN()`:
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ type DecortClient struct {
|
|||||||
mutex *sync.Mutex
|
mutex *sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
// Сlient builder
|
// Client builder
|
||||||
func New(cfg config.Config) *DecortClient {
|
func New(cfg config.Config) *DecortClient {
|
||||||
if err := validators.ValidateConfig(cfg); err != nil {
|
if err := validators.ValidateConfig(cfg); err != nil {
|
||||||
panic(validators.ValidationErrors(validators.GetErrors(err)))
|
panic(validators.ValidationErrors(validators.GetErrors(err)))
|
||||||
@@ -444,7 +444,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)
|
||||||
|
|||||||
@@ -350,6 +350,10 @@ func isBoolTypeValidator(fe validator.FieldLevel) bool {
|
|||||||
return fe.Field().CanConvert(reflect.TypeOf(true))
|
return fe.Field().CanConvert(reflect.TypeOf(true))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isStringTypeValidator(fe validator.FieldLevel) bool {
|
||||||
|
return fe.Field().Kind() == reflect.String
|
||||||
|
}
|
||||||
|
|
||||||
func urlValidartor(fl validator.FieldLevel) bool {
|
func urlValidartor(fl validator.FieldLevel) bool {
|
||||||
fieldValues := fl.Field().String()
|
fieldValues := fl.Field().String()
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ func errorMessage(fe validator.FieldError) string {
|
|||||||
return fmt.Sprintf("%s %s: unexpected E-Mail format", prefix, fe.Field())
|
return fmt.Sprintf("%s %s: unexpected E-Mail format", prefix, fe.Field())
|
||||||
case "isBool":
|
case "isBool":
|
||||||
return fmt.Sprintf("%s %s: must be bool type", prefix, fe.Field())
|
return fmt.Sprintf("%s %s: must be bool type", prefix, fe.Field())
|
||||||
|
case "isString":
|
||||||
|
return fmt.Sprintf("%s %s: must be string type", prefix, fe.Field())
|
||||||
|
|
||||||
case "accessType":
|
case "accessType":
|
||||||
return fmt.Sprintf("%s %s must be one of the following: %s",
|
return fmt.Sprintf("%s %s must be one of the following: %s",
|
||||||
|
|||||||
@@ -231,6 +231,11 @@ func registerAllValidators(validate *validator.Validate) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = validate.RegisterValidation("isString", isStringTypeValidator)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
err = validate.RegisterValidation("url", urlValidartor)
|
err = validate.RegisterValidation("url", urlValidartor)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,14 @@ type ListRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
ZoneID uint64 `url:"zone_id,omitempty" json:"zone_id,omitempty"`
|
ZoneID uint64 `url:"zone_id,omitempty" json:"zone_id,omitempty"`
|
||||||
|
|
||||||
|
// Find by VM folder ID
|
||||||
|
// Required: false
|
||||||
|
FolderID uint64 `url:"folder_id,omitempty" json:"folder_id,omitempty"`
|
||||||
|
|
||||||
|
// Include computes from descendant folders.
|
||||||
|
// Required: false
|
||||||
|
IncludeDescendants interface{} `url:"include_descendants,omitempty" json:"include_descendants,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
// Page number
|
// Page number
|
||||||
// Required: false
|
// Required: false
|
||||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ type ItemSnapshot struct {
|
|||||||
// Compute info
|
// Compute info
|
||||||
Compute RecordCompute `json:"compute"`
|
Compute RecordCompute `json:"compute"`
|
||||||
|
|
||||||
// List disk ID
|
// List of disk IDs
|
||||||
Disks []uint64 `json:"disks"`
|
Disks []uint64 `json:"disks"`
|
||||||
|
|
||||||
// GUID
|
// GUID
|
||||||
@@ -182,6 +182,9 @@ type RecordNetAttach struct {
|
|||||||
// Enabled
|
// Enabled
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
|
|
||||||
|
// Enable default gateway
|
||||||
|
EnableDefaultGateway bool `json:"enable_default_gateway"`
|
||||||
|
|
||||||
// Enable security groups
|
// Enable security groups
|
||||||
EnableSecGroups bool `json:"enable_secgroups"`
|
EnableSecGroups bool `json:"enable_secgroups"`
|
||||||
|
|
||||||
@@ -509,6 +512,9 @@ type RecordCompute struct {
|
|||||||
// Registered or not
|
// Registered or not
|
||||||
Registered bool `json:"registered"`
|
Registered bool `json:"registered"`
|
||||||
|
|
||||||
|
// Whether a compute has been resized online
|
||||||
|
ResizedOnline bool `json:"resizedOnline"`
|
||||||
|
|
||||||
// Resource name
|
// Resource name
|
||||||
ResName string `json:"resName"`
|
ResName string `json:"resName"`
|
||||||
|
|
||||||
@@ -563,6 +569,264 @@ type RecordCompute struct {
|
|||||||
// Zone ID
|
// Zone ID
|
||||||
// Required: false
|
// Required: false
|
||||||
ZoneID uint64 `json:"zoneId"`
|
ZoneID uint64 `json:"zoneId"`
|
||||||
|
|
||||||
|
// Folder ID
|
||||||
|
FolderID uint64 `json:"folder_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SnapRecordCompute struct {
|
||||||
|
// Access Control List
|
||||||
|
ACL ListACL `json:"acl"`
|
||||||
|
|
||||||
|
// Account ID
|
||||||
|
AccountID uint64 `json:"accountId"`
|
||||||
|
|
||||||
|
// Account name
|
||||||
|
AccountName string `json:"accountName"`
|
||||||
|
|
||||||
|
// Affinity label
|
||||||
|
AffinityLabel string `json:"affinityLabel"`
|
||||||
|
|
||||||
|
// List affinity rules
|
||||||
|
AffinityRules ListRules `json:"affinityRules"`
|
||||||
|
|
||||||
|
// Affinity weight
|
||||||
|
AffinityWeight uint64 `json:"affinityWeight"`
|
||||||
|
|
||||||
|
// List anti affinity rules
|
||||||
|
AntiAffinityRules ListRules `json:"antiAffinityRules"`
|
||||||
|
|
||||||
|
// Auto start when node restarted
|
||||||
|
AutoStart bool `json:"autoStart"`
|
||||||
|
|
||||||
|
// Architecture
|
||||||
|
Architecture string `json:"arch"`
|
||||||
|
|
||||||
|
// Boot image ID
|
||||||
|
BootImageID uint64 `json:"boot_image_id"`
|
||||||
|
|
||||||
|
// Boot order
|
||||||
|
BootOrder []string `json:"bootOrder"`
|
||||||
|
|
||||||
|
// Boot type
|
||||||
|
BootType string `json:"bootType"`
|
||||||
|
|
||||||
|
// Boot disk size
|
||||||
|
BootDiskSize uint64 `json:"bootdiskSize"`
|
||||||
|
|
||||||
|
// CD Image Id
|
||||||
|
CdImageId uint64 `json:"cdImageId"`
|
||||||
|
|
||||||
|
// Chipset
|
||||||
|
Chipset string `json:"chipset"`
|
||||||
|
|
||||||
|
// Clone reference
|
||||||
|
CloneReference uint64 `json:"cloneReference"`
|
||||||
|
|
||||||
|
// List clone IDs
|
||||||
|
Clones []uint64 `json:"clones"`
|
||||||
|
|
||||||
|
// Clock
|
||||||
|
Clock string `json:"clock"`
|
||||||
|
|
||||||
|
// Compute CI ID
|
||||||
|
ComputeCIID uint64 `json:"computeciId"`
|
||||||
|
|
||||||
|
// CPU Pin
|
||||||
|
CPUPin bool `json:"cpupin"`
|
||||||
|
|
||||||
|
// Number of cores
|
||||||
|
CPU uint64 `json:"cpus"`
|
||||||
|
|
||||||
|
// Created by
|
||||||
|
CreatedBy string `json:"createdBy"`
|
||||||
|
|
||||||
|
// Created time
|
||||||
|
CreatedTime uint64 `json:"createdTime"`
|
||||||
|
|
||||||
|
// Custom fields items
|
||||||
|
CustomFields map[string]interface{} `json:"customFields"`
|
||||||
|
|
||||||
|
// Deleted by
|
||||||
|
DeletedBy string `json:"deletedBy"`
|
||||||
|
|
||||||
|
// Deleted time
|
||||||
|
DeletedTime uint64 `json:"deletedTime"`
|
||||||
|
|
||||||
|
// Description
|
||||||
|
Description string `json:"desc"`
|
||||||
|
|
||||||
|
// Devices
|
||||||
|
Devices interface{} `json:"devices"`
|
||||||
|
|
||||||
|
// List disks in compute
|
||||||
|
Disks ListComputeDisks `json:"disks"`
|
||||||
|
|
||||||
|
// Driver
|
||||||
|
Driver string `json:"driver"`
|
||||||
|
|
||||||
|
// Grid ID
|
||||||
|
GID uint64 `json:"gid"`
|
||||||
|
|
||||||
|
// GUID
|
||||||
|
GUID uint64 `json:"guid"`
|
||||||
|
|
||||||
|
// HPBacked
|
||||||
|
HPBacked bool `json:"hpBacked"`
|
||||||
|
|
||||||
|
// Hot resize
|
||||||
|
HotResize bool `json:"hotResize"`
|
||||||
|
|
||||||
|
// ID
|
||||||
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
|
// Image ID
|
||||||
|
ImageID uint64 `json:"imageId"`
|
||||||
|
|
||||||
|
// Image name
|
||||||
|
ImageName string `json:"imageName"`
|
||||||
|
|
||||||
|
// List interfaces
|
||||||
|
Interfaces ListInterfaces `json:"interfaces"`
|
||||||
|
|
||||||
|
// Loader meta iso information
|
||||||
|
LoaderMetaIso LoaderMetaIso `json:"loaderMetaIso"`
|
||||||
|
|
||||||
|
// Live migration job ID
|
||||||
|
LiveMigrationJobID uint64 `json:"live_migration_job_id"`
|
||||||
|
|
||||||
|
// Loader type
|
||||||
|
LoaderType string `json:"loaderType"`
|
||||||
|
|
||||||
|
// Lock status
|
||||||
|
LockStatus string `json:"lockStatus"`
|
||||||
|
|
||||||
|
// Manager ID
|
||||||
|
ManagerID uint64 `json:"managerId"`
|
||||||
|
|
||||||
|
// Manager type
|
||||||
|
ManagerType string `json:"managerType"`
|
||||||
|
|
||||||
|
// Migration job
|
||||||
|
MigrationJob uint64 `json:"migrationjob"`
|
||||||
|
|
||||||
|
// Milestones
|
||||||
|
Milestones uint64 `json:"milestones"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// NeedReboot
|
||||||
|
NeedReboot bool `json:"needReboot"`
|
||||||
|
|
||||||
|
// Network interface naming
|
||||||
|
NetworkInterfaceNaming string `json:"networkInterfaceNaming"`
|
||||||
|
|
||||||
|
// Node ID
|
||||||
|
NodeID uint64 `json:"node_id"`
|
||||||
|
|
||||||
|
// Numa Affinity
|
||||||
|
NumaAffinity string `json:"numaAffinity"`
|
||||||
|
|
||||||
|
//NumaNodeId
|
||||||
|
NumaNodeId int64 `json:"numaNodeId"`
|
||||||
|
|
||||||
|
// Natable VINS ID
|
||||||
|
NatableVINSID uint64 `json:"natableVinsId"`
|
||||||
|
|
||||||
|
// Natable VINS IP
|
||||||
|
NatableVINSIP string `json:"natableVinsIp"`
|
||||||
|
|
||||||
|
// Natable VINS Name
|
||||||
|
NatableVINSName string `json:"natableVinsName"`
|
||||||
|
|
||||||
|
// Natable VINS network
|
||||||
|
NatableVINSNetwork string `json:"natableVinsNetwork"`
|
||||||
|
|
||||||
|
// Natable VINS network name
|
||||||
|
NatableVINSNetworkName string `json:"natableVinsNetworkName"`
|
||||||
|
|
||||||
|
// Name of OS
|
||||||
|
OSVersion string `json:"os_version"`
|
||||||
|
|
||||||
|
// List OS Users
|
||||||
|
OSUsers ListOSUser `json:"osUsers"`
|
||||||
|
|
||||||
|
// Pinned to node
|
||||||
|
PinnedToNode int64 `json:"pinnedToNode"`
|
||||||
|
|
||||||
|
// PreferredCPU
|
||||||
|
PreferredCPU []int64 `json:"preferredCpu"`
|
||||||
|
|
||||||
|
// CPU alignment profile
|
||||||
|
CPUAlignmentProfile CPUAlignmentProfile `json:"cpu_alignment_profile"`
|
||||||
|
|
||||||
|
// Qemu_quest
|
||||||
|
QemuQuest QemuQuest `json:"qemu_guest"`
|
||||||
|
|
||||||
|
// ReadOnly indicates read-only mode state
|
||||||
|
ReadOnly bool `json:"read_only"`
|
||||||
|
|
||||||
|
// Number of RAM
|
||||||
|
RAM uint64 `json:"ram"`
|
||||||
|
|
||||||
|
// Reference ID
|
||||||
|
ReferenceID string `json:"referenceId"`
|
||||||
|
|
||||||
|
// Registered or not
|
||||||
|
Registered bool `json:"registered"`
|
||||||
|
|
||||||
|
// Resource name
|
||||||
|
ResName string `json:"resName"`
|
||||||
|
|
||||||
|
// Reserved Node Cpus
|
||||||
|
ReservedNodeCpus []uint64 `json:"reservedNodeCpus"`
|
||||||
|
|
||||||
|
// Resource group ID
|
||||||
|
RGID uint64 `json:"rgId"`
|
||||||
|
|
||||||
|
// Resource group name
|
||||||
|
RGName string `json:"rgName"`
|
||||||
|
|
||||||
|
// Stateless SepID
|
||||||
|
StatelessSepID int64 `json:"statelessSepId"`
|
||||||
|
|
||||||
|
// Stateless SepType
|
||||||
|
StatelessSepType string `json:"statelessSepType"`
|
||||||
|
|
||||||
|
// Status
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Tags
|
||||||
|
Tags map[string]string `json:"tags"`
|
||||||
|
|
||||||
|
// Tech status
|
||||||
|
TechStatus string `json:"techStatus"`
|
||||||
|
|
||||||
|
// Updated by
|
||||||
|
UpdatedBy string `json:"updatedBy"`
|
||||||
|
|
||||||
|
// Updated time
|
||||||
|
UpdatedTime uint64 `json:"updatedTime"`
|
||||||
|
|
||||||
|
// User Managed or not
|
||||||
|
UserManaged bool `json:"userManaged"`
|
||||||
|
|
||||||
|
// Userdata
|
||||||
|
Userdata interface{} `json:"userdata"`
|
||||||
|
|
||||||
|
// vGPUs list
|
||||||
|
VGPUs []VGPUItem `json:"vgpus"`
|
||||||
|
|
||||||
|
// VNC password
|
||||||
|
VNCPassword string `json:"vncPasswd"`
|
||||||
|
|
||||||
|
// Weight
|
||||||
|
Weight uint64 `json:"weight"`
|
||||||
|
|
||||||
|
// Zone ID
|
||||||
|
// Required: false
|
||||||
|
ZoneID uint64 `json:"zoneId"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type LoaderMetaIso struct {
|
type LoaderMetaIso struct {
|
||||||
@@ -690,7 +954,10 @@ type ListOSUser []ItemOSUser
|
|||||||
|
|
||||||
// Main information about snapsets
|
// Main information about snapsets
|
||||||
type ItemSnapSet struct {
|
type ItemSnapSet struct {
|
||||||
// List disk IDs
|
// Compute info
|
||||||
|
Compute SnapRecordCompute `json:"compute"`
|
||||||
|
|
||||||
|
// List disk ID
|
||||||
Disks []uint64 `json:"disks"`
|
Disks []uint64 `json:"disks"`
|
||||||
|
|
||||||
// GUID
|
// GUID
|
||||||
@@ -699,6 +966,9 @@ type ItemSnapSet struct {
|
|||||||
// Label
|
// Label
|
||||||
Label string `json:"label"`
|
Label string `json:"label"`
|
||||||
|
|
||||||
|
// Memory dump image ID
|
||||||
|
MemoryDumpImage uint64 `json:"memory_dump_image"`
|
||||||
|
|
||||||
// Timestamp
|
// Timestamp
|
||||||
Timestamp uint64 `json:"timestamp"`
|
Timestamp uint64 `json:"timestamp"`
|
||||||
}
|
}
|
||||||
@@ -723,6 +993,9 @@ type ItemVNFInterface struct {
|
|||||||
// Enabled
|
// Enabled
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
|
|
||||||
|
// Enable default gateway
|
||||||
|
EnableDefaultGateway bool `json:"enable_default_gateway"`
|
||||||
|
|
||||||
// Enable security groups
|
// Enable security groups
|
||||||
EnableSecGroups bool `json:"enable_secgroups"`
|
EnableSecGroups bool `json:"enable_secgroups"`
|
||||||
|
|
||||||
@@ -990,6 +1263,9 @@ type SnapshotExtend struct {
|
|||||||
// Label
|
// Label
|
||||||
Label string `json:"label"`
|
Label string `json:"label"`
|
||||||
|
|
||||||
|
// Pool name
|
||||||
|
PoolName string `json:"poolName"`
|
||||||
|
|
||||||
// Reference ID
|
// Reference ID
|
||||||
ReferenceID string `json:"referenceId"`
|
ReferenceID string `json:"referenceId"`
|
||||||
|
|
||||||
@@ -1185,6 +1461,9 @@ type ItemCompute struct {
|
|||||||
// Name
|
// Name
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// Node ID
|
||||||
|
NodeID uint64 `json:"node_id"`
|
||||||
|
|
||||||
// NeedReboot
|
// NeedReboot
|
||||||
NeedReboot bool `json:"needReboot"`
|
NeedReboot bool `json:"needReboot"`
|
||||||
|
|
||||||
@@ -1224,6 +1503,9 @@ type ItemCompute struct {
|
|||||||
// Registered
|
// Registered
|
||||||
Registered bool `json:"registered"`
|
Registered bool `json:"registered"`
|
||||||
|
|
||||||
|
// Whether a compute has been resized online
|
||||||
|
ResizedOnline bool `json:"resizedOnline"`
|
||||||
|
|
||||||
// Resource name
|
// Resource name
|
||||||
ResName string `json:"resName"`
|
ResName string `json:"resName"`
|
||||||
|
|
||||||
@@ -1277,6 +1559,9 @@ type ItemCompute struct {
|
|||||||
|
|
||||||
// Zone ID
|
// Zone ID
|
||||||
ZoneID uint64 `json:"zoneId"`
|
ZoneID uint64 `json:"zoneId"`
|
||||||
|
|
||||||
|
// Folder ID
|
||||||
|
FolderID uint64 `json:"folder_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListInfoDisks
|
// ListInfoDisks
|
||||||
|
|||||||
@@ -81,6 +81,11 @@ type NetAttachRequest struct {
|
|||||||
// Flag indicating whether this interface is enabled (only for VINS, EXTNET, DPDK, SDN, TRUNK)
|
// Flag indicating whether this interface is enabled (only for VINS, EXTNET, DPDK, SDN, TRUNK)
|
||||||
// Required: false
|
// Required: false
|
||||||
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
|
// Flag indicating whether default gateway is enabled for this interface
|
||||||
|
// Required: false
|
||||||
|
// Default: true
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type wrapperNetAttachRequest struct {
|
type wrapperNetAttachRequest struct {
|
||||||
|
|||||||
@@ -331,6 +331,10 @@ type ItemSnapshot struct {
|
|||||||
// Label
|
// Label
|
||||||
Label string `json:"label"`
|
Label string `json:"label"`
|
||||||
|
|
||||||
|
// Pool name
|
||||||
|
PoolName string `json:"poolName"`
|
||||||
|
|
||||||
|
// Reference ID
|
||||||
ReferenceID string `json:"referenceId"`
|
ReferenceID string `json:"referenceId"`
|
||||||
|
|
||||||
// Resource ID
|
// Resource ID
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -102,6 +103,6 @@ func (i Image) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
|||||||
|
|
||||||
url := "/cloudapi/image/list"
|
url := "/cloudapi/image/list"
|
||||||
|
|
||||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
res, err := i.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
@@ -76,6 +76,11 @@ type Interface struct {
|
|||||||
// Flag indicating whether this interface is enabled (only for VINS, EXTNET, DPDK, SDN, TRUNK)
|
// Flag indicating whether this interface is enabled (only for VINS, EXTNET, DPDK, SDN, TRUNK)
|
||||||
// Required: false
|
// Required: false
|
||||||
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
|
// Flag indicating whether default gateway are enabled for this interface, not applicable to netType EXTNET, VFNIC, TRUNK, or SDN
|
||||||
|
// Default: true
|
||||||
|
// Required: false
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DataDisk detailed struct for DataDisks field in CreateRequest and CreateBlankRequest
|
// DataDisk detailed struct for DataDisks field in CreateRequest and CreateBlankRequest
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ type ItemLocation struct {
|
|||||||
|
|
||||||
// Is BRO enabled
|
// Is BRO enabled
|
||||||
BROEnabled bool `json:"bro_enabled"`
|
BROEnabled bool `json:"bro_enabled"`
|
||||||
|
|
||||||
|
// Are VM Folders enabled
|
||||||
|
VMFoldersEnabled bool `json:"vm_folders_enabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of locations
|
// List of locations
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package pcidevice
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/serialization"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/serialization"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,10 @@ type CreateRequest struct {
|
|||||||
// SDN access group id
|
// SDN access group id
|
||||||
// Required: false
|
// Required: false
|
||||||
SDNAccessGroupID string `url:"sdn_access_group_id,omitempty" json:"sdn_access_group_id,omitempty"`
|
SDNAccessGroupID string `url:"sdn_access_group_id,omitempty" json:"sdn_access_group_id,omitempty"`
|
||||||
|
|
||||||
|
// Enabling default gateway
|
||||||
|
// Required: false
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type StoragePolicy struct {
|
type StoragePolicy struct {
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package vins
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -62,11 +62,11 @@ type CreateInAccountRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
// Default: false
|
// Default: false
|
||||||
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
|
||||||
|
|
||||||
type wrapperCreateRequestInAcc struct {
|
// Flag indicating whether default gateway is enabled for this VINS
|
||||||
CreateInAccountRequest
|
// Required: false
|
||||||
Routes []string `url:"routes,omitempty"`
|
// Default: true
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateInAccount creates VINS in account level
|
// CreateInAccount creates VINS in account level
|
||||||
@@ -76,31 +76,9 @@ func (v VINS) CreateInAccount(ctx context.Context, req CreateInAccountRequest) (
|
|||||||
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
var routes []string
|
|
||||||
|
|
||||||
if len(req.Routes) != 0 {
|
|
||||||
routes = make([]string, 0, len(req.Routes))
|
|
||||||
|
|
||||||
for r := range req.Routes {
|
|
||||||
b, err := json.Marshal(req.Routes[r])
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
|
|
||||||
routes = append(routes, string(b))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
routes = []string{}
|
|
||||||
}
|
|
||||||
|
|
||||||
reqWrapped := wrapperCreateRequestInAcc{
|
|
||||||
CreateInAccountRequest: req,
|
|
||||||
Routes: routes,
|
|
||||||
}
|
|
||||||
|
|
||||||
url := "/cloudapi/vins/createInAccount"
|
url := "/cloudapi/vins/createInAccount"
|
||||||
|
|
||||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package vins
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -56,11 +56,11 @@ type CreateInRGRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
// Default: false
|
// Default: false
|
||||||
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
|
||||||
|
|
||||||
type wrapperCreateRequestInRG struct {
|
// Flag indicating whether default gateway is enabled for this VINS
|
||||||
CreateInRGRequest
|
// Required: false
|
||||||
Routes []string `url:"routes,omitempty"`
|
// Default: true
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateInRG creates VINS in resource group level
|
// CreateInRG creates VINS in resource group level
|
||||||
@@ -70,31 +70,9 @@ func (v VINS) CreateInRG(ctx context.Context, req CreateInRGRequest) (uint64, er
|
|||||||
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
var routes []string
|
|
||||||
|
|
||||||
if len(req.Routes) != 0 {
|
|
||||||
routes = make([]string, 0, len(req.Routes))
|
|
||||||
|
|
||||||
for r := range req.Routes {
|
|
||||||
b, err := json.Marshal(req.Routes[r])
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
|
|
||||||
routes = append(routes, string(b))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
routes = []string{}
|
|
||||||
}
|
|
||||||
|
|
||||||
reqWrapped := wrapperCreateRequestInRG{
|
|
||||||
CreateInRGRequest: req,
|
|
||||||
Routes: routes,
|
|
||||||
}
|
|
||||||
|
|
||||||
url := "/cloudapi/vins/createInRG"
|
url := "/cloudapi/vins/createInRG"
|
||||||
|
|
||||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -694,6 +694,9 @@ type RecordVINS struct {
|
|||||||
// Description
|
// Description
|
||||||
Description string `json:"desc"`
|
Description string `json:"desc"`
|
||||||
|
|
||||||
|
// Enable Default Gateway
|
||||||
|
EnableDefaultGateway bool `json:"enable_default_gateway"`
|
||||||
|
|
||||||
// Enable Security Groups
|
// Enable Security Groups
|
||||||
EnableSecGroups bool `json:"enable_secgroups"`
|
EnableSecGroups bool `json:"enable_secgroups"`
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package cloudapi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/pkg/cloudapi/vmfolder"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Accessing the VMFolder method group
|
||||||
|
func (ca *CloudAPI) VMFolder() *vmfolder.VMFolder {
|
||||||
|
return vmfolder.New(ca.client)
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AddACLAccessRequest adds ACL access to a vm folder
|
||||||
|
type AddACLAccessRequest struct {
|
||||||
|
// ID of a folder
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
|
||||||
|
// User or group name to grant access
|
||||||
|
// Required: true
|
||||||
|
User string `url:"user" json:"user" validate:"required"`
|
||||||
|
|
||||||
|
// ID of a folder
|
||||||
|
// Required: true
|
||||||
|
Right string `url:"right" json:"right" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddACLAccess adds ACL access to a vm folder
|
||||||
|
func (v VMFolder) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vmfolder/add_acl_access"
|
||||||
|
|
||||||
|
res, err := v.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,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ComputesMoveRequest struct to move computes to a vm folder
|
||||||
|
type ComputesMoveRequest struct {
|
||||||
|
// IDs of computes to move
|
||||||
|
// Required: true
|
||||||
|
ComputeIDs []uint64 `url:"compute_ids" json:"compute_ids" validate:"required"`
|
||||||
|
|
||||||
|
// Target vm folder ID
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ComputesMove moves computes to a vm folder
|
||||||
|
func (v VMFolder) ComputesMove(ctx context.Context, req ComputesMoveRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vmfolder/computes_move"
|
||||||
|
|
||||||
|
res, err := v.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 vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CreateRequest struct to create a vm folder
|
||||||
|
type CreateRequest struct {
|
||||||
|
// Resource Group ID
|
||||||
|
// Required: true
|
||||||
|
RGID uint64 `url:"rg_id" json:"rg_id" validate:"required"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
// Required: true
|
||||||
|
Name string `url:"name" json:"name" validate:"required"`
|
||||||
|
|
||||||
|
// Parent ID
|
||||||
|
// Required: false
|
||||||
|
ParentID uint64 `url:"parent_id,omitempty" json:"parent_id,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create creates a vm folder
|
||||||
|
func (v VMFolder) Create(ctx context.Context, req CreateRequest) (uint64, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vmfolder/create"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseUint(string(res), 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DeleteACLAccessRequest deletes ACL access from a vm folder
|
||||||
|
type DelACLAccessRequest struct {
|
||||||
|
// ID of a folder
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
|
||||||
|
// User or group name to revoke access from
|
||||||
|
// Required: true
|
||||||
|
User string `url:"user" json:"user" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteACLAccess deletes ACL access from a vm foler
|
||||||
|
func (v VMFolder) DeleteACLAccess(ctx context.Context, req DelACLAccessRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vmfolder/del_acl_access"
|
||||||
|
|
||||||
|
res, err := v.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,39 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DeleteRequest struct to delete a VM folder
|
||||||
|
type DeleteRequest struct {
|
||||||
|
// ID of a folder to delete
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete deletes a vm folder
|
||||||
|
func (v VMFolder) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vmfolder/delete"
|
||||||
|
|
||||||
|
res, err := v.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 vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetRequest struct to get detailed information about a vm folder
|
||||||
|
type GetRequest struct {
|
||||||
|
// ID of a folder
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get gets current configuration of the vm folder as a RecordVMFolder struct
|
||||||
|
func (v VMFolder) Get(ctx context.Context, req GetRequest) (*RecordVMFolder, error) {
|
||||||
|
res, err := v.GetRaw(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := RecordVMFolder{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &info, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRaw gets current configuration of the vm folder as an array of bytes
|
||||||
|
func (v VMFolder) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vmfolder/get"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ListRequest struct to get list of vm folders
|
||||||
|
type ListRequest struct {
|
||||||
|
// Resource group ID
|
||||||
|
// Required: true
|
||||||
|
RGID uint64 `url:"rg_id" json:"rg_id" validate:"required"`
|
||||||
|
|
||||||
|
// Page number
|
||||||
|
// Required: false
|
||||||
|
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||||
|
|
||||||
|
// Page size
|
||||||
|
// Required: false
|
||||||
|
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List gets list of all vm folders in a resource group as a ListVMFolder struct
|
||||||
|
func (v VMFolder) List(ctx context.Context, req ListRequest) (*ListVMFolder, error) {
|
||||||
|
|
||||||
|
res, err := v.ListRaw(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
list := ListVMFolder{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &list)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &list, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListRaw gets list of all vm folders in a resource group as an array of bytes
|
||||||
|
func (v VMFolder) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||||
|
|
||||||
|
if err := validators.ValidateRequest(req); err != nil {
|
||||||
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vmfolder/list"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
// Detailed information about a folder
|
||||||
|
type RecordVMFolder struct {
|
||||||
|
// ID
|
||||||
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
|
// RG ID
|
||||||
|
RGID uint64 `json:"rg_id"`
|
||||||
|
|
||||||
|
// GID
|
||||||
|
GID uint64 `json:"gid"`
|
||||||
|
|
||||||
|
// Name of a folder
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// ACL
|
||||||
|
ACL []ACL `json:"acl"`
|
||||||
|
|
||||||
|
// Time of creation
|
||||||
|
CreatedTime uint64 `json:"created_time"`
|
||||||
|
|
||||||
|
// Parent ID
|
||||||
|
ParentID uint64 `json:"parent_id"`
|
||||||
|
|
||||||
|
// Status of a folder
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Compute IDs
|
||||||
|
ComputeIDs []uint64 `json:"compute_ids"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ACL
|
||||||
|
type ACL struct {
|
||||||
|
// Explicit
|
||||||
|
Explicit bool `json:"explicit"`
|
||||||
|
|
||||||
|
// Right
|
||||||
|
Right string `json:"right"`
|
||||||
|
|
||||||
|
// Status
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Type
|
||||||
|
Type string `json:"type"`
|
||||||
|
|
||||||
|
// User group ID
|
||||||
|
UserGroupID string `json:"userGroupId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of vm folders
|
||||||
|
type ListVMFolder struct {
|
||||||
|
// Entry count
|
||||||
|
EntryCount uint64 `json:"entryCount"`
|
||||||
|
|
||||||
|
// Data
|
||||||
|
Data []ItemVMFolder `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detailed information about a folder item
|
||||||
|
type ItemVMFolder struct {
|
||||||
|
// Folder ID
|
||||||
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
|
// Parent ID
|
||||||
|
ParentID uint64 `json:"parent_id"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// ACL
|
||||||
|
ACL []ACL `json:"acl"`
|
||||||
|
|
||||||
|
// Status
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// VM count
|
||||||
|
VMCount uint64 `json:"vm_count"`
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// MoveRequest to move a vm folder to a compute
|
||||||
|
type MoveRequest struct {
|
||||||
|
// VM Folder ID
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id"`
|
||||||
|
|
||||||
|
// New parent folder ID
|
||||||
|
// Required: true
|
||||||
|
NewParentID uint64 `url:"new_parent_id" json:"new_parent_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move moves a vm folder to a compute
|
||||||
|
func (v VMFolder) Move(ctx context.Context, req MoveRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vmfolder/move"
|
||||||
|
|
||||||
|
res, err := v.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,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// RenameRequest struct to rename a VM folder
|
||||||
|
type RenameRequest struct {
|
||||||
|
// ID of a folder to rename
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
|
||||||
|
// A new name
|
||||||
|
// Required: true
|
||||||
|
Name string `url:"name" json:"name" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rename renames a vm folder
|
||||||
|
func (v VMFolder) Rename(ctx context.Context, req RenameRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vmfolder/rename"
|
||||||
|
|
||||||
|
res, err := v.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,17 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/interfaces"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Structure for creating request to VMFolder
|
||||||
|
type VMFolder struct {
|
||||||
|
client interfaces.Caller
|
||||||
|
}
|
||||||
|
|
||||||
|
// Builder for VMFolder endpoints
|
||||||
|
func New(client interfaces.Caller) *VMFolder {
|
||||||
|
return &VMFolder{
|
||||||
|
client,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -111,6 +111,12 @@ type RecordZone struct {
|
|||||||
|
|
||||||
// CPU alignment profiles
|
// CPU alignment profiles
|
||||||
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
|
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
|
||||||
|
|
||||||
|
// Reserved CPU
|
||||||
|
ReservedCPU uint64 `json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Reserved RAM
|
||||||
|
ReservedRAM uint64 `json:"reserved_ram"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// A zone item from a list
|
// A zone item from a list
|
||||||
@@ -183,4 +189,10 @@ type ItemZone struct {
|
|||||||
|
|
||||||
// CPU alignment profiles
|
// CPU alignment profiles
|
||||||
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
|
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
|
||||||
|
|
||||||
|
// Reserved CPU
|
||||||
|
ReservedCPU uint64 `json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Reserved RAM
|
||||||
|
ReservedRAM uint64 `json:"reserved_ram"`
|
||||||
}
|
}
|
||||||
@@ -3,9 +3,8 @@ package account
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter
|
// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ type SetCPUAllocationRatioRequest struct {
|
|||||||
|
|
||||||
// CPU allocation ratio, i.e. one pCPU = ratio*vCPU
|
// CPU allocation ratio, i.e. one pCPU = ratio*vCPU
|
||||||
// Required: true
|
// Required: true
|
||||||
Ratio float64 `url:"ratio" json:"ratio" validate:"required"`
|
Ratio uint64 `url:"ratio" json:"ratio" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetCPUAllocationRatio sets CPU allocation ratio
|
// SetCPUAllocationRatio sets CPU allocation ratio
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package apiaccess
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
)
|
)
|
||||||
@@ -20,23 +20,25 @@ type DescUpdateRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DescUpdate sets a new text description of the apiaccess group.
|
// DescUpdate sets a new text description of the apiaccess group.
|
||||||
func (a APIAccess) DescUpdate(ctx context.Context, req DescUpdateRequest) (bool, error) {
|
func (a APIAccess) DescUpdate(ctx context.Context, req DescUpdateRequest) (*ItemAPIAccess, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
url := "/cloudbroker/apiaccess/descUpdate"
|
url := "/cloudbroker/apiaccess/descUpdate"
|
||||||
|
|
||||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := strconv.ParseBool(string(res))
|
info := ItemAPIAccess{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, nil
|
return &info, nil
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package apiaccess
|
package apiaccess
|
||||||
|
|
||||||
|
import "encoding/json"
|
||||||
|
|
||||||
type ItemAPIAccess struct {
|
type ItemAPIAccess struct {
|
||||||
// APIs
|
// APIs
|
||||||
APIs APIsEndpoints `json:"apis"`
|
APIs APIsEndpoints `json:"apis"`
|
||||||
@@ -88,21 +90,50 @@ type APIsEndpoints struct {
|
|||||||
// CloudBroker endpoints
|
// CloudBroker endpoints
|
||||||
CloudBroker CloudBrokerEndpoints `json:"cloudbroker,omitempty"`
|
CloudBroker CloudBrokerEndpoints `json:"cloudbroker,omitempty"`
|
||||||
|
|
||||||
// LibCloud endpoints
|
// SDN endpoints
|
||||||
LibCloud LibCloudEndpoints `json:"libcloud,omitempty"`
|
SDN SDNEndpoints `json:"sdn,omitempty"`
|
||||||
|
|
||||||
// System endpoints
|
// System endpoints
|
||||||
System SystemEndpoints `json:"system,omitempty"`
|
System SystemEndpoints `json:"system,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MarshalJSON omits empty namespaces, so that "{}" is not sent in requests.
|
||||||
|
func (a APIsEndpoints) MarshalJSON() ([]byte, error) {
|
||||||
|
namespaces := []struct {
|
||||||
|
key string
|
||||||
|
value interface{}
|
||||||
|
}{
|
||||||
|
{"cloudapi", a.CloudAPI},
|
||||||
|
{"cloudbroker", a.CloudBroker},
|
||||||
|
{"sdn", a.SDN},
|
||||||
|
{"system", a.System},
|
||||||
|
}
|
||||||
|
|
||||||
|
result := make(map[string]json.RawMessage, len(namespaces))
|
||||||
|
|
||||||
|
for _, ns := range namespaces {
|
||||||
|
data, err := json.Marshal(ns.value)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if string(data) == "{}" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
result[ns.key] = data
|
||||||
|
}
|
||||||
|
|
||||||
|
return json.Marshal(result)
|
||||||
|
}
|
||||||
|
|
||||||
type CloudAPIEndpoints struct {
|
type CloudAPIEndpoints struct {
|
||||||
Account []string `json:"account,omitempty"`
|
Account []string `json:"account,omitempty"`
|
||||||
|
Audit []string `json:"audit,omitempty"`
|
||||||
BService []string `json:"bservice,omitempty"`
|
BService []string `json:"bservice,omitempty"`
|
||||||
CloudSpace []string `json:"cloudspace,omitempty"`
|
|
||||||
Compute []string `json:"compute,omitempty"`
|
Compute []string `json:"compute,omitempty"`
|
||||||
ComputeCI []string `json:"computeci,omitempty"`
|
|
||||||
Disks []string `json:"disks,omitempty"`
|
Disks []string `json:"disks,omitempty"`
|
||||||
DPDK []string `json:"dpdk,omitempty"`
|
DPDKNet []string `json:"dpdknet,omitempty"`
|
||||||
ExtNet []string `json:"extnet,omitempty"`
|
ExtNet []string `json:"extnet,omitempty"`
|
||||||
FLIPGroup []string `json:"flipgroup,omitempty"`
|
FLIPGroup []string `json:"flipgroup,omitempty"`
|
||||||
GPU []string `json:"gpu,omitempty"`
|
GPU []string `json:"gpu,omitempty"`
|
||||||
@@ -112,18 +143,19 @@ type CloudAPIEndpoints struct {
|
|||||||
KVMX86 []string `json:"kvmx86,omitempty"`
|
KVMX86 []string `json:"kvmx86,omitempty"`
|
||||||
LB []string `json:"lb,omitempty"`
|
LB []string `json:"lb,omitempty"`
|
||||||
Loactions []string `json:"locations,omitempty"`
|
Loactions []string `json:"locations,omitempty"`
|
||||||
Machine []string `json:"machine,omitempty"`
|
|
||||||
Openshift []string `json:"openshift,omitempty"`
|
|
||||||
OpenshiftCI []string `json:"openshiftci,omitempty"`
|
|
||||||
PCIDevice []string `json:"pcidevice,omitempty"`
|
PCIDevice []string `json:"pcidevice,omitempty"`
|
||||||
PortForwarding []string `json:"portforwarding,omitempty"`
|
|
||||||
Prometheus []string `json:"prometheus,omitempty"`
|
Prometheus []string `json:"prometheus,omitempty"`
|
||||||
RG []string `json:"rg,omitempty"`
|
RG []string `json:"rg,omitempty"`
|
||||||
Sizes []string `json:"sizes,omitempty"`
|
SecurityGroup []string `json:"security_group,omitempty"`
|
||||||
|
SEP []string `json:"sep,omitempty"`
|
||||||
|
StoragePolicy []string `json:"storage_policy,omitempty"`
|
||||||
Tasks []string `json:"tasks,omitempty"`
|
Tasks []string `json:"tasks,omitempty"`
|
||||||
|
Trunk []string `json:"trunk,omitempty"`
|
||||||
User []string `json:"user,omitempty"`
|
User []string `json:"user,omitempty"`
|
||||||
|
VFPool []string `json:"vfpool,omitempty"`
|
||||||
VGPU []string `json:"vgpu,omitempty"`
|
VGPU []string `json:"vgpu,omitempty"`
|
||||||
VINS []string `json:"vins,omitempty"`
|
VINS []string `json:"vins,omitempty"`
|
||||||
|
Zone []string `json:"zone,omitempty"`
|
||||||
All bool `json:"ALL,omitempty"`
|
All bool `json:"ALL,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,72 +165,83 @@ type CloudBrokerEndpoints struct {
|
|||||||
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 []string `json:"auditcollector,omitempty"`
|
||||||
|
Backup []string `json:"backup,omitempty"`
|
||||||
BackupCreator []string `json:"backupcreator,omitempty"`
|
BackupCreator []string `json:"backupcreator,omitempty"`
|
||||||
BService []string `json:"bservice,omitempty"`
|
BService []string `json:"bservice,omitempty"`
|
||||||
CloudSpace []string `json:"cloudspace,omitempty"`
|
|
||||||
Compute []string `json:"compute,omitempty"`
|
Compute []string `json:"compute,omitempty"`
|
||||||
ComputeCI []string `json:"computeci,omitempty"`
|
|
||||||
Desnode []string `json:"desnode,omitempty"`
|
|
||||||
Diagnostics []string `json:"diagnostics,omitempty"`
|
|
||||||
Disks []string `json:"disks,omitempty"`
|
Disks []string `json:"disks,omitempty"`
|
||||||
DPDK []string `json:"dpdk,omitempty"`
|
DPDKNet []string `json:"dpdknet,omitempty"`
|
||||||
Eco []string `json:"eco,omitempty"`
|
Eco []string `json:"eco,omitempty"`
|
||||||
ExtNet []string `json:"extnet,omitempty"`
|
ExtNet []string `json:"extnet,omitempty"`
|
||||||
FlIPgroup []string `json:"flipgroup,omitempty"`
|
FlIPgroup []string `json:"flipgroup,omitempty"`
|
||||||
Grid []string `json:"grid,omitempty"`
|
Grid []string `json:"grid,omitempty"`
|
||||||
Group []string `json:"group,omitempty"`
|
Group []string `json:"group,omitempty"`
|
||||||
Health []string `json:"health,omitempty"`
|
Health []string `json:"health,omitempty"`
|
||||||
IaaS []string `json:"iaas,omitempty"`
|
|
||||||
Image []string `json:"image,omitempty"`
|
Image []string `json:"image,omitempty"`
|
||||||
Job interface{} `json:"job,omitempty"`
|
Job interface{} `json:"job,omitempty"`
|
||||||
K8CI []string `json:"k8ci,omitempty"`
|
K8CI []string `json:"k8ci,omitempty"`
|
||||||
K8S []string `json:"k8s,omitempty"`
|
K8S []string `json:"k8s,omitempty"`
|
||||||
KVMX86 []string `json:"kvmx86,omitempty"`
|
KVMX86 []string `json:"kvmx86,omitempty"`
|
||||||
LB []string `json:"lb,omitempty"`
|
LB []string `json:"lb,omitempty"`
|
||||||
Machine []string `json:"machine,omitempty"`
|
|
||||||
Metering []string `json:"metering,omitempty"`
|
Metering []string `json:"metering,omitempty"`
|
||||||
Milestones []string `json:"milestones,omitempty"`
|
Milestones []string `json:"milestones,omitempty"`
|
||||||
Openshift []string `json:"openshift,omitempty"`
|
Node []string `json:"node,omitempty"`
|
||||||
OpenshiftCI []string `json:"openshiftci,omitempty"`
|
|
||||||
Ovsnode []string `json:"ovsnode,omitempty"`
|
|
||||||
PCIDevice []string `json:"pcidevice,omitempty"`
|
PCIDevice []string `json:"pcidevice,omitempty"`
|
||||||
PGPU []string `json:"pgpu,omitempty"`
|
PGPU []string `json:"pgpu,omitempty"`
|
||||||
Prometheus []string `json:"prometheus,omitempty"`
|
Prometheus []string `json:"prometheus,omitempty"`
|
||||||
QOS []string `json:"qos,omitempty"`
|
|
||||||
Resmon interface{} `json:"resmon,omitempty"`
|
Resmon interface{} `json:"resmon,omitempty"`
|
||||||
|
ResourceOptimizer []string `json:"resource_optimizer,omitempty"`
|
||||||
RG []string `json:"rg,omitempty"`
|
RG []string `json:"rg,omitempty"`
|
||||||
|
SecurityGroup []string `json:"security_group,omitempty"`
|
||||||
Sep []string `json:"sep,omitempty"`
|
Sep []string `json:"sep,omitempty"`
|
||||||
Node []string `json:"node,omitempty"`
|
StoragePolicy []string `json:"storage_policy,omitempty"`
|
||||||
Tasks []string `json:"tasks,omitempty"`
|
Tasks []string `json:"tasks,omitempty"`
|
||||||
TLock []string `json:"tlock,omitempty"`
|
TLock []string `json:"tlock,omitempty"`
|
||||||
|
Trunk []string `json:"trunk,omitempty"`
|
||||||
User []string `json:"user,omitempty"`
|
User []string `json:"user,omitempty"`
|
||||||
|
VFPool []string `json:"vfpool,omitempty"`
|
||||||
VGPU []string `json:"vgpu,omitempty"`
|
VGPU []string `json:"vgpu,omitempty"`
|
||||||
VINS []string `json:"vins,omitempty"`
|
VINS []string `json:"vins,omitempty"`
|
||||||
VNFDev []string `json:"vnfdev,omitempty"`
|
VNFDev []string `json:"vnfdev,omitempty"`
|
||||||
ZeroAccess []string `json:"zeroaccess,omitempty"`
|
ZeroAccess []string `json:"zeroaccess,omitempty"`
|
||||||
|
Zone []string `json:"zone,omitempty"`
|
||||||
All bool `json:"ALL,omitempty"`
|
All bool `json:"ALL,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type LibCloudEndpoints struct {
|
type SDNEndpoints struct {
|
||||||
Libvirt []string `json:"libvirt,omitempty"`
|
AccessGroup []string `json:"access_group,omitempty"`
|
||||||
|
AddressPool []string `json:"address_pool,omitempty"`
|
||||||
|
DefaultSecurityPolicy []string `json:"default_security_policy,omitempty"`
|
||||||
|
ExternalNetwork []string `json:"external_network,omitempty"`
|
||||||
|
FloatingIP []string `json:"floating_ip,omitempty"`
|
||||||
|
Hypervisor []string `json:"hypervisor,omitempty"`
|
||||||
|
L2ExternalNetwork []string `json:"l2_external_network,omitempty"`
|
||||||
|
LogicalPort []string `json:"logical_port,omitempty"`
|
||||||
|
NetworkObjectGroup []string `json:"network_object_group,omitempty"`
|
||||||
|
Router []string `json:"router,omitempty"`
|
||||||
|
RouterGatewayPort []string `json:"router/gateway_port,omitempty"`
|
||||||
|
RouterPolicies []string `json:"router/policies,omitempty"`
|
||||||
|
RouterRouterPort []string `json:"router/router_port,omitempty"`
|
||||||
|
RouterStaticRoute []string `json:"router/static_route,omitempty"`
|
||||||
|
SecurityPolicy []string `json:"security_policy,omitempty"`
|
||||||
|
SecurityPolicyRule []string `json:"security_policy/rule,omitempty"`
|
||||||
|
SecurityRule []string `json:"security_rule,omitempty"`
|
||||||
|
Segment []string `json:"segment,omitempty"`
|
||||||
|
Version []string `json:"version,omitempty"`
|
||||||
All bool `json:"ALL,omitempty"`
|
All bool `json:"ALL,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SystemEndpoints struct {
|
type SystemEndpoints struct {
|
||||||
AgentController []string `json:"agentcontroller,omitempty"`
|
|
||||||
Alerts []string `json:"alerts,omitempty"`
|
|
||||||
Audits []string `json:"audits,omitempty"`
|
Audits []string `json:"audits,omitempty"`
|
||||||
|
Cache []string `json:"cache,omitempty"`
|
||||||
ContentManager []string `json:"contentmanager,omitempty"`
|
ContentManager []string `json:"contentmanager,omitempty"`
|
||||||
DocGenerator []string `json:"docgenerator,omitempty"`
|
DocGenerator []string `json:"docgenerator,omitempty"`
|
||||||
EmailSender []string `json:"emailsender,omitempty"`
|
EmailSender []string `json:"emailsender,omitempty"`
|
||||||
ErrorConditionHandler []string `json:"errorconditionhandler,omitempty"`
|
|
||||||
GridManager []string `json:"gridmanager,omitempty"`
|
GridManager []string `json:"gridmanager,omitempty"`
|
||||||
Health []string `json:"health,omitempty"`
|
Health []string `json:"health,omitempty"`
|
||||||
Info []string `json:"info,omitempty"`
|
Info []string `json:"info,omitempty"`
|
||||||
|
InfoWellknown []string `json:"info/wellknown,omitempty"`
|
||||||
InfoMGR []string `json:"infomgr,omitempty"`
|
InfoMGR []string `json:"infomgr,omitempty"`
|
||||||
Job []string `json:"job,omitempty"`
|
|
||||||
Log []string `json:"log,omitempty"`
|
|
||||||
Logo []string `json:"logo,omitempty"`
|
|
||||||
Oauth []string `json:"oauth,omitempty"`
|
Oauth []string `json:"oauth,omitempty"`
|
||||||
Task []string `json:"task,omitempty"`
|
Task []string `json:"task,omitempty"`
|
||||||
UserManager []string `json:"usermanager,omitempty"`
|
UserManager []string `json:"usermanager,omitempty"`
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
)
|
)
|
||||||
@@ -27,10 +26,10 @@ type wrapperUpdateRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update updates apis of apiaccess group.
|
// Update updates apis of apiaccess group.
|
||||||
func (a APIAccess) Update(ctx context.Context, req UpdateRequest) (bool, error) {
|
func (a APIAccess) Update(ctx context.Context, req UpdateRequest) (*ItemAPIAccess, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
url := "/cloudbroker/apiaccess/update"
|
url := "/cloudbroker/apiaccess/update"
|
||||||
@@ -41,20 +40,22 @@ func (a APIAccess) Update(ctx context.Context, req UpdateRequest) (bool, error)
|
|||||||
|
|
||||||
apiJSON, err := json.Marshal(&req.APIs)
|
apiJSON, err := json.Marshal(&req.APIs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
reqWrapped.APIString = string(apiJSON)
|
reqWrapped.APIString = string(apiJSON)
|
||||||
|
|
||||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := strconv.ParseBool(string(res))
|
info := ItemAPIAccess{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, nil
|
return &info, nil
|
||||||
}
|
}
|
||||||
@@ -75,6 +75,14 @@ type ListRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
ZoneID uint64 `url:"zone_id,omitempty" json:"zone_id,omitempty"`
|
ZoneID uint64 `url:"zone_id,omitempty" json:"zone_id,omitempty"`
|
||||||
|
|
||||||
|
// Find by VM folder ID
|
||||||
|
// Required: false
|
||||||
|
FolderID uint64 `url:"folder_id,omitempty" json:"folder_id,omitempty"`
|
||||||
|
|
||||||
|
// Include computes from descendant folders.
|
||||||
|
// Required: false
|
||||||
|
IncludeDescendants interface{} `url:"include_descendants,omitempty" json:"include_descendants,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
// Page number
|
// Page number
|
||||||
// Required: false
|
// Required: false
|
||||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package compute
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
)
|
)
|
||||||
@@ -16,20 +16,35 @@ type MigrateStorageInfoRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MigrateStorageInfo gets info about last (include ongoing) storage migration
|
// MigrateStorageInfo gets info about last (include ongoing) storage migration
|
||||||
func (c Compute) MigrateStorageInfo(ctx context.Context, req MigrateStorageInfoRequest) (string, error) {
|
func (c Compute) MigrateStorageInfo(ctx context.Context, req MigrateStorageInfoRequest) (*RecordMigrateStorageInfo, error) {
|
||||||
|
res, err := c.MigrateStorageInfoRaw(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := RecordMigrateStorageInfo{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &info, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MigrateStorageInfoRaw gets info about last (include ongoing) storage migration as an array of bytes
|
||||||
|
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 {
|
||||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
url := "/cloudbroker/compute/migrateStorageInfo"
|
url := "/cloudbroker/compute/migrateStorageInfo"
|
||||||
|
|
||||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
result := strings.ReplaceAll(string(res), "\"", "")
|
return res, nil
|
||||||
|
|
||||||
return result, nil
|
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ type ListACL []ItemACL
|
|||||||
// Main information about snapshot
|
// Main information about snapshot
|
||||||
type ItemSnapshot struct {
|
type ItemSnapshot struct {
|
||||||
// Compute info
|
// Compute info
|
||||||
Compute RecordCompute `json:"compute"`
|
Compute SnapRecordCompute `json:"compute"`
|
||||||
|
|
||||||
// List of disk IDs
|
// List of disk IDs
|
||||||
Disks []uint64 `json:"disks"`
|
Disks []uint64 `json:"disks"`
|
||||||
@@ -148,6 +148,9 @@ type RecordNetAttach struct {
|
|||||||
// Enabled
|
// Enabled
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
|
|
||||||
|
// Enable default gateway
|
||||||
|
EnableDefaultGateway bool `json:"enable_default_gateway"`
|
||||||
|
|
||||||
// Enable security groups
|
// Enable security groups
|
||||||
EnableSecGroups bool `json:"enable_secgroups"`
|
EnableSecGroups bool `json:"enable_secgroups"`
|
||||||
|
|
||||||
@@ -367,6 +370,9 @@ type ItemSnapshotDetailed struct {
|
|||||||
// Label
|
// Label
|
||||||
Label string `json:"label"`
|
Label string `json:"label"`
|
||||||
|
|
||||||
|
// Pool name
|
||||||
|
PoolName string `json:"poolName"`
|
||||||
|
|
||||||
// Resource ID
|
// Resource ID
|
||||||
ResID string `json:"resId"`
|
ResID string `json:"resId"`
|
||||||
|
|
||||||
@@ -597,6 +603,9 @@ type ItemInterface struct {
|
|||||||
// Enabled
|
// Enabled
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
|
|
||||||
|
// Enable default gateway
|
||||||
|
EnableDefaultGateway bool `json:"enable_default_gateway"`
|
||||||
|
|
||||||
// Enable security groups
|
// Enable security groups
|
||||||
EnableSecGroups bool `json:"enable_secgroups"`
|
EnableSecGroups bool `json:"enable_secgroups"`
|
||||||
|
|
||||||
@@ -855,6 +864,9 @@ type InfoCompute struct {
|
|||||||
// Registered
|
// Registered
|
||||||
Registered bool `json:"registered"`
|
Registered bool `json:"registered"`
|
||||||
|
|
||||||
|
// Whether a compute has been resized online
|
||||||
|
ResizedOnline bool `json:"resizedOnline"`
|
||||||
|
|
||||||
// Resource name
|
// Resource name
|
||||||
ResName string `json:"resName"`
|
ResName string `json:"resName"`
|
||||||
|
|
||||||
@@ -917,6 +929,9 @@ type InfoCompute struct {
|
|||||||
|
|
||||||
// Zone ID
|
// Zone ID
|
||||||
ZoneID uint64 `json:"zoneId"`
|
ZoneID uint64 `json:"zoneId"`
|
||||||
|
|
||||||
|
// Folder ID
|
||||||
|
FolderID uint64 `json:"folder_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type QemuQuest struct {
|
type QemuQuest struct {
|
||||||
@@ -1157,6 +1172,9 @@ type RecordCompute struct {
|
|||||||
// Registered
|
// Registered
|
||||||
Registered bool `json:"registered"`
|
Registered bool `json:"registered"`
|
||||||
|
|
||||||
|
// Whether a compute has been resized online
|
||||||
|
ResizedOnline bool `json:"resizedOnline"`
|
||||||
|
|
||||||
// Resource name
|
// Resource name
|
||||||
ResName string `json:"resName"`
|
ResName string `json:"resName"`
|
||||||
|
|
||||||
@@ -1222,6 +1240,273 @@ type RecordCompute struct {
|
|||||||
|
|
||||||
//todo
|
//todo
|
||||||
_ uint64 `json:"nodeId"`
|
_ uint64 `json:"nodeId"`
|
||||||
|
|
||||||
|
// Folder ID
|
||||||
|
FolderID uint64 `json:"folder_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SnapRecordCompute is RecordCompute but without the SnapSets field
|
||||||
|
type SnapRecordCompute struct {
|
||||||
|
// Account ID
|
||||||
|
AccountID uint64 `json:"accountId"`
|
||||||
|
|
||||||
|
// Account name
|
||||||
|
AccountName string `json:"accountName"`
|
||||||
|
|
||||||
|
// Access Control List
|
||||||
|
ACL []interface{} `json:"acl"`
|
||||||
|
|
||||||
|
// Affinity label
|
||||||
|
AffinityLabel string `json:"affinityLabel"`
|
||||||
|
|
||||||
|
// Affinity rules
|
||||||
|
AffinityRules ListRules `json:"affinityRules"`
|
||||||
|
|
||||||
|
// Affinity weight
|
||||||
|
AffinityWeight uint64 `json:"affinityWeight"`
|
||||||
|
|
||||||
|
// Anti affinity rules
|
||||||
|
AntiAffinityRules ListRules `json:"antiAffinityRules"`
|
||||||
|
|
||||||
|
// Auto start when node restarted
|
||||||
|
AutoStart bool `json:"autoStart"`
|
||||||
|
|
||||||
|
// Architecture
|
||||||
|
Arch string `json:"arch"`
|
||||||
|
|
||||||
|
// Boot image ID
|
||||||
|
BootImageID uint64 `json:"boot_image_id"`
|
||||||
|
|
||||||
|
// Boot order
|
||||||
|
BootOrder []string `json:"bootOrder"`
|
||||||
|
|
||||||
|
// Boot type
|
||||||
|
BootType string `json:"bootType"`
|
||||||
|
|
||||||
|
// Boot disk size
|
||||||
|
BootDiskSize uint64 `json:"bootdiskSize"`
|
||||||
|
|
||||||
|
// CD Image Id
|
||||||
|
CdImageId uint64 `json:"cdImageId"`
|
||||||
|
|
||||||
|
// Chipset
|
||||||
|
Chipset string `json:"chipset"`
|
||||||
|
|
||||||
|
// Clone reference
|
||||||
|
CloneReference uint64 `json:"cloneReference"`
|
||||||
|
|
||||||
|
// Clock
|
||||||
|
Clock string `json:"clock"`
|
||||||
|
|
||||||
|
// List clone IDs
|
||||||
|
Clones []uint64 `json:"clones"`
|
||||||
|
|
||||||
|
// Compute CI ID
|
||||||
|
ComputeCIID uint64 `json:"computeciId"`
|
||||||
|
|
||||||
|
// CPU Pin
|
||||||
|
CPUPin bool `json:"cpupin"`
|
||||||
|
|
||||||
|
// Number of CPU
|
||||||
|
CPUs uint64 `json:"cpus"`
|
||||||
|
|
||||||
|
// Created by
|
||||||
|
CreatedBy string `json:"createdBy"`
|
||||||
|
|
||||||
|
// Created time
|
||||||
|
CreatedTime uint64 `json:"createdTime"`
|
||||||
|
|
||||||
|
// Custom fields
|
||||||
|
CustomFields map[string]interface{} `json:"customFields"`
|
||||||
|
|
||||||
|
// Deleted by
|
||||||
|
DeletedBy string `json:"deletedBy"`
|
||||||
|
|
||||||
|
// Deleted time
|
||||||
|
DeletedTime uint64 `json:"deletedTime"`
|
||||||
|
|
||||||
|
// Description
|
||||||
|
Description string `json:"desc"`
|
||||||
|
|
||||||
|
// Devices
|
||||||
|
Devices interface{} `json:"devices"`
|
||||||
|
|
||||||
|
// List disks
|
||||||
|
Disks ListDisks `json:"disks"`
|
||||||
|
|
||||||
|
// Driver
|
||||||
|
Driver string `json:"driver"`
|
||||||
|
|
||||||
|
// Grid ID
|
||||||
|
GID uint64 `json:"gid"`
|
||||||
|
|
||||||
|
// GUID
|
||||||
|
GUID uint64 `json:"guid"`
|
||||||
|
|
||||||
|
// HPBacked
|
||||||
|
HPBacked bool `json:"hpBacked"`
|
||||||
|
|
||||||
|
// Hot resize
|
||||||
|
HotResize bool `json:"hotResize"`
|
||||||
|
|
||||||
|
// ID
|
||||||
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
|
// Image ID
|
||||||
|
ImageID uint64 `json:"imageId"`
|
||||||
|
|
||||||
|
// Image name
|
||||||
|
ImageName string `json:"imageName"`
|
||||||
|
|
||||||
|
// List interfaces
|
||||||
|
Interfaces ListInterfaces `json:"interfaces"`
|
||||||
|
|
||||||
|
// Loader meta iso information
|
||||||
|
LoaderMetaIso LoaderMetaIso `json:"loaderMetaIso"`
|
||||||
|
|
||||||
|
// Live migration job ID
|
||||||
|
LiveMigrationJobID uint64 `json:"live_migration_job_id"`
|
||||||
|
|
||||||
|
// Loader type
|
||||||
|
LoaderType string `json:"loaderType"`
|
||||||
|
|
||||||
|
// Lock status
|
||||||
|
LockStatus string `json:"lockStatus"`
|
||||||
|
|
||||||
|
// Manager ID
|
||||||
|
ManagerID uint64 `json:"managerId"`
|
||||||
|
|
||||||
|
// Manager type
|
||||||
|
ManagerType string `json:"managerType"`
|
||||||
|
|
||||||
|
// Migration job
|
||||||
|
MigrationJob uint64 `json:"migrationjob"`
|
||||||
|
|
||||||
|
// Milestones
|
||||||
|
Milestones uint64 `json:"milestones"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// Natable VINS ID
|
||||||
|
NatableVINSID uint64 `json:"natableVinsId"`
|
||||||
|
|
||||||
|
// Natable VINS IP
|
||||||
|
NatableVINSIP string `json:"natableVinsIp"`
|
||||||
|
|
||||||
|
// Natable VINS Name
|
||||||
|
NatableVINSName string `json:"natableVinsName"`
|
||||||
|
|
||||||
|
// Natable VINS network
|
||||||
|
NatableVINSNetwork string `json:"natableVinsNetwork"`
|
||||||
|
|
||||||
|
// Natable VINS network name
|
||||||
|
NatableVINSNetworkName string `json:"natableVinsNetworkName"`
|
||||||
|
|
||||||
|
// Need reboot
|
||||||
|
NeedReboot bool `json:"needReboot"`
|
||||||
|
|
||||||
|
// network interface naming
|
||||||
|
NetworkInterfaceNaming string `json:"networkInterfaceNaming"`
|
||||||
|
|
||||||
|
// NumaAffinity
|
||||||
|
NumaAffinity string `json:"numaAffinity"`
|
||||||
|
|
||||||
|
//NumaNodeId
|
||||||
|
NumaNodeId int64 `json:"numaNodeId"`
|
||||||
|
|
||||||
|
// List OS users
|
||||||
|
OSUsers ListOSUsers `json:"osUsers"`
|
||||||
|
|
||||||
|
// Name of OS
|
||||||
|
OSVersion string `json:"os_version"`
|
||||||
|
|
||||||
|
// Pinned to node
|
||||||
|
PinnedToNode int64 `json:"pinnedToNode"`
|
||||||
|
|
||||||
|
// PreferredCPU
|
||||||
|
PreferredCPU []int64 `json:"preferredCpu"`
|
||||||
|
|
||||||
|
// CPU alignment profile
|
||||||
|
CPUAlignmentProfile CPUAlignmentProfile `json:"cpu_alignment_profile"`
|
||||||
|
|
||||||
|
// Qemu_quest
|
||||||
|
QemuQuest QemuQuest `json:"qemu_guest"`
|
||||||
|
|
||||||
|
// ReadOnly indicates read-only mode state
|
||||||
|
ReadOnly bool `json:"read_only"`
|
||||||
|
|
||||||
|
// Number of RAM
|
||||||
|
RAM uint64 `json:"ram"`
|
||||||
|
|
||||||
|
// Reference ID
|
||||||
|
ReferenceID string `json:"referenceId"`
|
||||||
|
|
||||||
|
// Registered
|
||||||
|
Registered bool `json:"registered"`
|
||||||
|
|
||||||
|
// Whether a compute has been resized online
|
||||||
|
ResizedOnline bool `json:"resizedOnline"`
|
||||||
|
|
||||||
|
// Resource name
|
||||||
|
ResName string `json:"resName"`
|
||||||
|
|
||||||
|
// Reserved Node Cpus
|
||||||
|
ReservedNodeCpus []uint64 `json:"reservedNodeCpus"`
|
||||||
|
|
||||||
|
// Resource group ID
|
||||||
|
RGID uint64 `json:"rgId"`
|
||||||
|
|
||||||
|
// Resource group name
|
||||||
|
RGName string `json:"rgName"`
|
||||||
|
|
||||||
|
// Node ID
|
||||||
|
NodeID uint64 `json:"node_id"`
|
||||||
|
|
||||||
|
// Node name
|
||||||
|
NodeName string `json:"nodeName"`
|
||||||
|
|
||||||
|
// Stateless SEP ID
|
||||||
|
StatelessSEPID int64 `json:"statelessSepId"`
|
||||||
|
|
||||||
|
// Stateless SEP Type
|
||||||
|
StatelessSEPType string `json:"statelessSepType"`
|
||||||
|
|
||||||
|
// Status
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Tags
|
||||||
|
Tags map[string]interface{} `json:"tags"`
|
||||||
|
|
||||||
|
// Tech status
|
||||||
|
TechStatus string `json:"techStatus"`
|
||||||
|
|
||||||
|
// Total disk size
|
||||||
|
TotalDiskSize uint64 `json:"totalDisksSize"`
|
||||||
|
|
||||||
|
// Updated by
|
||||||
|
UpdatedBy string `json:"updatedBy"`
|
||||||
|
|
||||||
|
// Updated time
|
||||||
|
UpdatedTime uint64 `json:"updatedTime"`
|
||||||
|
|
||||||
|
// User managed
|
||||||
|
UserManaged bool `json:"userManaged"`
|
||||||
|
|
||||||
|
// Userdata
|
||||||
|
Userdata interface{} `json:"userdata"`
|
||||||
|
|
||||||
|
// List VGPU
|
||||||
|
VGPUs []VGPUItem `json:"vgpus"`
|
||||||
|
|
||||||
|
// VNC password
|
||||||
|
VNCPassword string `json:"vncPasswd"`
|
||||||
|
|
||||||
|
// Weight
|
||||||
|
Weight uint64 `json:"weight"`
|
||||||
|
|
||||||
|
// Zone ID
|
||||||
|
ZoneID uint64 `json:"zoneId"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type LoaderMetaIso struct {
|
type LoaderMetaIso struct {
|
||||||
@@ -1511,6 +1796,420 @@ type MigrateStorageItem struct {
|
|||||||
TargetNodeID uint64 `json:"targetNodeId"`
|
TargetNodeID uint64 `json:"targetNodeId"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Info about last (including ongoing) storage migration
|
||||||
|
type RecordMigrateStorageInfo struct {
|
||||||
|
// Migration completion status
|
||||||
|
Completed bool `json:"completed"`
|
||||||
|
|
||||||
|
// CPU set
|
||||||
|
CPUSet string `json:"cpu_set"`
|
||||||
|
|
||||||
|
// Daemon address
|
||||||
|
DaemonAddr string `json:"daemonAddr"`
|
||||||
|
|
||||||
|
// Domain name
|
||||||
|
DomainName string `json:"domainName"`
|
||||||
|
|
||||||
|
// Domain UUID
|
||||||
|
DomainUUID string `json:"domainUUID"`
|
||||||
|
|
||||||
|
// Elapsed time
|
||||||
|
ElapsedTime uint64 `json:"elapsedTime"`
|
||||||
|
|
||||||
|
// GID
|
||||||
|
GID uint64 `json:"gid"`
|
||||||
|
|
||||||
|
// GUID
|
||||||
|
GUID uint64 `json:"guid"`
|
||||||
|
|
||||||
|
// ID
|
||||||
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
|
// List interfaces
|
||||||
|
Interfaces []ItemShadowComputeInterface `json:"interfaces"`
|
||||||
|
|
||||||
|
// Log
|
||||||
|
Log []string `json:"log"`
|
||||||
|
|
||||||
|
// New disk XMLs
|
||||||
|
NewDiskXmls []string `json:"newDiskXmls"`
|
||||||
|
|
||||||
|
// New disks
|
||||||
|
NewDisks []uint64 `json:"newDisks"`
|
||||||
|
|
||||||
|
// Old disks
|
||||||
|
OldDisks []uint64 `json:"oldDisks"`
|
||||||
|
|
||||||
|
// PID
|
||||||
|
PID uint64 `json:"pid"`
|
||||||
|
|
||||||
|
// Source node ID
|
||||||
|
SourceNodeID uint64 `json:"sourceNodeId"`
|
||||||
|
|
||||||
|
// Source numa node ID
|
||||||
|
SourceNumaNodeID int64 `json:"sourceNumaNodeId"`
|
||||||
|
|
||||||
|
// Source reserved node CPUs
|
||||||
|
SourceReservedNodeCpus []uint64 `json:"sourceReservedNodeCpus"`
|
||||||
|
|
||||||
|
// Source URL
|
||||||
|
SourceURL string `json:"sourceURL"`
|
||||||
|
|
||||||
|
// Status
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Target shadow compute
|
||||||
|
TargetShadowCompute ShadowCompute `json:"target_shadow_compute"`
|
||||||
|
|
||||||
|
// Target node ID
|
||||||
|
TargetNodeID uint64 `json:"targetNodeId"`
|
||||||
|
|
||||||
|
// Target URL
|
||||||
|
TargetURL string `json:"targetURL"`
|
||||||
|
|
||||||
|
// VM log directory
|
||||||
|
VMLogDir string `json:"vmlogDir"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shadow compute created for the duration of a storage migration
|
||||||
|
type ShadowCompute struct {
|
||||||
|
// Account ID
|
||||||
|
AccountID uint64 `json:"accountId"`
|
||||||
|
|
||||||
|
// Access Control List
|
||||||
|
ACL []interface{} `json:"acl"`
|
||||||
|
|
||||||
|
// Affinity label
|
||||||
|
AffinityLabel string `json:"affinityLabel"`
|
||||||
|
|
||||||
|
// Affinity rules
|
||||||
|
AffinityRules ListShadowComputeRules `json:"affinityRules"`
|
||||||
|
|
||||||
|
// Affinity weight
|
||||||
|
AffinityWeight uint64 `json:"affinityWeight"`
|
||||||
|
|
||||||
|
// Anti affinity rules
|
||||||
|
AntiAffinityRules ListShadowComputeRules `json:"antiAffinityRules"`
|
||||||
|
|
||||||
|
// Architecture
|
||||||
|
Arch string `json:"arch"`
|
||||||
|
|
||||||
|
// Auto start when node restarted
|
||||||
|
AutoStart bool `json:"autoStart"`
|
||||||
|
|
||||||
|
// Boot image ID
|
||||||
|
BootImageID uint64 `json:"boot_image_id"`
|
||||||
|
|
||||||
|
// Boot order
|
||||||
|
BootOrder []string `json:"bootOrder"`
|
||||||
|
|
||||||
|
// Boot type
|
||||||
|
BootType string `json:"bootType"`
|
||||||
|
|
||||||
|
// Boot disk size
|
||||||
|
BootDiskSize uint64 `json:"bootdiskSize"`
|
||||||
|
|
||||||
|
// CD Image ID
|
||||||
|
CDImageID uint64 `json:"cdImageId"`
|
||||||
|
|
||||||
|
// Chipset
|
||||||
|
Chipset string `json:"chipset"`
|
||||||
|
|
||||||
|
// Clock
|
||||||
|
Clock string `json:"clock"`
|
||||||
|
|
||||||
|
// Clone reference
|
||||||
|
CloneReference uint64 `json:"cloneReference"`
|
||||||
|
|
||||||
|
// List clone IDs
|
||||||
|
Clones []uint64 `json:"clones"`
|
||||||
|
|
||||||
|
// Compute CI ID
|
||||||
|
ComputeCIID uint64 `json:"computeciId"`
|
||||||
|
|
||||||
|
// CPU alignment profile
|
||||||
|
CPUAlignmentProfile CPUAlignmentProfile `json:"cpu_alignment_profile"`
|
||||||
|
|
||||||
|
// CPU pin
|
||||||
|
CPUPin bool `json:"cpupin"`
|
||||||
|
|
||||||
|
// Number of CPU
|
||||||
|
CPUs uint64 `json:"cpus"`
|
||||||
|
|
||||||
|
// Custom fields
|
||||||
|
CustomFields map[string]interface{} `json:"customFields"`
|
||||||
|
|
||||||
|
// Description
|
||||||
|
Description string `json:"desc"`
|
||||||
|
|
||||||
|
// Devices
|
||||||
|
Devices interface{} `json:"devices"`
|
||||||
|
|
||||||
|
// List disks
|
||||||
|
Disks []ItemShadowComputeDisk `json:"disks"`
|
||||||
|
|
||||||
|
// Driver
|
||||||
|
Driver string `json:"driver"`
|
||||||
|
|
||||||
|
// GID
|
||||||
|
GID uint64 `json:"gid"`
|
||||||
|
|
||||||
|
// GUID
|
||||||
|
GUID uint64 `json:"guid"`
|
||||||
|
|
||||||
|
// HPBacked
|
||||||
|
HPBacked bool `json:"hpBacked"`
|
||||||
|
|
||||||
|
// Hot resize
|
||||||
|
HotResize bool `json:"hotResize"`
|
||||||
|
|
||||||
|
// ID
|
||||||
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
|
// List interfaces
|
||||||
|
Interfaces []ItemShadowComputeInterface `json:"interfaces"`
|
||||||
|
|
||||||
|
// Live migration job ID
|
||||||
|
LiveMigrationJobID uint64 `json:"live_migration_job_id"`
|
||||||
|
|
||||||
|
// Loader type
|
||||||
|
LoaderType string `json:"loaderType"`
|
||||||
|
|
||||||
|
// Lock status
|
||||||
|
LockStatus string `json:"lockStatus"`
|
||||||
|
|
||||||
|
// Manager ID
|
||||||
|
ManagerID uint64 `json:"managerId"`
|
||||||
|
|
||||||
|
// Manager type
|
||||||
|
ManagerType string `json:"managerType"`
|
||||||
|
|
||||||
|
// Migration job
|
||||||
|
MigrationJob uint64 `json:"migrationjob"`
|
||||||
|
|
||||||
|
// Milestones
|
||||||
|
Milestones uint64 `json:"milestones"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// Need reboot
|
||||||
|
NeedReboot bool `json:"needReboot"`
|
||||||
|
|
||||||
|
// Network interface naming
|
||||||
|
NetworkInterfaceNaming string `json:"networkInterfaceNaming"`
|
||||||
|
|
||||||
|
// Node ID
|
||||||
|
NodeID uint64 `json:"node_id"`
|
||||||
|
|
||||||
|
// NumaAffinity
|
||||||
|
NumaAffinity string `json:"numaAffinity"`
|
||||||
|
|
||||||
|
// NumaNodeId
|
||||||
|
NumaNodeID int64 `json:"numaNodeId"`
|
||||||
|
|
||||||
|
// List OS users
|
||||||
|
OSUsers ListOSUsers `json:"osUsers"`
|
||||||
|
|
||||||
|
// Name of OS
|
||||||
|
OSVersion string `json:"os_version"`
|
||||||
|
|
||||||
|
// Pinned to node
|
||||||
|
PinnedToNode int64 `json:"pinnedToNode"`
|
||||||
|
|
||||||
|
// Preferred CPU
|
||||||
|
PreferredCPU []int64 `json:"preferredCpu"`
|
||||||
|
|
||||||
|
// Qemu guest
|
||||||
|
QemuGuest QemuQuest `json:"qemu_guest"`
|
||||||
|
|
||||||
|
// ReadOnly indicates read-only mode state
|
||||||
|
ReadOnly bool `json:"read_only"`
|
||||||
|
|
||||||
|
// Number of RAM
|
||||||
|
RAM uint64 `json:"ram"`
|
||||||
|
|
||||||
|
// Reference ID
|
||||||
|
ReferenceID string `json:"referenceId"`
|
||||||
|
|
||||||
|
// Reserved node CPUs
|
||||||
|
ReservedNodeCpus []uint64 `json:"reservedNodeCpus"`
|
||||||
|
|
||||||
|
// Resized online
|
||||||
|
ResizedOnline bool `json:"resizedOnline"`
|
||||||
|
|
||||||
|
// Resource name
|
||||||
|
ResName string `json:"resName"`
|
||||||
|
|
||||||
|
// Resource group ID
|
||||||
|
RGID uint64 `json:"rgId"`
|
||||||
|
|
||||||
|
// SnapSets
|
||||||
|
SnapSets ListShadowComputeSnapshots `json:"snapSets"`
|
||||||
|
|
||||||
|
// Stateless SEP ID
|
||||||
|
StatelessSEPID int64 `json:"statelessSepId"`
|
||||||
|
|
||||||
|
// Stateless SEP type
|
||||||
|
StatelessSEPType string `json:"statelessSepType"`
|
||||||
|
|
||||||
|
// Status
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Tags
|
||||||
|
Tags map[string]interface{} `json:"tags"`
|
||||||
|
|
||||||
|
// Tech status
|
||||||
|
TechStatus string `json:"techStatus"`
|
||||||
|
|
||||||
|
// User managed
|
||||||
|
UserManaged bool `json:"userManaged"`
|
||||||
|
|
||||||
|
// Userdata
|
||||||
|
Userdata interface{} `json:"userdata"`
|
||||||
|
|
||||||
|
// List VGPU IDs
|
||||||
|
VGPUs []uint64 `json:"vgpus"`
|
||||||
|
|
||||||
|
// VNC password
|
||||||
|
VNCPassword string `json:"vncPasswd"`
|
||||||
|
|
||||||
|
// Weight
|
||||||
|
Weight uint64 `json:"weight"`
|
||||||
|
|
||||||
|
// Zone ID
|
||||||
|
ZoneID uint64 `json:"zoneId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disk of a shadow compute
|
||||||
|
type ItemShadowComputeDisk struct {
|
||||||
|
// ID
|
||||||
|
ID uint64 `json:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Affinity/anti-affinity rule of a shadow compute
|
||||||
|
type ItemShadowComputeRule struct {
|
||||||
|
// Key
|
||||||
|
Key string `json:"key"`
|
||||||
|
|
||||||
|
// Mode
|
||||||
|
Mode string `json:"mode"`
|
||||||
|
|
||||||
|
// Policy
|
||||||
|
Policy string `json:"policy"`
|
||||||
|
|
||||||
|
// Topology
|
||||||
|
Topology string `json:"topology"`
|
||||||
|
|
||||||
|
// Value
|
||||||
|
Value string `json:"value"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of shadow compute affinity/anti-affinity rules
|
||||||
|
type ListShadowComputeRules []ItemShadowComputeRule
|
||||||
|
|
||||||
|
// Snapshot of a shadow compute
|
||||||
|
type ItemShadowComputeSnapshot struct {
|
||||||
|
// List of disk IDs
|
||||||
|
Disks []uint64 `json:"disks"`
|
||||||
|
|
||||||
|
// GUID
|
||||||
|
GUID string `json:"guid"`
|
||||||
|
|
||||||
|
// Label
|
||||||
|
Label string `json:"label"`
|
||||||
|
|
||||||
|
// Timestamp
|
||||||
|
Timestamp uint64 `json:"timestamp"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of shadow compute snapshots
|
||||||
|
type ListShadowComputeSnapshots []ItemShadowComputeSnapshot
|
||||||
|
|
||||||
|
// Network interface of a shadow compute
|
||||||
|
type ItemShadowComputeInterface struct {
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// Target
|
||||||
|
Target string `json:"target"`
|
||||||
|
|
||||||
|
// PCI slot
|
||||||
|
PCISlot int64 `json:"pciSlot"`
|
||||||
|
|
||||||
|
// Bus number
|
||||||
|
BusNumber int64 `json:"bus_number"`
|
||||||
|
|
||||||
|
// MAC
|
||||||
|
MAC string `json:"mac"`
|
||||||
|
|
||||||
|
// Maximum transmission unit
|
||||||
|
MTU int64 `json:"mtu"`
|
||||||
|
|
||||||
|
// Type
|
||||||
|
Type string `json:"type"`
|
||||||
|
|
||||||
|
// Connection type
|
||||||
|
ConnType string `json:"connType"`
|
||||||
|
|
||||||
|
// Connection ID
|
||||||
|
ConnID uint64 `json:"connId"`
|
||||||
|
|
||||||
|
// FLIPGroup ID
|
||||||
|
FLIPGroupID uint64 `json:"flipgroupId"`
|
||||||
|
|
||||||
|
// Network type
|
||||||
|
NetType string `json:"netType"`
|
||||||
|
|
||||||
|
// Network ID
|
||||||
|
NetID uint64 `json:"netId"`
|
||||||
|
|
||||||
|
// IP address
|
||||||
|
IPAddress string `json:"ipAddress"`
|
||||||
|
|
||||||
|
// Network mask
|
||||||
|
NetMask int64 `json:"netMask"`
|
||||||
|
|
||||||
|
// Default GW
|
||||||
|
DefGW string `json:"defGw"`
|
||||||
|
|
||||||
|
// List of VNF IDs
|
||||||
|
VNFs []uint64 `json:"vnfs"`
|
||||||
|
|
||||||
|
// QOS
|
||||||
|
QOS QOS `json:"qos"`
|
||||||
|
|
||||||
|
// Libvirt settings
|
||||||
|
LibvirtSettings LibvirtSettings `json:"libvirtSettings"`
|
||||||
|
|
||||||
|
// GUID
|
||||||
|
GUID string `json:"guid"`
|
||||||
|
|
||||||
|
// Listen SSH or not
|
||||||
|
ListenSSH bool `json:"listenSsh"`
|
||||||
|
|
||||||
|
// Enabled
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
|
||||||
|
// Enable default gateway
|
||||||
|
EnableDefaultGateway bool `json:"enable_default_gateway"`
|
||||||
|
|
||||||
|
// Node ID
|
||||||
|
NodeID uint64 `json:"nodeId"`
|
||||||
|
|
||||||
|
// SDN interface ID
|
||||||
|
SDNInterfaceID string `json:"sdn_interface_id"`
|
||||||
|
|
||||||
|
// List of security groups
|
||||||
|
SecGroups []uint64 `json:"security_groups"`
|
||||||
|
|
||||||
|
// Enable security groups
|
||||||
|
EnableSecGroups bool `json:"enable_secgroups"`
|
||||||
|
|
||||||
|
// Trunk tags
|
||||||
|
TrunkTags []int64 `json:"trunk_tags"`
|
||||||
|
}
|
||||||
|
|
||||||
type RecordCloneAbort struct {
|
type RecordCloneAbort struct {
|
||||||
// Disk ID
|
// Disk ID
|
||||||
DiskID uint64 `json:"disk_id"`
|
DiskID uint64 `json:"disk_id"`
|
||||||
|
|||||||
@@ -81,6 +81,11 @@ type NetAttachRequest struct {
|
|||||||
// Flag indicating whether this interface is enabled (only for VINS, EXTNET, DPDK, SDN, TRUNK)
|
// Flag indicating whether this interface is enabled (only for VINS, EXTNET, DPDK, SDN, TRUNK)
|
||||||
// Required: false
|
// Required: false
|
||||||
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
|
// Flag indicating whether default gateway is enabled for this interface
|
||||||
|
// Required: false
|
||||||
|
// Default: true
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type wrapperNetAttachRequest struct {
|
type wrapperNetAttachRequest struct {
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ package disks
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DepresentRequest struct to depresent disk from node
|
// DepresentRequest struct to depresent disk from node
|
||||||
|
|||||||
@@ -309,6 +309,9 @@ type ItemSnapshot struct {
|
|||||||
// Label
|
// Label
|
||||||
Label string `json:"label"`
|
Label string `json:"label"`
|
||||||
|
|
||||||
|
// Pool name
|
||||||
|
PoolName string `json:"poolName"`
|
||||||
|
|
||||||
// Reference ID
|
// Reference ID
|
||||||
ReferenceID string `json:"referenceId"`
|
ReferenceID string `json:"referenceId"`
|
||||||
|
|
||||||
@@ -343,4 +346,7 @@ type MigrateStatus struct {
|
|||||||
|
|
||||||
// Progress percent
|
// Progress percent
|
||||||
ProgressPercent int `json:"progress_percent"`
|
ProgressPercent int `json:"progress_percent"`
|
||||||
|
|
||||||
|
// Operation status
|
||||||
|
Ready bool `json:"ready"`
|
||||||
}
|
}
|
||||||
@@ -3,9 +3,8 @@ package disks
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PresentRequest struct to present disk to node
|
// PresentRequest struct to present disk to node
|
||||||
|
|||||||
@@ -100,6 +100,12 @@ type RecordGrid struct {
|
|||||||
// Network modes
|
// Network modes
|
||||||
NetworkModes []string `json:"network_modes"`
|
NetworkModes []string `json:"network_modes"`
|
||||||
|
|
||||||
|
// Reserved CPU
|
||||||
|
ReservedCPU uint64 `json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Reserved RAM
|
||||||
|
ReservedRAM uint64 `json:"reserved_ram"`
|
||||||
|
|
||||||
// SDN support
|
// SDN support
|
||||||
SDNSupport bool `json:"sdn_support"`
|
SDNSupport bool `json:"sdn_support"`
|
||||||
|
|
||||||
@@ -108,6 +114,9 @@ type RecordGrid struct {
|
|||||||
|
|
||||||
// Is BRO enabled
|
// Is BRO enabled
|
||||||
BROEnabled bool `json:"bro_enabled"`
|
BROEnabled bool `json:"bro_enabled"`
|
||||||
|
|
||||||
|
// Whether VM folders are enabled
|
||||||
|
VMFoldersEnabled bool `json:"vm_folders_enabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Information about grid
|
// Information about grid
|
||||||
@@ -139,6 +148,12 @@ type ItemGridList struct {
|
|||||||
// Network modes
|
// Network modes
|
||||||
NetworkModes []string `json:"network_modes"`
|
NetworkModes []string `json:"network_modes"`
|
||||||
|
|
||||||
|
// Reserved CPU
|
||||||
|
ReservedCPU uint64 `json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Reserved RAM
|
||||||
|
ReservedRAM uint64 `json:"reserved_ram"`
|
||||||
|
|
||||||
// SDN support
|
// SDN support
|
||||||
SDNSupport bool `json:"sdn_support"`
|
SDNSupport bool `json:"sdn_support"`
|
||||||
|
|
||||||
@@ -147,6 +162,9 @@ type ItemGridList struct {
|
|||||||
|
|
||||||
// Is BRO enabled
|
// Is BRO enabled
|
||||||
BROEnabled bool `json:"bro_enabled"`
|
BROEnabled bool `json:"bro_enabled"`
|
||||||
|
|
||||||
|
// Whether VM folders are enabled
|
||||||
|
VMFoldersEnabled bool `json:"vm_folders_enabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List Grids
|
// List Grids
|
||||||
@@ -175,15 +193,6 @@ type RecordSettingsGrid struct {
|
|||||||
//Cleanup retention period
|
//Cleanup retention period
|
||||||
CleanupRetentionPeriod uint64 `json:"cleanupRetentionPeriod"`
|
CleanupRetentionPeriod uint64 `json:"cleanupRetentionPeriod"`
|
||||||
|
|
||||||
// CPU allocation ratio
|
|
||||||
CPUAllocationRatio uint64 `json:"cpu_allocation_ratio"`
|
|
||||||
|
|
||||||
// CPU allocation ratio for VMs
|
|
||||||
CPUAllocationRatioVM uint64 `json:"cpu_allocation_ratio_vm"`
|
|
||||||
|
|
||||||
// Custom backup path
|
|
||||||
CustomBackupPath []string `json:"custom_backup_path"`
|
|
||||||
|
|
||||||
//Docker registry
|
//Docker registry
|
||||||
DockerRegistry DockerRegistry `json:"docker_registry"`
|
DockerRegistry DockerRegistry `json:"docker_registry"`
|
||||||
|
|
||||||
@@ -214,9 +223,6 @@ type RecordSettingsGrid struct {
|
|||||||
//Net QOS
|
//Net QOS
|
||||||
NetQOS NetQOS `json:"net_qos"`
|
NetQOS NetQOS `json:"net_qos"`
|
||||||
|
|
||||||
//Networks
|
|
||||||
Networks string `json:"networks"`
|
|
||||||
|
|
||||||
// Node self stop timer uptime monitor
|
// Node self stop timer uptime monitor
|
||||||
NodeSelfStopTimerUptimeMonitor uint64 `json:"nodeSelfStopTimerUptimeMonitor"`
|
NodeSelfStopTimerUptimeMonitor uint64 `json:"nodeSelfStopTimerUptimeMonitor"`
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ package grid
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetCPUAllocationParameterRequest for setting CPU allocation parameter
|
// SetCPUAllocationParameterRequest for setting CPU allocation parameter
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ package grid
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetCPUAllocationRatioForVMRequest for setting CPU allocation ratio for computes
|
// SetCPUAllocationRatioForVMRequest for setting CPU allocation ratio for computes
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package grid
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// SetResourcesLimitRequest struct to set resources limit
|
||||||
|
type SetResourcesLimitRequest struct {
|
||||||
|
// ID of the grid
|
||||||
|
// Required: true
|
||||||
|
GID uint64 `url:"grid_id" json:"grid_id" validate:"required"`
|
||||||
|
|
||||||
|
// Number of CPU cores reserved
|
||||||
|
// Default: 0
|
||||||
|
// Required: true
|
||||||
|
ReservedCPU uint64 `url:"reserved_cpu" json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Amount of RAM in MB reserved
|
||||||
|
// Default: 0
|
||||||
|
// Required: true
|
||||||
|
ReservedRAM uint64 `url:"reserved_ram" json:"reserved_ram"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetResourcesLimit sets reserved CPU and RAM limits for the grid
|
||||||
|
func (g Grid) SetResourcesLimit(ctx context.Context, req SetResourcesLimitRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/grid/set_resources_limit"
|
||||||
|
|
||||||
|
res, err := g.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return strconv.ParseBool(string(res))
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -102,6 +103,6 @@ func (i Image) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
|||||||
|
|
||||||
url := "/cloudbroker/image/list"
|
url := "/cloudbroker/image/list"
|
||||||
|
|
||||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
res, err := i.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
@@ -59,6 +59,11 @@ type Interface struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
|
// Flag indicating whether default gateway are enabled for this interface, not applicable to netType EXTNET, VFNIC, TRUNK, or SDN
|
||||||
|
// Default: true
|
||||||
|
// Required: false
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
// SDN Segment ID
|
// SDN Segment ID
|
||||||
// Required: false
|
// Required: false
|
||||||
SDNSegmentID string `url:"sdn_segment_id,omitempty" json:"sdn_segment_id,omitempty"`
|
SDNSegmentID string `url:"sdn_segment_id,omitempty" json:"sdn_segment_id,omitempty"`
|
||||||
|
|||||||
@@ -56,6 +56,11 @@ type InterfaceMassCreate struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
Enabled interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
|
// Flag indicating whether default gateway are enabled for this interface, not applicable to netType EXTNET, VFNIC, TRUNK, or SDN
|
||||||
|
// Default: true
|
||||||
|
// Required: false
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
// SDN Segment ID
|
// SDN Segment ID
|
||||||
// Required: false
|
// Required: false
|
||||||
SDNSegmentID string `url:"sdn_segment_id,omitempty" json:"sdn_segment_id,omitempty"`
|
SDNSegmentID string `url:"sdn_segment_id,omitempty" json:"sdn_segment_id,omitempty"`
|
||||||
|
|||||||
@@ -50,6 +50,12 @@ type RecordNode struct {
|
|||||||
// ReservedCPUs
|
// ReservedCPUs
|
||||||
ReservedCPUs []interface{} `json:"reservedCpus"`
|
ReservedCPUs []interface{} `json:"reservedCpus"`
|
||||||
|
|
||||||
|
// Reserved CPU
|
||||||
|
ReservedCPU uint64 `json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Reserved RAM
|
||||||
|
ReservedRAM uint64 `json:"reserved_ram"`
|
||||||
|
|
||||||
// Roles
|
// Roles
|
||||||
Roles []string `json:"roles"`
|
Roles []string `json:"roles"`
|
||||||
|
|
||||||
@@ -161,8 +167,11 @@ type CpuInfo struct {
|
|||||||
// Flags
|
// Flags
|
||||||
Flags []string `json:"flags"`
|
Flags []string `json:"flags"`
|
||||||
|
|
||||||
// Mddel name
|
// Model name
|
||||||
ModelName string `json:"model_name"`
|
ModelName string `json:"model_name"`
|
||||||
|
|
||||||
|
// Max supported generation
|
||||||
|
MaxSupportedGeneration string `json:"max_supported_generation"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main information about node
|
// Main information about node
|
||||||
@@ -200,6 +209,9 @@ type ItemNode struct {
|
|||||||
// Last check
|
// Last check
|
||||||
LastCheck uint64 `json:"lastcheck"`
|
LastCheck uint64 `json:"lastcheck"`
|
||||||
|
|
||||||
|
// Machine ID
|
||||||
|
MachineID string `json:"machine_id"`
|
||||||
|
|
||||||
// Machine GUID
|
// Machine GUID
|
||||||
MachineGUID string `json:"machineguid"`
|
MachineGUID string `json:"machineguid"`
|
||||||
|
|
||||||
@@ -257,6 +269,12 @@ type ItemNode struct {
|
|||||||
// ReservedCPUs
|
// ReservedCPUs
|
||||||
ReservedCPUs []interface{} `json:"reservedCpus"`
|
ReservedCPUs []interface{} `json:"reservedCpus"`
|
||||||
|
|
||||||
|
// Reserved CPU
|
||||||
|
ReservedCPU uint64 `json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Reserved RAM
|
||||||
|
ReservedRAM uint64 `json:"reserved_ram"`
|
||||||
|
|
||||||
// Roles
|
// Roles
|
||||||
Roles []string `json:"roles"`
|
Roles []string `json:"roles"`
|
||||||
|
|
||||||
@@ -459,11 +477,11 @@ type DPDK struct {
|
|||||||
// Bridges
|
// Bridges
|
||||||
Bridges Bridges `json:"bridges"`
|
Bridges Bridges `json:"bridges"`
|
||||||
|
|
||||||
|
// ovs dpdk cores
|
||||||
|
OVSDPDKCores []uint64 `json:"ovs_dpdk_cores"`
|
||||||
|
|
||||||
// hp memory
|
// hp memory
|
||||||
HPMemory map[string]uint64 `json:"hp_memory"`
|
HPMemory map[string]uint64 `json:"hp_memory"`
|
||||||
|
|
||||||
// pmd cpu
|
|
||||||
PMDCPU []uint64 `json:"pmd_cpu"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bridges
|
// Bridges
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package node
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// SetResourcesLimitRequest struct to set resources limit for node
|
||||||
|
type SetResourcesLimitRequest struct {
|
||||||
|
// Node ID
|
||||||
|
// Required: true
|
||||||
|
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
|
||||||
|
|
||||||
|
// Number of CPU cores reserved
|
||||||
|
// Required: true
|
||||||
|
ReservedCPU uint64 `url:"reserved_cpu" json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Amount of RAM in MB reserved
|
||||||
|
// Required: true
|
||||||
|
ReservedRAM uint64 `url:"reserved_ram" json:"reserved_ram"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetResourcesLimit sets reserved CPU and RAM limits for the node
|
||||||
|
func (n Node) SetResourcesLimit(ctx context.Context, req SetResourcesLimitRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/node/set_resources_limit"
|
||||||
|
|
||||||
|
res, err := n.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return strconv.ParseBool(string(res))
|
||||||
|
}
|
||||||
@@ -3,9 +3,8 @@ package pcidevice
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DeleteRequest struct to deleting PCI device
|
// DeleteRequest struct to deleting PCI device
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ package pcidevice
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DisableRequest struct for disabling PCI device
|
// DisableRequest struct for disabling PCI device
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ package pcidevice
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EnableRequest struct for enabling PCI device
|
// EnableRequest struct for enabling PCI device
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package pcidevice
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/serialization"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/serialization"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
type GetByNodeRequest struct {
|
type GetByNodeRequest struct {
|
||||||
// Node ID
|
// Node ID
|
||||||
// Required: true
|
// Required: true
|
||||||
NodeID uint64 `url:"nodeId" json:"nodeId" validate:"required"`
|
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
|
||||||
|
|
||||||
// Start of time period - unixtime
|
// Start of time period - unixtime
|
||||||
// Required: false
|
// Required: false
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ type GetByComputePoint struct {
|
|||||||
type ComputeUsage struct {
|
type ComputeUsage struct {
|
||||||
VCPUsConsumed uint64 `json:"vcpusConsumed"`
|
VCPUsConsumed uint64 `json:"vcpusConsumed"`
|
||||||
Storage uint64 `json:"storage"`
|
Storage uint64 `json:"storage"`
|
||||||
CPUTime uint64 `json:"cpuTime"`
|
CPUTime float64 `json:"cpuTime"`
|
||||||
ExtIPs uint64 `json:"extips"`
|
ExtIPs uint64 `json:"extips"`
|
||||||
RAMConsumed uint64 `json:"ramConsumed"`
|
RAMConsumed uint64 `json:"ramConsumed"`
|
||||||
VCPUsReserved uint64 `json:"vcpusReserved"`
|
VCPUsReserved uint64 `json:"vcpusReserved"`
|
||||||
IsUp uint64 `json:"isUp"`
|
IsUp bool `json:"isUp"`
|
||||||
RAMConsumedReal uint64 `json:"ramConsumedReal"`
|
RAMConsumedReal float64 `json:"ramConsumedReal"`
|
||||||
RAMReserved uint64 `json:"ramReserved"`
|
RAMReserved uint64 `json:"ramReserved"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ type ItemDisk struct {
|
|||||||
ResID string `json:"resId"`
|
ResID string `json:"resId"`
|
||||||
SizeUsed float64 `json:"sizeUsed"`
|
SizeUsed float64 `json:"sizeUsed"`
|
||||||
SizeAvailable float64 `json:"sizeAvailable"`
|
SizeAvailable float64 `json:"sizeAvailable"`
|
||||||
SizeMax float64 `json:"sizeMax"`
|
SizeMax uint64 `json:"sizeMax"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetByGRIDData represents an array of data points
|
// GetByGRIDData represents an array of data points
|
||||||
@@ -46,22 +46,17 @@ type GetByGRIDPoint struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ItemTotalByGRID struct {
|
type ItemTotalByGRID struct {
|
||||||
NodesCPU uint64 `json:"nodesCPU"`
|
CPUPower float64 `json:"cpuPower"`
|
||||||
StorageCapacity uint64 `json:"storageCapacity"`
|
CPUUtil float64 `json:"cpuUtil"`
|
||||||
CPUPower uint64 `json:"cpuPower"`
|
TotalMem float64 `json:"totalMem"`
|
||||||
CPUUtil uint64 `json:"cpuUtil"`
|
ReservedMem float64 `json:"reservedMem"`
|
||||||
TotalMem uint64 `json:"totalMem"`
|
UsedMem float64 `json:"usedMem"`
|
||||||
ReservedMem uint64 `json:"reservedMem"`
|
FreeMem float64 `json:"freeMem"`
|
||||||
UsedMem uint64 `json:"usedMem"`
|
|
||||||
FreeMem uint64 `json:"freeMem"`
|
|
||||||
VCPUConsumed uint64 `json:"vcpuConsumed"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ItemStorage struct {
|
type ItemStorage struct {
|
||||||
CapacityLimit uint64 `json:"capacityLimit"`
|
UsedGiB uint64 `json:"usedGiB"`
|
||||||
Consumed uint64 `json:"consumed"`
|
TotalGiB uint64 `json:"totalGiB"`
|
||||||
Type string `json:"type"`
|
|
||||||
UID string `json:"uid"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetByNodeData represents an array of data points
|
// GetByNodeData represents an array of data points
|
||||||
@@ -72,14 +67,15 @@ type GetByNodePoint struct {
|
|||||||
CPUInfo CPUinfoByNode `json:"cpuInfo"`
|
CPUInfo CPUinfoByNode `json:"cpuInfo"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
ID uint64 `json:"id"`
|
ID uint64 `json:"id"`
|
||||||
|
UID string `json:"uid"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type NodeUsage struct {
|
type NodeUsage struct {
|
||||||
CPUPower uint64 `json:"cpuPower"`
|
CPUPower uint64 `json:"cpuPower"`
|
||||||
UsedVCPUs uint64 `json:"usedVcpus"`
|
UsedVCPUs uint64 `json:"usedVcpus"`
|
||||||
PCPU uint64 `json:"pcpu"`
|
PCPU float64 `json:"pcpu"`
|
||||||
UsedMem uint64 `json:"usedMem"`
|
UsedMem uint64 `json:"usedMem"`
|
||||||
CPUUtil uint64 `json:"cpuUtil"`
|
CPUUtil float64 `json:"cpuUtil"`
|
||||||
ReservedMem uint64 `json:"reservedMem"`
|
ReservedMem uint64 `json:"reservedMem"`
|
||||||
FreeMem uint64 `json:"freeMem"`
|
FreeMem uint64 `json:"freeMem"`
|
||||||
}
|
}
|
||||||
@@ -88,4 +84,8 @@ type CPUinfoByNode struct {
|
|||||||
ClockSpeed uint64 `json:"clockSpeed"`
|
ClockSpeed uint64 `json:"clockSpeed"`
|
||||||
CoreCount uint64 `json:"coreCount"`
|
CoreCount uint64 `json:"coreCount"`
|
||||||
PhysCount uint64 `json:"physCount"`
|
PhysCount uint64 `json:"physCount"`
|
||||||
|
ThreadCount uint64 `json:"threadCount"`
|
||||||
|
ModelName string `json:"model_name"`
|
||||||
|
Flags []string `json:"flags"`
|
||||||
|
MaxSupportedGeneration string `json:"max_supported_generation"`
|
||||||
}
|
}
|
||||||
@@ -81,6 +81,10 @@ type CreateRequest struct {
|
|||||||
// SDN access group id
|
// SDN access group id
|
||||||
// Required: false
|
// Required: false
|
||||||
SDNAccessGroupID string `url:"sdn_access_group_id,omitempty" json:"sdn_access_group_id,omitempty"`
|
SDNAccessGroupID string `url:"sdn_access_group_id,omitempty" json:"sdn_access_group_id,omitempty"`
|
||||||
|
|
||||||
|
// Enabling default gateway
|
||||||
|
// Required: false
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type StoragePolicy struct {
|
type StoragePolicy struct {
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ package rg
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter
|
// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ package rg
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetCPUAllocationRatioRequest struct for setting CPU allocation ratio
|
// SetCPUAllocationRatioRequest struct for setting CPU allocation ratio
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package sep
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
)
|
)
|
||||||
@@ -20,23 +20,24 @@ type AddConsumerNodesRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AddConsumerNodes adds consumer nodes to SEP parameters
|
// AddConsumerNodes adds consumer nodes to SEP parameters
|
||||||
func (s SEP) AddConsumerNodes(ctx context.Context, req AddConsumerNodesRequest) (uint64, error) {
|
func (s SEP) AddConsumerNodes(ctx context.Context, req AddConsumerNodesRequest) ([]uint64, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
|
list := []uint64{}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
return list, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
url := "/cloudbroker/sep/addConsumerNodes"
|
url := "/cloudbroker/sep/addConsumerNodes"
|
||||||
|
|
||||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return list, err
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := strconv.ParseUint(string(res), 10, 64)
|
err = json.Unmarshal(res, &list)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, nil
|
return list, nil
|
||||||
}
|
}
|
||||||
@@ -11,12 +11,12 @@ import (
|
|||||||
// ConsumptionRequest struct to get consumption info
|
// ConsumptionRequest struct to get consumption info
|
||||||
type ConsumptionRequest struct {
|
type ConsumptionRequest struct {
|
||||||
// Storage endpoint provider ID
|
// Storage endpoint provider ID
|
||||||
// Required: true
|
// Required: false
|
||||||
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
|
SEPID uint64 `url:"sep_id,omitempty" json:"sep_id,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Consumption gets SEP consumption info
|
// Consumption gets SEP consumption info
|
||||||
func (s SEP) Consumption(ctx context.Context, req ConsumptionRequest) (*RecordConsumption, error) {
|
func (s SEP) Consumption(ctx context.Context, req ConsumptionRequest) (*ListConsumption, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
@@ -29,7 +29,7 @@ func (s SEP) Consumption(ctx context.Context, req ConsumptionRequest) (*RecordCo
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := RecordConsumption{}
|
info := ListConsumption{}
|
||||||
|
|
||||||
err = json.Unmarshal(res, &info)
|
err = json.Unmarshal(res, &info)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -47,8 +47,22 @@ type ByPool struct {
|
|||||||
UsageLimit uint64 `json:"usage_limit"`
|
UsageLimit uint64 `json:"usage_limit"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// List of Resource groups
|
||||||
|
type ListConsumption struct {
|
||||||
|
// Data
|
||||||
|
Data []RecordConsumption `json:"data"`
|
||||||
|
|
||||||
|
// Enrtry count
|
||||||
|
EntryCount uint64 `json:"entryCount"`
|
||||||
|
}
|
||||||
|
|
||||||
// Main information about consumption
|
// Main information about consumption
|
||||||
type RecordConsumption struct {
|
type RecordConsumption struct {
|
||||||
|
// ID
|
||||||
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
// By pool
|
// By pool
|
||||||
ByPool map[string]ByPool `json:"byPool"`
|
ByPool map[string]ByPool `json:"byPool"`
|
||||||
|
|
||||||
@@ -57,6 +71,9 @@ type RecordConsumption struct {
|
|||||||
|
|
||||||
// Type
|
// Type
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
|
|
||||||
|
// Consumed by
|
||||||
|
ConsumedBy []uint64 `json:"consumedBy"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main information about URI
|
// Main information about URI
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ package vgpu
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AllocateRequest struct for allocating VGPU
|
// AllocateRequest struct for allocating VGPU
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ package vgpu
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateRequest struct for creating VGPU
|
// CreateRequest struct for creating VGPU
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ package vgpu
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DeallocateRequest struct for deallocating VGPU
|
// DeallocateRequest struct for deallocating VGPU
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ package vgpu
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DestroyRequest struct for destroying VGPU
|
// DestroyRequest struct for destroying VGPU
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package vins
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -62,11 +62,11 @@ type CreateInAccountRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
// Default: false
|
// Default: false
|
||||||
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
|
||||||
|
|
||||||
type wrapperCreateRequestInAcc struct {
|
// Flag indicating whether default gateway is enabled for this VINS
|
||||||
CreateInAccountRequest
|
// Required: false
|
||||||
Routes []string `url:"routes,omitempty"`
|
// Default: true
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateInAccount creates VINS in account level
|
// CreateInAccount creates VINS in account level
|
||||||
@@ -76,31 +76,9 @@ func (v VINS) CreateInAccount(ctx context.Context, req CreateInAccountRequest) (
|
|||||||
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
var routes []string
|
|
||||||
|
|
||||||
if len(req.Routes) != 0 {
|
|
||||||
routes = make([]string, 0, len(req.Routes))
|
|
||||||
|
|
||||||
for r := range req.Routes {
|
|
||||||
b, err := json.Marshal(req.Routes[r])
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
|
|
||||||
routes = append(routes, string(b))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
routes = []string{"[]"}
|
|
||||||
}
|
|
||||||
|
|
||||||
reqWrapped := wrapperCreateRequestInAcc{
|
|
||||||
CreateInAccountRequest: req,
|
|
||||||
Routes: routes,
|
|
||||||
}
|
|
||||||
|
|
||||||
url := "/cloudbroker/vins/createInAccount"
|
url := "/cloudbroker/vins/createInAccount"
|
||||||
|
|
||||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package vins
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -56,11 +56,11 @@ type CreateInRGRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
// Default: false
|
// Default: false
|
||||||
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
|
||||||
|
|
||||||
type wrapperCreateRequestInRG struct {
|
// Flag indicating whether default gateway is enabled for this VINS
|
||||||
CreateInRGRequest
|
// Required: false
|
||||||
Routes []string `url:"routes,omitempty"`
|
// Default: true
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateInRG creates VINS in resource group level
|
// CreateInRG creates VINS in resource group level
|
||||||
@@ -69,31 +69,10 @@ func (v VINS) CreateInRG(ctx context.Context, req CreateInRGRequest) (uint64, er
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
var routes []string
|
|
||||||
|
|
||||||
if len(req.Routes) != 0 {
|
|
||||||
routes = make([]string, 0, len(req.Routes))
|
|
||||||
|
|
||||||
for r := range req.Routes {
|
|
||||||
b, err := json.Marshal(req.Routes[r])
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
|
|
||||||
routes = append(routes, string(b))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
routes = []string{"[]"}
|
|
||||||
}
|
|
||||||
|
|
||||||
reqWrapped := wrapperCreateRequestInRG{
|
|
||||||
CreateInRGRequest: req,
|
|
||||||
Routes: routes,
|
|
||||||
}
|
|
||||||
|
|
||||||
url := "/cloudbroker/vins/createInRG"
|
url := "/cloudbroker/vins/createInRG"
|
||||||
|
|
||||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -523,6 +523,9 @@ type RecordVINS struct {
|
|||||||
// Description
|
// Description
|
||||||
Description string `json:"desc"`
|
Description string `json:"desc"`
|
||||||
|
|
||||||
|
// Enable Default Gateway
|
||||||
|
EnableDefaultGateway bool `json:"enable_default_gateway"`
|
||||||
|
|
||||||
// Enable Security Groups
|
// Enable Security Groups
|
||||||
EnableSecGroups bool `json:"enable_secgroups"`
|
EnableSecGroups bool `json:"enable_secgroups"`
|
||||||
|
|
||||||
@@ -736,6 +739,9 @@ type ItemVINS struct {
|
|||||||
// Description
|
// Description
|
||||||
Description string `json:"desc"`
|
Description string `json:"desc"`
|
||||||
|
|
||||||
|
// Enable Default Gateway
|
||||||
|
EnableDefaultGateway bool `json:"enable_default_gateway"`
|
||||||
|
|
||||||
// Enable Security Groups
|
// Enable Security Groups
|
||||||
EnableSecGroups bool `json:"enable_secgroups"`
|
EnableSecGroups bool `json:"enable_secgroups"`
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ type UpdateRequest struct {
|
|||||||
// Flag indicating whether security groups are enabled for this network
|
// Flag indicating whether security groups are enabled for this network
|
||||||
// Required: false
|
// Required: false
|
||||||
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
|
// Flag indicating whether default gateway is enabled for this VINS
|
||||||
|
// Required: false
|
||||||
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update updates a vins parameters
|
// Update updates a vins parameters
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package cloudbroker
|
||||||
|
|
||||||
|
import (
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/pkg/cloudbroker/vmfolder"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Accessing the VMFolder method group
|
||||||
|
func (cb *CloudBroker) VMFolder() *vmfolder.VMFolder {
|
||||||
|
return vmfolder.New(cb.client)
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AddACLAccessRequest adds ACL access to a vm folder
|
||||||
|
type AddACLAccessRequest struct {
|
||||||
|
// ID of a folder
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
|
||||||
|
// User or group name to grant access
|
||||||
|
// Required: true
|
||||||
|
User string `url:"user" json:"user" validate:"required"`
|
||||||
|
|
||||||
|
// ID of a folder
|
||||||
|
// Required: true
|
||||||
|
Right string `url:"right" json:"right" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddACLAccess adds ACL access to a vm folder
|
||||||
|
func (v VMFolder) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vmfolder/add_acl_access"
|
||||||
|
|
||||||
|
res, err := v.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,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ComputesMoveRequest struct to move computes to a vm folder
|
||||||
|
type ComputesMoveRequest struct {
|
||||||
|
// IDs of computes to move
|
||||||
|
// Required: true
|
||||||
|
ComputeIDs []uint64 `url:"compute_ids" json:"compute_ids" validate:"required"`
|
||||||
|
|
||||||
|
// Target vm folder ID
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ComputesMove moves computes to a vm folder
|
||||||
|
func (v VMFolder) ComputesMove(ctx context.Context, req ComputesMoveRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vmfolder/computes_move"
|
||||||
|
|
||||||
|
res, err := v.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 vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CreateRequest struct to create a vm folder
|
||||||
|
type CreateRequest struct {
|
||||||
|
// Resource Group ID
|
||||||
|
// Required: true
|
||||||
|
RGID uint64 `url:"rg_id" json:"rg_id" validate:"required"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
// Required: true
|
||||||
|
Name string `url:"name" json:"name" validate:"required"`
|
||||||
|
|
||||||
|
// Parent ID
|
||||||
|
// Required: false
|
||||||
|
ParentID uint64 `url:"parent_id,omitempty" json:"parent_id,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create creates a vm folder
|
||||||
|
func (v VMFolder) Create(ctx context.Context, req CreateRequest) (uint64, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vmfolder/create"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseUint(string(res), 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DeleteACLAccessRequest deletes ACL access from a vm folder
|
||||||
|
type DelACLAccessRequest struct {
|
||||||
|
// ID of a folder
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id"`
|
||||||
|
|
||||||
|
// User or group name to revoke access from
|
||||||
|
// Required: true
|
||||||
|
User string `url:"user" json:"user"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteACLAccess deletes ACL access from a vm foler
|
||||||
|
func (v VMFolder) DeleteACLAccess(ctx context.Context, req DelACLAccessRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vmfolder/del_acl_access"
|
||||||
|
|
||||||
|
res, err := v.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,39 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DeleteRequest struct to delete a VM folder
|
||||||
|
type DeleteRequest struct {
|
||||||
|
// ID of a folder to delete
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete deletes a vm folder
|
||||||
|
func (v VMFolder) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vmfolder/delete"
|
||||||
|
|
||||||
|
res, err := v.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 vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetRequest struct to get detailed information about a vm folder
|
||||||
|
type GetRequest struct {
|
||||||
|
// ID of a folder
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get gets current configuration of the vm folder as a RecordVMFolder struct
|
||||||
|
func (v VMFolder) Get(ctx context.Context, req GetRequest) (*RecordVMFolder, error) {
|
||||||
|
res, err := v.GetRaw(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := RecordVMFolder{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &info, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRaw gets current configuration of the vm folder as an array of bytes
|
||||||
|
func (v VMFolder) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vmfolder/get"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ListRequest struct to get list of vm folders
|
||||||
|
type ListRequest struct {
|
||||||
|
// Resource group ID
|
||||||
|
// Required: true
|
||||||
|
RGID uint64 `url:"rg_id" json:"rg_id" validate:"required"`
|
||||||
|
|
||||||
|
// Page number
|
||||||
|
// Required: false
|
||||||
|
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||||
|
|
||||||
|
// Page size
|
||||||
|
// Required: false
|
||||||
|
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List gets list of all vm folders in a resource group as a ListVMFolder struct
|
||||||
|
func (v VMFolder) List(ctx context.Context, req ListRequest) (*ListVMFolder, error) {
|
||||||
|
|
||||||
|
res, err := v.ListRaw(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
list := ListVMFolder{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &list)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &list, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListRaw gets list of all vm folders in a resource group as an array of bytes
|
||||||
|
func (v VMFolder) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||||
|
|
||||||
|
if err := validators.ValidateRequest(req); err != nil {
|
||||||
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vmfolder/list"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
// Detailed information about a folder
|
||||||
|
type RecordVMFolder struct {
|
||||||
|
// ID
|
||||||
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
|
// RG ID
|
||||||
|
RGID uint64 `json:"rg_id"`
|
||||||
|
|
||||||
|
// GID
|
||||||
|
GID uint64 `json:"gid"`
|
||||||
|
|
||||||
|
// Name of a folder
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// ACL
|
||||||
|
ACL []ACL `json:"acl"`
|
||||||
|
|
||||||
|
// Time of creation
|
||||||
|
CreatedTime uint64 `json:"created_time"`
|
||||||
|
|
||||||
|
// Parent ID
|
||||||
|
ParentID uint64 `json:"parent_id"`
|
||||||
|
|
||||||
|
// Status of a folder
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Compute IDs
|
||||||
|
ComputeIDs []uint64 `json:"compute_ids"`
|
||||||
|
|
||||||
|
// Time of update
|
||||||
|
UpdatedTime uint64 `json:"updated_time"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ACL
|
||||||
|
type ACL struct {
|
||||||
|
// Explicit
|
||||||
|
Explicit bool `json:"explicit"`
|
||||||
|
|
||||||
|
// Right
|
||||||
|
Right string `json:"right"`
|
||||||
|
|
||||||
|
// Status
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Type
|
||||||
|
Type string `json:"type"`
|
||||||
|
|
||||||
|
// User group ID
|
||||||
|
UserGroupID string `json:"userGroupId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of vm folders
|
||||||
|
type ListVMFolder struct {
|
||||||
|
// Entry count
|
||||||
|
EntryCount uint64 `json:"entryCount"`
|
||||||
|
|
||||||
|
// Data
|
||||||
|
Data []ItemVMFolder `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detailed information about a folder item
|
||||||
|
type ItemVMFolder struct {
|
||||||
|
// Folder ID
|
||||||
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
|
// Parent ID
|
||||||
|
ParentID uint64 `json:"parent_id"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// ACL
|
||||||
|
ACL []ACL `json:"acl"`
|
||||||
|
|
||||||
|
// Status
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// VM count
|
||||||
|
VMCount uint64 `json:"vm_count"`
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// MoveRequest to move a vm folder to a compute
|
||||||
|
type MoveRequest struct {
|
||||||
|
// VM Folder ID
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id"`
|
||||||
|
|
||||||
|
// New parent folder ID
|
||||||
|
// Required: true
|
||||||
|
NewParentID uint64 `url:"new_parent_id" json:"new_parent_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move moves a vm folder to a compute
|
||||||
|
func (v VMFolder) Move(ctx context.Context, req MoveRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vmfolder/move"
|
||||||
|
|
||||||
|
res, err := v.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,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// RenameRequest struct to rename a VM folder
|
||||||
|
type RenameRequest struct {
|
||||||
|
// ID of a folder to rename
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
|
||||||
|
// A new name
|
||||||
|
// Required: true
|
||||||
|
Name string `url:"name" json:"name" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rename renames a vm folder
|
||||||
|
func (v VMFolder) Rename(ctx context.Context, req RenameRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vmfolder/rename"
|
||||||
|
|
||||||
|
res, err := v.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,17 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/interfaces"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Structure for creating request to VMFolder
|
||||||
|
type VMFolder struct {
|
||||||
|
client interfaces.Caller
|
||||||
|
}
|
||||||
|
|
||||||
|
// Builder for VMFolder endpoints
|
||||||
|
func New(client interfaces.Caller) *VMFolder {
|
||||||
|
return &VMFolder{
|
||||||
|
client,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -177,6 +177,12 @@ type RecordZone struct {
|
|||||||
|
|
||||||
// CPU alignment profiles
|
// CPU alignment profiles
|
||||||
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
|
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
|
||||||
|
|
||||||
|
// Reserved CPU
|
||||||
|
ReservedCPU uint64 `json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Reserved RAM
|
||||||
|
ReservedRAM uint64 `json:"reserved_ram"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// A zone item from a list
|
// A zone item from a list
|
||||||
@@ -249,4 +255,10 @@ type ItemZone struct {
|
|||||||
|
|
||||||
// CPU alignment profiles
|
// CPU alignment profiles
|
||||||
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
|
CpuAlignmentProfiles []CpuAlignmentProfile `json:"cpu_alignment_profiles"`
|
||||||
|
|
||||||
|
// Reserved CPU
|
||||||
|
ReservedCPU uint64 `json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Reserved RAM
|
||||||
|
ReservedRAM uint64 `json:"reserved_ram"`
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package zone
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// SetResourcesLimitRequest struct to set resources limit
|
||||||
|
type SetResourcesLimitRequest struct {
|
||||||
|
// ID of the zone
|
||||||
|
// Required: true
|
||||||
|
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
|
||||||
|
|
||||||
|
// Number of CPU cores reserved
|
||||||
|
// Required: true
|
||||||
|
ReservedCPU uint64 `url:"reserved_cpu" json:"reserved_cpu"`
|
||||||
|
|
||||||
|
// Amount of RAM in MB reserved
|
||||||
|
// Required: true
|
||||||
|
ReservedRAM uint64 `url:"reserved_ram" json:"reserved_ram"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetResourcesLimit sets reserved CPU and RAM limits for the zone
|
||||||
|
func (e Zone) SetResourcesLimit(ctx context.Context, req SetResourcesLimitRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/zone/set_resources_limit"
|
||||||
|
|
||||||
|
res, err := e.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return strconv.ParseBool(string(res))
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package zone
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UpdateCPUAlignmentProfileRequest struct to update CPU alignment profile of zone
|
||||||
|
type UpdateCPUAlignmentProfileRequest struct {
|
||||||
|
// ID of zone
|
||||||
|
// Required: true
|
||||||
|
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
|
||||||
|
|
||||||
|
// Minimum percentage of hypervisors that must support the selected CPU model for the balanced profile
|
||||||
|
// Default: 70
|
||||||
|
// Required: false
|
||||||
|
HypervisorSimilarityInPercentage uint64 `url:"hypervisor_similarity_in_percentage,omitempty" json:"hypervisor_similarity_in_percentage,omitempty" validate:"omitempty,max=100"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateCPUAlignmentProfile updates CPU alignment profile of zone
|
||||||
|
func (e Zone) UpdateCPUAlignmentProfile(ctx context.Context, req UpdateCPUAlignmentProfileRequest) ([]CpuAlignmentProfile, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/zone/update_cpu_alignment_profile"
|
||||||
|
|
||||||
|
res, err := e.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var profiles []CpuAlignmentProfile
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &profiles)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return profiles, nil
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ var testSecurityPolicies = SecurityPoliciesList{
|
|||||||
{
|
{
|
||||||
ID: "policy1",
|
ID: "policy1",
|
||||||
DisplayName: "DevelopersPolicy",
|
DisplayName: "DevelopersPolicy",
|
||||||
Description: "First policy",
|
AccessGroupName: "DevelopersGroup",
|
||||||
CreatedAt: "2023-01-01T00:00:00Z",
|
CreatedAt: "2023-01-01T00:00:00Z",
|
||||||
UpdatedAt: "2023-01-01T01:00:00Z",
|
UpdatedAt: "2023-01-01T01:00:00Z",
|
||||||
AccessGroupID: "group1",
|
AccessGroupID: "group1",
|
||||||
@@ -23,28 +23,16 @@ var testSecurityPolicies = SecurityPoliciesList{
|
|||||||
Direction: "INGRESS",
|
Direction: "INGRESS",
|
||||||
Enabled: true,
|
Enabled: true,
|
||||||
Priority: 100,
|
Priority: 100,
|
||||||
SecurityPolicyID: "policy1",
|
Type: "System",
|
||||||
VersionID: 1,
|
VersionID: 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Status: Status{
|
|
||||||
Common: "ACTIVE",
|
|
||||||
Hypervisors: []HypervisorStatus{
|
|
||||||
{
|
|
||||||
Name: "hv1",
|
|
||||||
DisplayName: "Hypervisor1",
|
|
||||||
Status: "SYNCED",
|
|
||||||
HypervisorStatus: "HEALTHY",
|
|
||||||
SyncedAt: "2023-01-01T01:00:00Z",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
VersionID: 1,
|
VersionID: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ID: "policy2",
|
ID: "policy2",
|
||||||
DisplayName: "AdminsPolicy",
|
DisplayName: "AdminsPolicy",
|
||||||
Description: "Second policy",
|
AccessGroupName: "AdminsGroup",
|
||||||
CreatedAt: "2023-01-02T00:00:00Z",
|
CreatedAt: "2023-01-02T00:00:00Z",
|
||||||
UpdatedAt: "2023-01-02T01:00:00Z",
|
UpdatedAt: "2023-01-02T01:00:00Z",
|
||||||
AccessGroupID: "group2",
|
AccessGroupID: "group2",
|
||||||
@@ -58,28 +46,16 @@ var testSecurityPolicies = SecurityPoliciesList{
|
|||||||
Direction: "EGRESS",
|
Direction: "EGRESS",
|
||||||
Enabled: true,
|
Enabled: true,
|
||||||
Priority: 50,
|
Priority: 50,
|
||||||
SecurityPolicyID: "policy2",
|
Type: "System",
|
||||||
VersionID: 1,
|
VersionID: 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Status: Status{
|
|
||||||
Common: "ACTIVE",
|
|
||||||
Hypervisors: []HypervisorStatus{
|
|
||||||
{
|
|
||||||
Name: "hv2",
|
|
||||||
DisplayName: "Hypervisor2",
|
|
||||||
Status: "SYNCED",
|
|
||||||
HypervisorStatus: "HEALTHY",
|
|
||||||
SyncedAt: "2023-01-02T01:00:00Z",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
VersionID: 2,
|
VersionID: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ID: "policy3",
|
ID: "policy3",
|
||||||
DisplayName: "UsersPolicy",
|
DisplayName: "UsersPolicy",
|
||||||
Description: "Third policy",
|
AccessGroupName: "UsersGroup",
|
||||||
CreatedAt: "2023-01-03T00:00:00Z",
|
CreatedAt: "2023-01-03T00:00:00Z",
|
||||||
UpdatedAt: "2023-01-03T01:00:00Z",
|
UpdatedAt: "2023-01-03T01:00:00Z",
|
||||||
AccessGroupID: "group3",
|
AccessGroupID: "group3",
|
||||||
@@ -93,22 +69,10 @@ var testSecurityPolicies = SecurityPoliciesList{
|
|||||||
Direction: "INGRESS",
|
Direction: "INGRESS",
|
||||||
Enabled: false,
|
Enabled: false,
|
||||||
Priority: 200,
|
Priority: 200,
|
||||||
SecurityPolicyID: "policy3",
|
Type: "User",
|
||||||
VersionID: 1,
|
VersionID: 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Status: Status{
|
|
||||||
Common: "PENDING",
|
|
||||||
Hypervisors: []HypervisorStatus{
|
|
||||||
{
|
|
||||||
Name: "hv3",
|
|
||||||
DisplayName: "Hypervisor3",
|
|
||||||
Status: "SYNCING",
|
|
||||||
HypervisorStatus: "HEALTHY",
|
|
||||||
SyncedAt: "2023-01-03T01:00:00Z",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
VersionID: 3,
|
VersionID: 3,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -132,11 +96,11 @@ func TestFilterByDisplayName(t *testing.T) {
|
|||||||
|
|
||||||
func TestFilterFunc(t *testing.T) {
|
func TestFilterFunc(t *testing.T) {
|
||||||
actual := testSecurityPolicies.FilterFunc(func(sp SecurityPolicy) bool {
|
actual := testSecurityPolicies.FilterFunc(func(sp SecurityPolicy) bool {
|
||||||
return sp.Description == "Second policy"
|
return sp.AccessGroupName == "AdminsGroup"
|
||||||
})
|
})
|
||||||
|
|
||||||
if len(actual.Policies) != 1 || actual.Policies[0].ID != "policy2" {
|
if len(actual.Policies) != 1 || actual.Policies[0].ID != "policy2" {
|
||||||
t.Fatal("Expected 1 policy with description 'Second policy', found:", len(actual.Policies))
|
t.Fatal("Expected 1 policy with access group name 'AdminsGroup', found:", len(actual.Policies))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,13 +156,18 @@ func TestFilterByDefaultOpenSessionDrop(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFilterByStatus(t *testing.T) {
|
func TestFilterByRuleType(t *testing.T) {
|
||||||
actual := testSecurityPolicies.FilterFunc(func(sp SecurityPolicy) bool {
|
actual := testSecurityPolicies.FilterFunc(func(sp SecurityPolicy) bool {
|
||||||
return sp.Status.Common == "ACTIVE"
|
for _, rule := range sp.SecurityRules {
|
||||||
|
if rule.Type == "System" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
})
|
})
|
||||||
|
|
||||||
if len(actual.Policies) != 2 {
|
if len(actual.Policies) != 2 {
|
||||||
t.Fatal("Expected 2 policies with ACTIVE status, found:", len(actual.Policies))
|
t.Fatal("Expected 2 policies with System rules, found:", len(actual.Policies))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ type SecurityPolicy struct {
|
|||||||
// Access group ID
|
// Access group ID
|
||||||
AccessGroupID string `json:"access_group_id"`
|
AccessGroupID string `json:"access_group_id"`
|
||||||
|
|
||||||
|
// Access group name
|
||||||
|
AccessGroupName string `json:"access_group_name"`
|
||||||
|
|
||||||
// Created time
|
// Created time
|
||||||
CreatedAt string `json:"created_at"`
|
CreatedAt string `json:"created_at"`
|
||||||
|
|
||||||
@@ -18,9 +21,6 @@ type SecurityPolicy struct {
|
|||||||
// Default open session drop flag
|
// Default open session drop flag
|
||||||
DefaultOpenSessionDrop bool `json:"default_open_session_drop"`
|
DefaultOpenSessionDrop bool `json:"default_open_session_drop"`
|
||||||
|
|
||||||
// Description
|
|
||||||
Description string `json:"description"`
|
|
||||||
|
|
||||||
// Display name
|
// Display name
|
||||||
DisplayName string `json:"display_name"`
|
DisplayName string `json:"display_name"`
|
||||||
|
|
||||||
@@ -30,12 +30,6 @@ type SecurityPolicy struct {
|
|||||||
// Security rules
|
// Security rules
|
||||||
SecurityRules []SecurityRule `json:"security_rules"`
|
SecurityRules []SecurityRule `json:"security_rules"`
|
||||||
|
|
||||||
// Locked time
|
|
||||||
LockedAt string `json:"locked_at"`
|
|
||||||
|
|
||||||
// Status information
|
|
||||||
Status Status `json:"status"`
|
|
||||||
|
|
||||||
// Version ID
|
// Version ID
|
||||||
VersionID uint64 `json:"version_id"`
|
VersionID uint64 `json:"version_id"`
|
||||||
|
|
||||||
@@ -51,11 +45,11 @@ type SecurityRule struct {
|
|||||||
// Action
|
// Action
|
||||||
Action string `json:"action"`
|
Action string `json:"action"`
|
||||||
|
|
||||||
// Description
|
// Applied network object groups
|
||||||
Description string `json:"description"`
|
AppliedNetObjectGroups []AppliedNetObjectGroup `json:"applied_net_object_groups"`
|
||||||
|
|
||||||
// Destination network object
|
// Destination network object groups
|
||||||
DestinationNetObject NetObject `json:"destination_net_object"`
|
DestinationNetObjectGroups []NetObjectGroup `json:"destination_net_object_groups"`
|
||||||
|
|
||||||
// Direction
|
// Direction
|
||||||
Direction string `json:"direction"`
|
Direction string `json:"direction"`
|
||||||
@@ -66,8 +60,8 @@ type SecurityRule struct {
|
|||||||
// Enabled flag
|
// Enabled flag
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
|
|
||||||
// Filter configuration
|
// Filters configuration
|
||||||
Filter Filter `json:"filter"`
|
Filter []FilterParams `json:"filters"`
|
||||||
|
|
||||||
// ID
|
// ID
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
@@ -75,47 +69,152 @@ type SecurityRule struct {
|
|||||||
// Log enabled flag
|
// Log enabled flag
|
||||||
LogEnabled bool `json:"log_enabled"`
|
LogEnabled bool `json:"log_enabled"`
|
||||||
|
|
||||||
// Log name
|
// Logging profile
|
||||||
LogName string `json:"log_name"`
|
LoggingProfile LoggingProfile `json:"logging_profile"`
|
||||||
|
|
||||||
// Log severity
|
// Logging profile ID
|
||||||
LogSeverity string `json:"log_severity"`
|
LoggingProfileID string `json:"logging_profile_id"`
|
||||||
|
|
||||||
// Priority
|
// Priority
|
||||||
Priority int `json:"priority"`
|
Priority int `json:"priority"`
|
||||||
|
|
||||||
// Security policy ID
|
// Security rule condition groups
|
||||||
SecurityPolicyID string `json:"security_policy_id"`
|
SecurityRuleConditionGroups []SecurityRuleConditionGroup `json:"security_rule_condition_groups"`
|
||||||
|
|
||||||
// Source network object
|
// Security rule conditions
|
||||||
SourceNetObject NetObject `json:"source_net_object"`
|
SecurityRuleConditions []SecurityRuleCondition `json:"security_rule_conditions"`
|
||||||
|
|
||||||
|
// Source network object groups
|
||||||
|
SourceNetObjectGroups []NetObjectGroup `json:"source_net_object_groups"`
|
||||||
|
|
||||||
// Statistics enabled flag
|
// Statistics enabled flag
|
||||||
StatisticsEnabled bool `json:"statistics_enabled"`
|
StatisticsEnabled bool `json:"statistics_enabled"`
|
||||||
|
|
||||||
|
// Type
|
||||||
|
Type string `json:"type"`
|
||||||
|
|
||||||
// Version ID
|
// Version ID
|
||||||
VersionID uint64 `json:"version_id"`
|
VersionID uint64 `json:"version_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Network object information
|
// Applied network object group information
|
||||||
type NetObject struct {
|
type AppliedNetObjectGroup struct {
|
||||||
// Display name
|
// ID
|
||||||
DisplayName string `json:"display_name"`
|
ID string `json:"id"`
|
||||||
|
|
||||||
// Network address pool ID
|
|
||||||
NetAddressPoolID string `json:"net_address_pool_id"`
|
|
||||||
|
|
||||||
// Network object group ID
|
|
||||||
NetObjectGroupID string `json:"net_object_group_id"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filter configuration
|
|
||||||
type Filter struct {
|
|
||||||
// Filter parameters
|
|
||||||
Filters FilterParams `json:"filters"`
|
|
||||||
|
|
||||||
// Name
|
// Name
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// Version ID
|
||||||
|
VersionID uint64 `json:"version_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Network object group information
|
||||||
|
type NetObjectGroup struct {
|
||||||
|
// ID
|
||||||
|
ID string `json:"id"`
|
||||||
|
|
||||||
|
// Is positive flag
|
||||||
|
IsPositive bool `json:"is_positive"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// Version ID
|
||||||
|
VersionID uint64 `json:"version_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Logging profile information
|
||||||
|
type LoggingProfile struct {
|
||||||
|
// Access group ID
|
||||||
|
AccessGroupID string `json:"access_group_id"`
|
||||||
|
|
||||||
|
// Access group name
|
||||||
|
AccessGroupName string `json:"access_group_name"`
|
||||||
|
|
||||||
|
// Created time
|
||||||
|
CreatedAt string `json:"created_at"`
|
||||||
|
|
||||||
|
// Direction
|
||||||
|
Direction string `json:"direction"`
|
||||||
|
|
||||||
|
// ID
|
||||||
|
ID string `json:"id"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// Security rules count
|
||||||
|
SecurityRulesCount uint64 `json:"security_rules_count"`
|
||||||
|
|
||||||
|
// Session established sample rate
|
||||||
|
SessionEstablishedSampleRate float64 `json:"session_established_sample_rate"`
|
||||||
|
|
||||||
|
// Session new sample rate
|
||||||
|
SessionNewSampleRate float64 `json:"session_new_sample_rate"`
|
||||||
|
|
||||||
|
// Updated time
|
||||||
|
UpdatedAt string `json:"updated_at"`
|
||||||
|
|
||||||
|
// Version ID
|
||||||
|
VersionID uint64 `json:"version_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Security rule condition group information
|
||||||
|
type SecurityRuleConditionGroup struct {
|
||||||
|
// Access group ID
|
||||||
|
AccessGroupID string `json:"access_group_id"`
|
||||||
|
|
||||||
|
// Access group name
|
||||||
|
AccessGroupName string `json:"access_group_name"`
|
||||||
|
|
||||||
|
// Created time
|
||||||
|
CreatedAt string `json:"created_at"`
|
||||||
|
|
||||||
|
// ID
|
||||||
|
ID string `json:"id"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// Security rule conditions
|
||||||
|
SecurityRuleConditions []SecurityRuleCondition `json:"security_rule_conditions"`
|
||||||
|
|
||||||
|
// Security rules count
|
||||||
|
SecurityRulesCount uint64 `json:"security_rules_count"`
|
||||||
|
|
||||||
|
// Updated time
|
||||||
|
UpdatedAt string `json:"updated_at"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Security rule condition information
|
||||||
|
type SecurityRuleCondition struct {
|
||||||
|
// Access group ID
|
||||||
|
AccessGroupID string `json:"access_group_id"`
|
||||||
|
|
||||||
|
// Created time
|
||||||
|
CreatedAt string `json:"created_at"`
|
||||||
|
|
||||||
|
// Filters configuration
|
||||||
|
Filters []FilterParams `json:"filters"`
|
||||||
|
|
||||||
|
// ID
|
||||||
|
ID string `json:"id"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// Read only flag
|
||||||
|
ReadOnly bool `json:"read_only"`
|
||||||
|
|
||||||
|
// Security rule condition groups
|
||||||
|
SecurityRuleConditionGroups []interface{} `json:"security_rule_condition_groups"`
|
||||||
|
|
||||||
|
// Security rules
|
||||||
|
SecurityRules []interface{} `json:"security_rules"`
|
||||||
|
|
||||||
|
// Updated time
|
||||||
|
UpdatedAt string `json:"updated_at"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter parameters
|
// Filter parameters
|
||||||
@@ -126,8 +225,8 @@ type FilterParams struct {
|
|||||||
// ARP protocol flag
|
// ARP protocol flag
|
||||||
ARP bool `json:"arp"`
|
ARP bool `json:"arp"`
|
||||||
|
|
||||||
// DHCP protocol flag
|
// Ethernet type
|
||||||
DHCP bool `json:"dhcp"`
|
EthType string `json:"eth_type"`
|
||||||
|
|
||||||
// Filter expression
|
// Filter expression
|
||||||
Expression string `json:"expression"`
|
Expression string `json:"expression"`
|
||||||
@@ -138,6 +237,9 @@ type FilterParams struct {
|
|||||||
// IP protocol flag
|
// IP protocol flag
|
||||||
IP bool `json:"ip"`
|
IP bool `json:"ip"`
|
||||||
|
|
||||||
|
// IP protocol number
|
||||||
|
IPProto uint64 `json:"ip_proto"`
|
||||||
|
|
||||||
// IPv4 protocol flag
|
// IPv4 protocol flag
|
||||||
IPv4 bool `json:"ip_v4"`
|
IPv4 bool `json:"ip_v4"`
|
||||||
|
|
||||||
@@ -156,36 +258,15 @@ type FilterParams struct {
|
|||||||
// TCP destination ports
|
// TCP destination ports
|
||||||
TCPDstPorts []string `json:"tcp_dst_ports"`
|
TCPDstPorts []string `json:"tcp_dst_ports"`
|
||||||
|
|
||||||
|
// TCP source ports
|
||||||
|
TCPSrcPorts []string `json:"tcp_src_ports"`
|
||||||
|
|
||||||
// UDP protocol flag
|
// UDP protocol flag
|
||||||
UDP bool `json:"udp"`
|
UDP bool `json:"udp"`
|
||||||
|
|
||||||
// UDP destination ports
|
// UDP destination ports
|
||||||
UDPDstPorts []string `json:"udp_dst_ports"`
|
UDPDstPorts []string `json:"udp_dst_ports"`
|
||||||
}
|
|
||||||
|
|
||||||
// Status information
|
// UDP source ports
|
||||||
type Status struct {
|
UDPSrcPorts []string `json:"udp_src_ports"`
|
||||||
// Common status
|
|
||||||
Common string `json:"common"`
|
|
||||||
|
|
||||||
// Hypervisor statuses
|
|
||||||
Hypervisors []HypervisorStatus `json:"hypervisors"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hypervisor status information
|
|
||||||
type HypervisorStatus struct {
|
|
||||||
// Status
|
|
||||||
Status string `json:"status"`
|
|
||||||
|
|
||||||
// Name
|
|
||||||
Name string `json:"name"`
|
|
||||||
|
|
||||||
// Display name
|
|
||||||
DisplayName string `json:"display_name"`
|
|
||||||
|
|
||||||
// Hypervisor status
|
|
||||||
HypervisorStatus string `json:"hypervisor_status"`
|
|
||||||
|
|
||||||
// Last sync time
|
|
||||||
SyncedAt string `json:"synced_at"`
|
|
||||||
}
|
}
|
||||||
+229
-105
@@ -54,7 +54,7 @@ type CreateRequest struct {
|
|||||||
|
|
||||||
// VLAN tag identifier
|
// VLAN tag identifier
|
||||||
// Required: false
|
// Required: false
|
||||||
VLANTag string `url:"vlan_tag,omitempty" json:"vlan_tag,omitempty" validate:"omitempty,trunkTags"`
|
VLANTag uint64 `url:"vlan_tag,omitempty" json:"vlan_tag,omitempty" validate:"omitempty,min=1,max=4094"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ExternalNetworkPortRequest struct {
|
type ExternalNetworkPortRequest struct {
|
||||||
@@ -63,8 +63,8 @@ type ExternalNetworkPortRequest struct {
|
|||||||
AccessGroupID string `url:"access_group_id" json:"access_group_id" validate:"required"`
|
AccessGroupID string `url:"access_group_id" json:"access_group_id" validate:"required"`
|
||||||
|
|
||||||
// Access group name
|
// Access group name
|
||||||
// Required: false
|
// Required: true
|
||||||
AccessGroupName string `url:"access_group_name,omitempty" json:"access_group_name,omitempty"`
|
AccessGroupName string `url:"access_group_name" json:"access_group_name" validate:"required"`
|
||||||
|
|
||||||
// Comment for the external network port
|
// Comment for the external network port
|
||||||
// Required: true
|
// Required: true
|
||||||
@@ -79,28 +79,28 @@ type ExternalNetworkPortRequest struct {
|
|||||||
Enabled bool `url:"enabled" json:"enabled"`
|
Enabled bool `url:"enabled" json:"enabled"`
|
||||||
|
|
||||||
// IPv4
|
// IPv4
|
||||||
// Required: false
|
// Required: true
|
||||||
IPv4 string `url:"ipv4,omitempty" json:"ipv4,omitempty"`
|
IPv4 string `url:"ipv4" json:"ipv4" validate:"required"`
|
||||||
|
|
||||||
// IPv6
|
// IPv6
|
||||||
// Required: false
|
// Required: true
|
||||||
IPv6 string `url:"ipv6,omitempty" json:"ipv6,omitempty"`
|
IPv6 string `url:"ipv6" json:"ipv6" validate:"required"`
|
||||||
|
|
||||||
// IPv6 Config
|
// IPv6 Config
|
||||||
// Required: false
|
// Required: true
|
||||||
IPv6Config *IPv6ConfigRequest `url:"-" json:"ipv6_config,omitempty"`
|
IPv6Config *IPv6ConfigRequest `url:"-" json:"ipv6_config" validate:"required"`
|
||||||
|
|
||||||
// MAC address
|
// MAC address
|
||||||
// Required: true
|
// Required: true
|
||||||
MAC string `url:"mac" json:"mac" validate:"required"`
|
MAC string `url:"mac" json:"mac" validate:"required"`
|
||||||
|
|
||||||
// Router gateway port
|
// Router gateway port
|
||||||
// Required: false
|
// Required: true
|
||||||
RouterGatewayPort *RouterGatewayPortRequest `url:"-" json:"router_gateway_port,omitempty"`
|
RouterGatewayPort *RouterGatewayPortRequest `url:"-" json:"router_gateway_port" validate:"required"`
|
||||||
|
|
||||||
// Floating IP
|
// Floating IP
|
||||||
// Required: false
|
// Required: true
|
||||||
FloatingIP *FloatingIPRequest `url:"-" json:"floating_ip,omitempty"`
|
FloatingIP *FloatingIPRequest `url:"-" json:"floating_ip" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type IPv6ConfigRequest struct {
|
type IPv6ConfigRequest struct {
|
||||||
@@ -167,15 +167,15 @@ type FloatingIPRequest struct {
|
|||||||
|
|
||||||
// External network port
|
// External network port
|
||||||
// Required: true
|
// Required: true
|
||||||
ExternalNetworkPort string `url:"external_network_port" json:"external_network_port" validate:"required"`
|
ExternalNetworkPort *ExternalNetworkPortRequest `url:"-" json:"external_network_port" validate:"required"`
|
||||||
|
|
||||||
// ID of the Floating IP
|
// ID of the Floating IP
|
||||||
// Required: true
|
// Required: true
|
||||||
ID string `url:"id" json:"id" validate:"required"`
|
ID string `url:"id" json:"id" validate:"required"`
|
||||||
|
|
||||||
// Logical port
|
// Logical port
|
||||||
// Required: false
|
// Required: true
|
||||||
LogicalPort *LogicalPortRequest `url:"-" json:"logical_port,omitempty"`
|
LogicalPort *LogicalPortRequest `url:"-" json:"logical_port" validate:"required"`
|
||||||
|
|
||||||
// Router
|
// Router
|
||||||
// Required: true
|
// Required: true
|
||||||
@@ -185,6 +185,14 @@ type FloatingIPRequest struct {
|
|||||||
// Required: true
|
// Required: true
|
||||||
UpdatedAt time.Time `url:"updated_at" json:"updated_at" validate:"required"`
|
UpdatedAt time.Time `url:"updated_at" json:"updated_at" validate:"required"`
|
||||||
|
|
||||||
|
// ID of the user who created the floating IP
|
||||||
|
// Required: false
|
||||||
|
CreatedBy string `url:"created_by,omitempty" json:"created_by,omitempty"`
|
||||||
|
|
||||||
|
// ID of the user who last updated the floating IP
|
||||||
|
// Required: false
|
||||||
|
UpdatedBy string `url:"updated_by,omitempty" json:"updated_by,omitempty"`
|
||||||
|
|
||||||
// ID of version
|
// ID of version
|
||||||
// Required: true
|
// Required: true
|
||||||
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
|
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
|
||||||
@@ -209,7 +217,7 @@ type LogicalPortRequest struct {
|
|||||||
|
|
||||||
// Address detection
|
// Address detection
|
||||||
// Required: true
|
// Required: true
|
||||||
AddressDetection bool `url:"address_detection" json:"address_detection" validate:"required"`
|
AddressDetection bool `url:"address_detection" json:"address_detection"`
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
// Required: true
|
// Required: true
|
||||||
@@ -219,14 +227,18 @@ type LogicalPortRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
CreatedAt time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
|
CreatedAt time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
|
||||||
|
|
||||||
// User-friendly name for router
|
// User-friendly name for logical port
|
||||||
// Required: true
|
// Required: true
|
||||||
RouterDisplayName string `url:"router_display_name" json:"router_display_name" validate:"required"`
|
DisplayName string `url:"display_name" json:"display_name" validate:"required"`
|
||||||
|
|
||||||
// Whether the logical pork is enabled
|
// Whether the logical pork is enabled
|
||||||
// Required: true
|
// Required: true
|
||||||
Enabled bool `url:"enabled" json:"enabled"`
|
Enabled bool `url:"enabled" json:"enabled"`
|
||||||
|
|
||||||
|
// Exclude firewall information
|
||||||
|
// Required: true
|
||||||
|
ExcludeFirewall *ExcludeFirewallRequest `url:"-" json:"exclude_firewall" validate:"required"`
|
||||||
|
|
||||||
// External Network ID
|
// External Network ID
|
||||||
// Required: false
|
// Required: false
|
||||||
ExternalNetworkID string `url:"external_network_id,omitempty" json:"external_network_id,omitempty"`
|
ExternalNetworkID string `url:"external_network_id,omitempty" json:"external_network_id,omitempty"`
|
||||||
@@ -236,38 +248,66 @@ type LogicalPortRequest struct {
|
|||||||
Hypervisor string `url:"hypervisor" json:"hypervisor" validate:"required"`
|
Hypervisor string `url:"hypervisor" json:"hypervisor" validate:"required"`
|
||||||
|
|
||||||
// User-friendly name for hypervisor
|
// User-friendly name for hypervisor
|
||||||
|
// Required: true
|
||||||
|
HypervisorDisplayName string `url:"hypervisor_display_name" json:"hypervisor_display_name" validate:"required"`
|
||||||
|
|
||||||
|
// Labels
|
||||||
// Required: false
|
// Required: false
|
||||||
HypervisorDisplayName string `url:"hypervisor_display_name,omitempty" json:"hypervisor_display_name,omitempty"`
|
Labels *LabelsRequest `url:"-" json:"labels,omitempty"`
|
||||||
|
|
||||||
// Live Migration Target Hv
|
// Live Migration Target Hv
|
||||||
// Required: true
|
// Required: false
|
||||||
LiveMigrationTargetHV string `url:"live_migration_target_hv" json:"live_migration_target_hv" validate:"required"`
|
LiveMigrationTargetHV string `url:"live_migration_target_hv,omitempty" json:"live_migration_target_hv,omitempty"`
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
// Required: true
|
// Required: false
|
||||||
Status *StatusRequest `url:"-" json:"status" validate:"required"`
|
Status *StatusRequest `url:"-" json:"status,omitempty"`
|
||||||
|
|
||||||
// Port bindings
|
// Port bindings
|
||||||
// Required: true
|
// Required: false
|
||||||
Bindings *PortBindingsRequest `url:"-" json:"bindings" validate:"required"`
|
Bindings *PortBindingsRequest `url:"-" json:"bindings,omitempty"`
|
||||||
|
|
||||||
// Unique Identifier
|
// Unique Identifier
|
||||||
// Required: true
|
// Required: true
|
||||||
UniqueIDentifier string `url:"unique_identifier" json:"unique_identifier" validate:"required"`
|
UniqueIDentifier string `url:"unique_identifier" json:"unique_identifier" validate:"required"`
|
||||||
|
|
||||||
// Updated at
|
// Updated at
|
||||||
// Required: true
|
// Required: false
|
||||||
UpdatedAt time.Time `url:"updated_at" json:"updated_at" validate:"required"`
|
UpdatedAt time.Time `url:"updated_at,omitempty" json:"updated_at,omitempty"`
|
||||||
|
|
||||||
// ID of version
|
// ID of version
|
||||||
// Required: true
|
// Required: true
|
||||||
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
|
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type StatusRequest struct {
|
type ExcludeFirewallRequest struct {
|
||||||
// Common
|
// Exclusion reason
|
||||||
|
// Required: false
|
||||||
|
ExclusionReason string `url:"exclusion_reason,omitempty" json:"exclusion_reason,omitempty"`
|
||||||
|
|
||||||
|
// Whether logical port addresses are excluded from firewall
|
||||||
|
// Required: false
|
||||||
|
LogicalPortAddressesExcluded bool `url:"logical_port_addresses_excluded,omitempty" json:"logical_port_addresses_excluded,omitempty"`
|
||||||
|
|
||||||
|
// Whether logical port is excluded from firewall
|
||||||
// Required: true
|
// Required: true
|
||||||
Common string `url:"common" json:"common" validate:"required"`
|
LogicalPortExcluded bool `url:"logical_port_excluded" json:"logical_port_excluded"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type LabelsRequest struct {
|
||||||
|
// VM ID
|
||||||
|
// Required: true
|
||||||
|
VMID string `url:"vm_id" json:"vm_id" validate:"required"`
|
||||||
|
|
||||||
|
// VM name
|
||||||
|
// Required: false
|
||||||
|
VMName string `url:"vm_name,omitempty" json:"vm_name,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type StatusRequest struct {
|
||||||
|
// Operation status
|
||||||
|
// Required: true
|
||||||
|
OperationStatus string `url:"operation_status" json:"operation_status" validate:"required"`
|
||||||
|
|
||||||
// Hypervisors status
|
// Hypervisors status
|
||||||
// Required: false
|
// Required: false
|
||||||
@@ -280,24 +320,20 @@ type PortBindingsRequest struct {
|
|||||||
ID string `url:"id" json:"id" validate:"required"`
|
ID string `url:"id" json:"id" validate:"required"`
|
||||||
|
|
||||||
// User-friendly name for segment
|
// User-friendly name for segment
|
||||||
// Required: true
|
// Required: false
|
||||||
SegmentDisplayName string `url:"segment_display_name" json:"segment_display_name" validate:"required"`
|
SegmentDisplayName string `url:"segment_display_name,omitempty" json:"segment_display_name,omitempty"`
|
||||||
|
|
||||||
// Segment ID
|
// Segment ID
|
||||||
// Required: true
|
// Required: false
|
||||||
SegmentID string `url:"segment_id" json:"segment_id" validate:"required"`
|
SegmentID string `url:"segment_id,omitempty" json:"segment_id,omitempty"`
|
||||||
|
|
||||||
// Port security
|
// Port security
|
||||||
// Required: true
|
// Required: true
|
||||||
PortSecurity bool `url:"port_security" json:"port_security" validate:"required"`
|
PortSecurity bool `url:"port_security" json:"port_security"`
|
||||||
|
|
||||||
// Address detection
|
// Address detection
|
||||||
// Required: true
|
// Required: true
|
||||||
AddressDetection bool `url:"address_detection" json:"address_detection" validate:"required"`
|
AddressDetection bool `url:"address_detection" json:"address_detection"`
|
||||||
|
|
||||||
// Is Exclude From Firewall
|
|
||||||
// Required: true
|
|
||||||
IsExcludedFromFirewall bool `url:"is_excluded_from_firewall" json:"is_excluded_from_firewall" validate:"required"`
|
|
||||||
|
|
||||||
// ID of version
|
// ID of version
|
||||||
// Required: true
|
// Required: true
|
||||||
@@ -312,14 +348,14 @@ type PortBindingsRequest struct {
|
|||||||
UpdatedAt time.Time `url:"updated_at" json:"updated_at" validate:"required"`
|
UpdatedAt time.Time `url:"updated_at" json:"updated_at" validate:"required"`
|
||||||
|
|
||||||
// Logical port addresses
|
// Logical port addresses
|
||||||
// Required: true
|
// Required: false
|
||||||
LogicalPortAddresses []LogicalPortAddressRequest `url:"-" json:"logical_port_addresses" validate:"required"`
|
LogicalPortAddresses []LogicalPortAddressRequest `url:"-" json:"logical_port_addresses,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type HypervisorStatusRequest struct {
|
type HypervisorStatusRequest struct {
|
||||||
// Status
|
// Operation status
|
||||||
// Required: true
|
// Required: true
|
||||||
Status string `url:"status" json:"status" validate:"required"`
|
OperationStatus string `url:"operation_status" json:"operation_status" validate:"required"`
|
||||||
|
|
||||||
// Name of hypervisor
|
// Name of hypervisor
|
||||||
// Required: true
|
// Required: true
|
||||||
@@ -351,13 +387,13 @@ type LogicalPortAddressRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
IsDiscovered bool `url:"is_discovered,omitempty" json:"is_discovered,omitempty"`
|
IsDiscovered bool `url:"is_discovered,omitempty" json:"is_discovered,omitempty"`
|
||||||
|
|
||||||
// Is discovered
|
// Is primary
|
||||||
// Required: true
|
// Required: false
|
||||||
IsPrimary bool `url:"is_primary" json:"is_primary" validate:"required"`
|
IsPrimary bool `url:"is_primary,omitempty" json:"is_primary,omitempty"`
|
||||||
|
|
||||||
// MAC
|
// MAC
|
||||||
// Required: false
|
// Required: true
|
||||||
MAC string `url:"mac,omitempty" json:"mac,omitempty"`
|
MAC string `url:"mac" json:"mac" validate:"required"`
|
||||||
|
|
||||||
// ID
|
// ID
|
||||||
// Required: true
|
// Required: true
|
||||||
@@ -368,62 +404,62 @@ type LogicalPortAddressRequest struct {
|
|||||||
LogicalPortID string `url:"logical_port_id" json:"logical_port_id" validate:"required"`
|
LogicalPortID string `url:"logical_port_id" json:"logical_port_id" validate:"required"`
|
||||||
|
|
||||||
// Assigned at
|
// Assigned at
|
||||||
// Required: false
|
// Required: true
|
||||||
AssignedAt time.Time `url:"assigned_at,omitempty" json:"assigned_at,omitempty"`
|
AssignedAt time.Time `url:"assigned_at" json:"assigned_at" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RouterRequest struct {
|
type RouterRequest struct {
|
||||||
// Access group ID
|
// Access group ID
|
||||||
// Required: false
|
// Required: true
|
||||||
AccessGroupID string `url:"access_group_id,omitempty" json:"access_group_id,omitempty"`
|
AccessGroupID string `url:"access_group_id" json:"access_group_id" validate:"required"`
|
||||||
|
|
||||||
// Access group name
|
// Access group name
|
||||||
// Required: false
|
// Required: true
|
||||||
AccessGroupName string `url:"access_group_name,omitempty" json:"access_group_name,omitempty"`
|
AccessGroupName string `url:"access_group_name" json:"access_group_name" validate:"required"`
|
||||||
|
|
||||||
// Created at
|
// Created at
|
||||||
// Required: false
|
// Required: true
|
||||||
CreatedAt time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
|
CreatedAt time.Time `url:"created_at" json:"created_at" validate:"required"`
|
||||||
|
|
||||||
// Detailed description of the router
|
// Detailed description of the router
|
||||||
// Required: false
|
// Required: true
|
||||||
Description string `url:"description,omitempty" json:"description,omitempty"`
|
Description string `url:"description" json:"description" validate:"required"`
|
||||||
|
|
||||||
// User-friendly name for the router
|
// User-friendly name for the router
|
||||||
// Required: true
|
// Required: true
|
||||||
DisplayName string `url:"display_name" json:"display_name" validate:"required"`
|
DisplayName string `url:"display_name" json:"display_name" validate:"required"`
|
||||||
|
|
||||||
// Whether the router is enabled
|
// Whether the router is enabled
|
||||||
// Required: false
|
// Required: true
|
||||||
Enabled bool `url:"enabled,omitempty" json:"enabled,omitempty"`
|
Enabled bool `url:"enabled" json:"enabled"`
|
||||||
|
|
||||||
// Gateway ports
|
// Gateway ports
|
||||||
// Required: false
|
// Required: true
|
||||||
GatewayPorts []GatewayPortRequest `url:"-" json:"gateway_ports,omitempty"`
|
GatewayPorts []GatewayPortRequest `url:"-" json:"gateway_ports" validate:"required"`
|
||||||
|
|
||||||
// ID
|
// ID
|
||||||
// Required: true
|
// Required: true
|
||||||
ID string `url:"id" json:"id" validate:"required"`
|
ID string `url:"id" json:"id" validate:"required"`
|
||||||
|
|
||||||
// Policies
|
// Policies
|
||||||
// Required: false
|
// Required: true
|
||||||
Policies []RouterPolicyRequest `url:"-" json:"policies,omitempty"`
|
Policies []RouterPolicyRequest `url:"-" json:"policies" validate:"required"`
|
||||||
|
|
||||||
// Ports
|
// Ports
|
||||||
// Required: false
|
// Required: true
|
||||||
Ports []RouterPortRequest `url:"-" json:"ports,omitempty"`
|
Ports []RouterPortRequest `url:"-" json:"ports" validate:"required"`
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
// Required: false
|
// Required: true
|
||||||
Status *StatusRequest `url:"-" json:"status,omitempty"`
|
Status *StatusRequest `url:"-" json:"status" validate:"required"`
|
||||||
|
|
||||||
// Updated at
|
// Updated at
|
||||||
// Required: false
|
// Required: true
|
||||||
UpdatedAt time.Time `url:"updated_at,omitempty" json:"updated_at,omitempty"`
|
UpdatedAt time.Time `url:"updated_at" json:"updated_at" validate:"required"`
|
||||||
|
|
||||||
// ID of version
|
// ID of version
|
||||||
// Required: false
|
// Required: true
|
||||||
VersionID uint64 `url:"version_id,omitempty" json:"version_id,omitempty"`
|
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GatewayPortRequest struct {
|
type GatewayPortRequest struct {
|
||||||
@@ -436,28 +472,28 @@ type GatewayPortRequest struct {
|
|||||||
Description string `url:"description" json:"description" validate:"required"`
|
Description string `url:"description" json:"description" validate:"required"`
|
||||||
|
|
||||||
// L4 port max
|
// L4 port max
|
||||||
// Required: false
|
// Required: true
|
||||||
ExternalL4PortMax int64 `url:"external_l4_port_max,omitempty" json:"external_l4_port_max,omitempty"`
|
ExternalL4PortMax int64 `url:"external_l4_port_max" json:"external_l4_port_max" validate:"required"`
|
||||||
|
|
||||||
// L4 port min
|
// L4 port min
|
||||||
// Required: false
|
// Required: true
|
||||||
ExternalL4PortMin int64 `url:"external_l4_port_min,omitempty" json:"external_l4_port_min,omitempty"`
|
ExternalL4PortMin int64 `url:"external_l4_port_min" json:"external_l4_port_min" validate:"required"`
|
||||||
|
|
||||||
// External network port
|
// External network port
|
||||||
// Required: true
|
// Required: true
|
||||||
ExternalNetworkPort interface{} `url:"external_network_port" json:"external_network_port" validate:"required"`
|
ExternalNetworkPort *ExternalNetworkPortRequest `url:"-" json:"external_network_port" validate:"required"`
|
||||||
|
|
||||||
// ID of port
|
// ID of port
|
||||||
// Required: false
|
// Required: true
|
||||||
ID string `url:"id,omitempty" json:"id,omitempty"`
|
ID string `url:"id" json:"id" validate:"required"`
|
||||||
|
|
||||||
// SNAT Enabled
|
// SNAT Enabled
|
||||||
// Required: true
|
// Required: true
|
||||||
SNATEnabled bool `url:"snat_enabled" json:"snat_enabled"`
|
SNATEnabled bool `url:"snat_enabled" json:"snat_enabled"`
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
// Required: false
|
// Required: true
|
||||||
Status *StatusRequest `url:"-" json:"status,omitempty"`
|
Status *StatusRequest `url:"-" json:"status" validate:"required"`
|
||||||
|
|
||||||
// Updated at
|
// Updated at
|
||||||
// Required: true
|
// Required: true
|
||||||
@@ -482,12 +518,12 @@ type RouterPolicyRequest struct {
|
|||||||
DisplayName string `url:"display_name" json:"display_name" validate:"required"`
|
DisplayName string `url:"display_name" json:"display_name" validate:"required"`
|
||||||
|
|
||||||
// Whether the policy is enabled
|
// Whether the policy is enabled
|
||||||
// Required: false
|
// Required: true
|
||||||
Enabled bool `url:"enabled,omitempty" json:"enabled,omitempty"`
|
Enabled bool `url:"enabled" json:"enabled"`
|
||||||
|
|
||||||
// ID of port
|
// ID of port
|
||||||
// Required: false
|
// Required: true
|
||||||
ID string `url:"id,omitempty" json:"id,omitempty"`
|
ID string `url:"id" json:"id" validate:"required"`
|
||||||
|
|
||||||
// Match
|
// Match
|
||||||
// Required: true
|
// Required: true
|
||||||
@@ -528,16 +564,16 @@ type RouterPortRequest struct {
|
|||||||
Enabled bool `url:"enabled" json:"enabled"`
|
Enabled bool `url:"enabled" json:"enabled"`
|
||||||
|
|
||||||
// ID of port
|
// ID of port
|
||||||
// Required: false
|
|
||||||
ID string `url:"id,omitempty" json:"id,omitempty"`
|
|
||||||
|
|
||||||
// Next IPv4 address
|
|
||||||
// Required: true
|
// Required: true
|
||||||
NextIPv4Address []string `url:"next_ipv4_address" json:"next_ipv4_address" validate:"required"`
|
ID string `url:"id" json:"id" validate:"required"`
|
||||||
|
|
||||||
// Next IPv6 address
|
// IPv4 address
|
||||||
// Required: true
|
// Required: true
|
||||||
NextIPv6Address []string `url:"next_ipv6_address" json:"next_ipv6_address" validate:"required"`
|
IPv4Address string `url:"ipv4_address" json:"ipv4_address" validate:"required"`
|
||||||
|
|
||||||
|
// IPv6 address
|
||||||
|
// Required: true
|
||||||
|
IPv6Address string `url:"ipv6_address" json:"ipv6_address" validate:"required"`
|
||||||
|
|
||||||
// IPv6 Config
|
// IPv6 Config
|
||||||
// Required: true
|
// Required: true
|
||||||
@@ -556,8 +592,8 @@ type RouterPortRequest struct {
|
|||||||
SegmentID string `url:"segment_id" json:"segment_id" validate:"required"`
|
SegmentID string `url:"segment_id" json:"segment_id" validate:"required"`
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
// Required: false
|
// Required: true
|
||||||
Status *StatusRequest `url:"-" json:"status,omitempty"`
|
Status *StatusRequest `url:"-" json:"status" validate:"required"`
|
||||||
|
|
||||||
// Updated at
|
// Updated at
|
||||||
// Required: true
|
// Required: true
|
||||||
@@ -598,12 +634,16 @@ type SegmentRequest struct {
|
|||||||
DisplayName string `url:"display_name" json:"display_name" validate:"required"`
|
DisplayName string `url:"display_name" json:"display_name" validate:"required"`
|
||||||
|
|
||||||
// Whether the segment is enabled
|
// Whether the segment is enabled
|
||||||
// Required: false
|
// Required: true
|
||||||
Enabled bool `url:"enabled,omitempty" json:"enabled,omitempty"`
|
Enabled bool `url:"enabled" json:"enabled"`
|
||||||
|
|
||||||
// ID of segment
|
// ID of segment
|
||||||
|
// Required: true
|
||||||
|
ID string `url:"id" json:"id" validate:"required"`
|
||||||
|
|
||||||
|
// L2 connection port
|
||||||
// Required: false
|
// Required: false
|
||||||
ID string `url:"id,omitempty" json:"id,omitempty"`
|
L2ConnectionPort *L2ConnectionPortRequest `url:"-" json:"l2_connection_port,omitempty"`
|
||||||
|
|
||||||
// Logical ports info
|
// Logical ports info
|
||||||
// Required: false
|
// Required: false
|
||||||
@@ -625,6 +665,10 @@ type SegmentRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
SubnetV6 string `url:"subnet_v6,omitempty" json:"subnet_v6,omitempty"`
|
SubnetV6 string `url:"subnet_v6,omitempty" json:"subnet_v6,omitempty"`
|
||||||
|
|
||||||
|
// Type of segment
|
||||||
|
// Required: true
|
||||||
|
Type string `url:"type" json:"type" validate:"required"`
|
||||||
|
|
||||||
// Updated at
|
// Updated at
|
||||||
// Required: true
|
// Required: true
|
||||||
UpdatedAt time.Time `url:"updated_at" json:"updated_at" validate:"required"`
|
UpdatedAt time.Time `url:"updated_at" json:"updated_at" validate:"required"`
|
||||||
@@ -634,6 +678,86 @@ type SegmentRequest struct {
|
|||||||
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
|
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type L2ConnectionPortRequest struct {
|
||||||
|
// Access group ID
|
||||||
|
// Required: true
|
||||||
|
AccessGroupID string `url:"access_group_id" json:"access_group_id" validate:"required"`
|
||||||
|
|
||||||
|
// Created at
|
||||||
|
// Required: true
|
||||||
|
CreatedAt time.Time `url:"created_at" json:"created_at" validate:"required"`
|
||||||
|
|
||||||
|
// ID of the L2 connection port
|
||||||
|
// Required: true
|
||||||
|
ID string `url:"id" json:"id" validate:"required"`
|
||||||
|
|
||||||
|
// L2 external network details
|
||||||
|
// Required: false
|
||||||
|
L2ExternalNetwork *L2ExternalNetworkRequest `url:"-" json:"l2_external_network,omitempty"`
|
||||||
|
|
||||||
|
// Updated at
|
||||||
|
// Required: true
|
||||||
|
UpdatedAt time.Time `url:"updated_at" json:"updated_at" validate:"required"`
|
||||||
|
|
||||||
|
// ID of the user who last updated the port
|
||||||
|
// Required: false
|
||||||
|
UpdatedBy string `url:"updated_by,omitempty" json:"updated_by,omitempty"`
|
||||||
|
|
||||||
|
// ID of the user who created the port
|
||||||
|
// Required: false
|
||||||
|
CreatedBy string `url:"created_by,omitempty" json:"created_by,omitempty"`
|
||||||
|
|
||||||
|
// ID of version
|
||||||
|
// Required: true
|
||||||
|
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type L2ExternalNetworkRequest struct {
|
||||||
|
// Bridge network name
|
||||||
|
// Required: true
|
||||||
|
BridgeNetworkName string `url:"bridge_network_name" json:"bridge_network_name" validate:"required"`
|
||||||
|
|
||||||
|
// Created at
|
||||||
|
// Required: true
|
||||||
|
CreatedAt time.Time `url:"created_at" json:"created_at" validate:"required"`
|
||||||
|
|
||||||
|
// Detailed description of the network
|
||||||
|
// Required: true
|
||||||
|
Description string `url:"description" json:"description" validate:"required"`
|
||||||
|
|
||||||
|
// User-friendly name for the network
|
||||||
|
// Required: true
|
||||||
|
DisplayName string `url:"display_name" json:"display_name" validate:"required"`
|
||||||
|
|
||||||
|
// List of hypervisor IDs attached to the network
|
||||||
|
// Required: true
|
||||||
|
Hypervisors []string `url:"hypervisors" json:"hypervisors" validate:"required"`
|
||||||
|
|
||||||
|
// ID of the network
|
||||||
|
// Required: true
|
||||||
|
ID string `url:"id" json:"id" validate:"required"`
|
||||||
|
|
||||||
|
// Updated at
|
||||||
|
// Required: true
|
||||||
|
UpdatedAt time.Time `url:"updated_at" json:"updated_at" validate:"required"`
|
||||||
|
|
||||||
|
// ID of version
|
||||||
|
// Required: true
|
||||||
|
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
|
||||||
|
|
||||||
|
// VLAN tag
|
||||||
|
// Required: false
|
||||||
|
VLANTag uint64 `url:"vlan_tag,omitempty" json:"vlan_tag,omitempty"`
|
||||||
|
|
||||||
|
// ID of the user who last updated the network
|
||||||
|
// Required: false
|
||||||
|
UpdatedBy string `url:"updated_by,omitempty" json:"updated_by,omitempty"`
|
||||||
|
|
||||||
|
// ID of the user who created the network
|
||||||
|
// Required: false
|
||||||
|
CreatedBy string `url:"created_by,omitempty" json:"created_by,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
type DHCPv4ConfigRequest struct {
|
type DHCPv4ConfigRequest struct {
|
||||||
// DNS
|
// DNS
|
||||||
// Required: false
|
// Required: false
|
||||||
@@ -682,12 +806,12 @@ type DHCPv6ConfigRequest struct {
|
|||||||
ID string `url:"id,omitempty" json:"id,omitempty"`
|
ID string `url:"id,omitempty" json:"id,omitempty"`
|
||||||
|
|
||||||
// Lease time
|
// Lease time
|
||||||
// Required: true
|
// Required: false
|
||||||
LeaseTime int64 `url:"lease_time" json:"lease_time" validate:"required"`
|
LeaseTime int64 `url:"lease_time,omitempty" json:"lease_time,omitempty"`
|
||||||
|
|
||||||
// Server MAC
|
// Server MAC
|
||||||
// Required: true
|
// Required: false
|
||||||
ServerMAC string `url:"server_mac" json:"server_mac" validate:"required"`
|
ServerMAC string `url:"server_mac,omitempty" json:"server_mac,omitempty"`
|
||||||
|
|
||||||
// Whether the config is enabled
|
// Whether the config is enabled
|
||||||
// Required: true
|
// Required: true
|
||||||
@@ -700,8 +824,8 @@ type EntityInfoRequest struct {
|
|||||||
DisplayName string `url:"display_name" json:"display_name" validate:"required"`
|
DisplayName string `url:"display_name" json:"display_name" validate:"required"`
|
||||||
|
|
||||||
// ID of entity
|
// ID of entity
|
||||||
// Required: false
|
// Required: true
|
||||||
ID string `url:"id,omitempty" json:"id,omitempty"`
|
ID string `url:"id" json:"id" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create creates extnet
|
// Create creates extnet
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
// GetRequest struct to get information about external network
|
// GetRequest struct to get information about external network
|
||||||
type GetRequest struct {
|
type GetRequest struct {
|
||||||
// ID of external network
|
// ID of external network
|
||||||
// Required: false
|
// Required: true
|
||||||
ExtNetID string `url:"external_network_id" json:"external_network_id" validate:"required"`
|
ExtNetID string `url:"external_network_id" json:"external_network_id" validate:"required"`
|
||||||
|
|
||||||
// ID of access group
|
// ID of access group
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ type ListRequest struct {
|
|||||||
|
|
||||||
// Filter by VLAN tag
|
// Filter by VLAN tag
|
||||||
// Required: false
|
// Required: false
|
||||||
VLANTag string `url:"vlan_tag,omitempty" json:"vlan_tag,omitempty"`
|
VLANTag uint64 `url:"vlan_tag,omitempty" json:"vlan_tag,omitempty" validate:"omitempty,min=1,max=4094"`
|
||||||
|
|
||||||
// Filter by IPv4 default gateway
|
// Filter by IPv4 default gateway
|
||||||
// Required: false
|
// Required: false
|
||||||
|
|||||||
+118
-9
@@ -82,6 +82,15 @@ type ExternalNetworkPort struct {
|
|||||||
|
|
||||||
// Floating IP
|
// Floating IP
|
||||||
FloatingIP FloatingIP `json:"floating_ip"`
|
FloatingIP FloatingIP `json:"floating_ip"`
|
||||||
|
|
||||||
|
// ID of external network
|
||||||
|
ExternalNetworkID string `json:"external_network_id"`
|
||||||
|
|
||||||
|
// ID of external network port
|
||||||
|
ID string `json:"id"`
|
||||||
|
|
||||||
|
// ID of version
|
||||||
|
VersionID uint64 `json:"version_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type IPv6Config struct {
|
type IPv6Config struct {
|
||||||
@@ -132,7 +141,7 @@ type FloatingIP struct {
|
|||||||
CreatedAt time.Time `json:"created_at"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
|
||||||
// External network port
|
// External network port
|
||||||
ExternalNetworkPort string `json:"external_network_port"`
|
ExternalNetworkPort *ExternalNetworkPort `json:"external_network_port"`
|
||||||
|
|
||||||
// ID of floating IP
|
// ID of floating IP
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
@@ -146,6 +155,12 @@ type FloatingIP struct {
|
|||||||
// Update time
|
// Update time
|
||||||
UpdatedAt time.Time `json:"updated_at"`
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
|
|
||||||
|
// ID of the user who created the floating IP
|
||||||
|
CreatedBy string `json:"created_by"`
|
||||||
|
|
||||||
|
// ID of the user who last updated the floating IP
|
||||||
|
UpdatedBy string `json:"updated_by"`
|
||||||
|
|
||||||
// ID of version
|
// ID of version
|
||||||
VersionID uint64 `json:"version_id"`
|
VersionID uint64 `json:"version_id"`
|
||||||
}
|
}
|
||||||
@@ -178,6 +193,9 @@ type LogicalPort struct {
|
|||||||
// Whether the logical port is enabled
|
// Whether the logical port is enabled
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
|
|
||||||
|
// Exclude firewall information
|
||||||
|
ExcludeFirewall ExcludeFirewall `json:"exclude_firewall"`
|
||||||
|
|
||||||
// External Network ID
|
// External Network ID
|
||||||
ExternalNetworkID string `json:"external_network_id"`
|
ExternalNetworkID string `json:"external_network_id"`
|
||||||
|
|
||||||
@@ -187,6 +205,9 @@ type LogicalPort struct {
|
|||||||
// User-friendly name for hypervisor
|
// User-friendly name for hypervisor
|
||||||
HypervisorDisplayName string `json:"hypervisor_display_name"`
|
HypervisorDisplayName string `json:"hypervisor_display_name"`
|
||||||
|
|
||||||
|
// Labels
|
||||||
|
Labels Labels `json:"labels"`
|
||||||
|
|
||||||
// Live Migration Target Hv
|
// Live Migration Target Hv
|
||||||
LiveMigrationTargetHV string `json:"live_migration_target_hv"`
|
LiveMigrationTargetHV string `json:"live_migration_target_hv"`
|
||||||
|
|
||||||
@@ -206,6 +227,25 @@ type LogicalPort struct {
|
|||||||
VersionID uint64 `json:"version_id"`
|
VersionID uint64 `json:"version_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ExcludeFirewall struct {
|
||||||
|
// Exclusion reason
|
||||||
|
ExclusionReason string `json:"exclusion_reason"`
|
||||||
|
|
||||||
|
// Whether logical port addresses are excluded from firewall
|
||||||
|
LogicalPortAddressesExcluded bool `json:"logical_port_addresses_excluded"`
|
||||||
|
|
||||||
|
// Whether logical port is excluded from firewall
|
||||||
|
LogicalPortExcluded bool `json:"logical_port_excluded"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Labels struct {
|
||||||
|
// VM ID
|
||||||
|
VMID string `json:"vm_id"`
|
||||||
|
|
||||||
|
// VM name
|
||||||
|
VMName string `json:"vm_name"`
|
||||||
|
}
|
||||||
|
|
||||||
type PortBindings struct {
|
type PortBindings struct {
|
||||||
// Binding ID
|
// Binding ID
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
@@ -222,9 +262,6 @@ type PortBindings struct {
|
|||||||
// Address detection
|
// Address detection
|
||||||
AddressDetection bool `json:"address_detection"`
|
AddressDetection bool `json:"address_detection"`
|
||||||
|
|
||||||
// Is Exclude From Firewall
|
|
||||||
IsExcludedFromFirewall bool `json:"is_excluded_from_firewall"`
|
|
||||||
|
|
||||||
// ID of version
|
// ID of version
|
||||||
VersionID uint64 `json:"version_id"`
|
VersionID uint64 `json:"version_id"`
|
||||||
|
|
||||||
@@ -319,7 +356,7 @@ type GatewayPort struct {
|
|||||||
ExternalL4PortMin int64 `json:"external_l4_port_min"`
|
ExternalL4PortMin int64 `json:"external_l4_port_min"`
|
||||||
|
|
||||||
// External network port
|
// External network port
|
||||||
ExternalNetworkPort interface{} `json:"external_network_port"`
|
ExternalNetworkPort *ExternalNetworkPort `json:"external_network_port"`
|
||||||
|
|
||||||
// ID of port
|
// ID of port
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
@@ -441,6 +478,9 @@ type Segment struct {
|
|||||||
// ID of segment
|
// ID of segment
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
|
|
||||||
|
// L2 connection port info
|
||||||
|
L2ConnectionPort *L2ConnectionPort `json:"l2_connection_port,omitempty"`
|
||||||
|
|
||||||
// Logical ports info
|
// Logical ports info
|
||||||
LogicalPortsInfo []EntityInfo `json:"logical_ports_info"`
|
LogicalPortsInfo []EntityInfo `json:"logical_ports_info"`
|
||||||
|
|
||||||
@@ -456,6 +496,9 @@ type Segment struct {
|
|||||||
// IPv6 subnet in CIDR notation
|
// IPv6 subnet in CIDR notation
|
||||||
SubnetV6 string `json:"subnet_v6"`
|
SubnetV6 string `json:"subnet_v6"`
|
||||||
|
|
||||||
|
// Type of segment
|
||||||
|
Type string `json:"type"`
|
||||||
|
|
||||||
// Update time
|
// Update time
|
||||||
UpdatedAt time.Time `json:"updated_at"`
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
|
|
||||||
@@ -463,6 +506,69 @@ type Segment struct {
|
|||||||
VersionID uint64 `json:"version_id"`
|
VersionID uint64 `json:"version_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// L2ConnectionPort holds information about the L2 connection port of a segment
|
||||||
|
type L2ConnectionPort struct {
|
||||||
|
// ID of the L2 connection port
|
||||||
|
ID string `json:"id"`
|
||||||
|
|
||||||
|
// Access group ID
|
||||||
|
AccessGroupID string `json:"access_group_id"`
|
||||||
|
|
||||||
|
// ID of version
|
||||||
|
VersionID uint64 `json:"version_id"`
|
||||||
|
|
||||||
|
// L2 external network details
|
||||||
|
L2ExternalNetwork L2ExternalNetwork `json:"l2_external_network"`
|
||||||
|
|
||||||
|
// Created time
|
||||||
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
|
||||||
|
// ID of the user who created the port
|
||||||
|
CreatedBy string `json:"created_by"`
|
||||||
|
|
||||||
|
// Updated time
|
||||||
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
|
|
||||||
|
// ID of the user who last updated the port
|
||||||
|
UpdatedBy string `json:"updated_by"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// L2ExternalNetwork holds information about an L2 external network
|
||||||
|
type L2ExternalNetwork struct {
|
||||||
|
// ID of the network
|
||||||
|
ID string `json:"id"`
|
||||||
|
|
||||||
|
// User-friendly name for the network
|
||||||
|
DisplayName string `json:"display_name"`
|
||||||
|
|
||||||
|
// Detailed description of the network
|
||||||
|
Description string `json:"description"`
|
||||||
|
|
||||||
|
// Bridge network name
|
||||||
|
BridgeNetworkName string `json:"bridge_network_name"`
|
||||||
|
|
||||||
|
// List of hypervisor IDs attached to the network
|
||||||
|
Hypervisors []string `json:"hypervisors"`
|
||||||
|
|
||||||
|
// VLAN tag
|
||||||
|
VLANTag uint64 `json:"vlan_tag"`
|
||||||
|
|
||||||
|
// ID of version
|
||||||
|
VersionID uint64 `json:"version_id"`
|
||||||
|
|
||||||
|
// Created time
|
||||||
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
|
||||||
|
// ID of the user who created the network
|
||||||
|
CreatedBy string `json:"created_by"`
|
||||||
|
|
||||||
|
// Updated time
|
||||||
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
|
|
||||||
|
// ID of the user who last updated the network
|
||||||
|
UpdatedBy string `json:"updated_by"`
|
||||||
|
}
|
||||||
|
|
||||||
type DHCPv4Config struct {
|
type DHCPv4Config struct {
|
||||||
// DNS
|
// DNS
|
||||||
DNS []string `json:"dns"`
|
DNS []string `json:"dns"`
|
||||||
@@ -518,16 +624,19 @@ type EntityInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Status struct {
|
type Status struct {
|
||||||
// Common
|
// Operation status
|
||||||
Common string `json:"common"`
|
OperationStatus string `json:"operation_status"`
|
||||||
|
|
||||||
// Hypervisors status
|
// Hypervisors status
|
||||||
Hypervisors []HypervisorStatus `json:"hypervisors"`
|
Hypervisors []HypervisorStatus `json:"hypervisors"`
|
||||||
|
|
||||||
|
// Hypervisor status
|
||||||
|
HypervisorStatus string `json:"hypervisor_status"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type HypervisorStatus struct {
|
type HypervisorStatus struct {
|
||||||
// Status
|
// Operation status
|
||||||
Status string `json:"status"`
|
OperationStatus string `json:"operation_status"`
|
||||||
|
|
||||||
// Name of hypervisor
|
// Name of hypervisor
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ type UpdateRequest struct {
|
|||||||
|
|
||||||
// VLAN tag identifier
|
// VLAN tag identifier
|
||||||
// Required: false
|
// Required: false
|
||||||
VLANTag string `url:"vlan_tag,omitempty" json:"vlan_tag,omitempty" validate:"omitempty,trunkTags"`
|
VLANTag uint64 `url:"vlan_tag,omitempty" json:"vlan_tag,omitempty" validate:"omitempty,min=1,max=4094"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update updated an external network
|
// Update updated an external network
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package hypervisors
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||||
@@ -17,27 +17,21 @@ type DeleteRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete a hypervisor
|
// Delete a hypervisor
|
||||||
func (hv Hypervisors) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
func (hv Hypervisors) Delete(ctx context.Context, req DeleteRequest) (*RecordVersion, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
url := "/sdn/hypervisor/delete"
|
url := "/sdn/hypervisor/delete"
|
||||||
|
|
||||||
res, err := hv.client.DecortApiCallCtype(ctx, http.MethodDelete, url, constants.MIMEJSON, req)
|
res, err := hv.client.DecortApiCallCtype(ctx, http.MethodDelete, url, constants.MIMEJSON, req)
|
||||||
|
info := RecordVersion{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if string(res) == "" {
|
return &info, nil
|
||||||
return true, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err := strconv.ParseBool(string(res))
|
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return result, nil
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
package hypervisors
|
package hypervisors
|
||||||
|
|
||||||
|
// Information about a version
|
||||||
|
type RecordVersion struct {
|
||||||
|
// Version ID
|
||||||
|
VersionID uint64 `json:"version_id"`
|
||||||
|
}
|
||||||
|
|
||||||
// Main information about hypervisor
|
// Main information about hypervisor
|
||||||
type RecordHypervisor struct {
|
type RecordHypervisor struct {
|
||||||
// Created at
|
// Created at
|
||||||
|
|||||||
@@ -55,34 +55,35 @@ type CreateRequest struct {
|
|||||||
|
|
||||||
// Logical port addresses
|
// Logical port addresses
|
||||||
// Required: false
|
// Required: false
|
||||||
LogicalPortAddresses []LogicalPortAddress `url:"logical_port_addresses,omitempty" json:"logical_port_addresses,omitempty" validate:"dive"`
|
LogicalPortAddresses []LogicalPortAddressRequest `url:"logical_port_addresses,omitempty" json:"logical_port_addresses,omitempty" validate:"dive"`
|
||||||
|
|
||||||
// Labels
|
// Labels
|
||||||
// Required: false
|
// Required: false
|
||||||
Labels CreateLabels `url:"labels,omitempty" json:"labels,omitempty"`
|
Labels *CreateLabels `url:"labels,omitempty" json:"labels"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// LogicalPortAddressRequest struct representing logical port address
|
// LogicalPortAddressRequest struct representing logical port address
|
||||||
type LogicalPortAddressRequest struct {
|
type LogicalPortAddressRequest struct {
|
||||||
// IP address
|
// IP address. IPv4 or IPv6 address of the logical port
|
||||||
|
// If nil (allowed only when IsPrimary is true), the system will automatically generate a valid address
|
||||||
// Required: true
|
// Required: true
|
||||||
IP string `url:"ip" json:"ip" validate:"required"`
|
IP interface{} `url:"ip" json:"ip" validate:"omitempty,isString"`
|
||||||
|
|
||||||
// IP type
|
// IP type
|
||||||
// Required: true
|
// Required: true
|
||||||
IPType string `url:"ip_type" json:"ip_type" validate:"required,oneof=IPv4 IPv6"`
|
IPType string `url:"ip_type" json:"ip_type" validate:"required,oneof=IPv4 IPv6"`
|
||||||
|
|
||||||
// Is primary. True or False
|
// Is primary
|
||||||
// Required: true
|
// Required: true
|
||||||
IsPrimary interface{} `url:"is_primary" json:"is_primary" validate:"required,isBool"`
|
IsPrimary interface{} `url:"is_primary" json:"is_primary" validate:"required,isBool"`
|
||||||
|
|
||||||
|
// Is discovered
|
||||||
|
// Required: true
|
||||||
|
IsDiscovered interface{} `url:"is_discovered" json:"is_discovered" validate:"required,isBool"`
|
||||||
|
|
||||||
// MAC address
|
// MAC address
|
||||||
// Required: false
|
// Required: false
|
||||||
MAC string `url:"mac,omitempty" json:"mac,omitempty"`
|
MAC string `url:"mac,omitempty" json:"mac,omitempty"`
|
||||||
|
|
||||||
// Is discovered. True or False
|
|
||||||
// Required: true
|
|
||||||
IsDiscovered bool `url:"is_discovered" json:"is_discovered" validate:"required"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create creates a logical port
|
// Create creates a logical port
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ type LogicalPort struct {
|
|||||||
// Enabled
|
// Enabled
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
|
|
||||||
|
// Exclude firewall information
|
||||||
|
ExcludeFirewall ExcludeFirewall `json:"exclude_firewall"`
|
||||||
|
|
||||||
// External network ID
|
// External network ID
|
||||||
ExternalNetworkID string `json:"external_network_id"`
|
ExternalNetworkID string `json:"external_network_id"`
|
||||||
|
|
||||||
@@ -162,6 +165,18 @@ type MigrationStatus struct {
|
|||||||
VersionID uint64 `json:"version_id"`
|
VersionID uint64 `json:"version_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ExcludeFirewall information
|
||||||
|
type ExcludeFirewall struct {
|
||||||
|
// Exclusion reason
|
||||||
|
ExclusionReason string `json:"exclusion_reason"`
|
||||||
|
|
||||||
|
// Whether logical port addresses are excluded from firewall
|
||||||
|
LogicalPortAddressesExcluded bool `json:"logical_port_addresses_excluded"`
|
||||||
|
|
||||||
|
// Whether logical port is excluded from firewall
|
||||||
|
LogicalPortExcluded bool `json:"logical_port_excluded"`
|
||||||
|
}
|
||||||
|
|
||||||
// Labels information
|
// Labels information
|
||||||
type Labels struct {
|
type Labels struct {
|
||||||
// VM ID
|
// VM ID
|
||||||
|
|||||||
Loaded 100 of 115 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user