Compare commits

..
9 Commits
Author SHA1 Message Date
aafetisov b6185a95ea v14.15.0 2026-10-16 15:58:41 +03:00
arsvolkov faa9487e03 v14.14.0 2026-09-28 15:16:21 +04:00
arsvolkov f61319c21b v14.13.0 2026-07-31 16:47:20 +04:00
arsvolkov fe413c7182 v14.12.0 2026-07-17 16:55:08 +04:00
dayterr 3e2edf53a5 v14.11.0 2026-05-29 17:54:28 +03:00
aafetisov 8f8a81eea4 v14.10.0 2026-05-22 19:20:44 +03:00
dayterr d82ae52951 v14.9.0 2026-05-08 14:18:23 +03:00
dayterr 5e5d90e24f v14.8.0 2026-04-17 17:10:10 +03:00
dayterr cd67633a52 v14.7.0 2026-04-10 16:47:00 +03:00
111 changed files with 2535 additions and 617 deletions

No files matched your search

+7 -67
View File
@@ -1,4 +1,4 @@
## Version 14.6.0 ## Version 14.15.0
Методы `Audits` в cloudapi/compute, cloudbroker/compute, cloudapi/account, cloudbroker/account, cloudapi/vins, cloudbroker/vins, cloudapi/rg и cloudbroker/rg стали deprecated и в следующих версиях будут удалены, вместо них необходимо использовать метод `List` в cloudapi/audit и cloudbroker/audit с соответствующими фильтрами Методы `Audits` в cloudapi/compute, cloudbroker/compute, cloudapi/account, cloudbroker/account, cloudapi/vins, cloudbroker/vins, cloudapi/rg и cloudbroker/rg стали deprecated и в следующих версиях будут удалены, вместо них необходимо использовать метод `List` в cloudapi/audit и cloudbroker/audit с соответствующими фильтрами
Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke`, `AccessRevokeToPool` в cloudbroker/sep стали deprecated и в следующих версиях будут удалены Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke`, `AccessRevokeToPool` в cloudbroker/sep стали deprecated и в следующих версиях будут удалены
@@ -7,71 +7,11 @@
Все методы группы `.SDN()` находятся в альфа-версии. Все методы группы `.SDN()` находятся в альфа-версии.
### Добавлено
#### extnet
| Идентификатор<br>задачи | Описание | ### Исправлено
#### client sdk
| Идентификатор задачи | Описание |
| --- | --- | | --- | --- |
| BGOS-825 | Опциональное поле `EnableSecGroups` в структуру запроса `CreateRequest` в cloudbroker/extnet | | BGOS-1135 | Исправлена ошибка в сообщении об ошибке при отсутствии времени истечения токена в клиенте |
#### grid
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-828 | Вычисляемое поле `ZeroAccessEnabled` в структуру ответа `ItemLocation` в cloudbroker/grid |
#### dpdknet
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-825 | Опциональное поле `EnableSecGroups` в структуру запроса `CreateRequest` в cloudbroker/dpdknet |
### sep
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-832 | Метод `AddPoolAsync` в cloudbroker/sep |
#### vins
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-825 | Опциональное поле `EnableSecGroups` в структуру запроса `CreateInAccountRequest` в cloudbroker/vins и cloudapi/vins |
| BGOS-825 | Опциональное поле `EnableSecGroups` в структуру запроса `CreateInRGRequest` в cloudbroker/vins и cloudapi/vins |
### Изменено
#### compute
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-827 | Описание поля `EnableSecGroups` в структуре запроса `NetAttachRequest` в cloudapi/compute и в cloudbroker/compute |
#### kvmx86
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-827 | Описание поля `EnableSecGroups` в структуре `Interface` в структуре запроса `CreateRequest` и `CreateBlankRequest` в cloudapi/kvmx86 и в cloudbroker/kvmx86 |
| BGOS-827 | Описание поля `EnableSecGroups` в структуре `InterfaceMassCreate` в структурах запроса `MassCreateRequest` в cloudbroker/kvmx86 |
#### lb
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-830 | Тип ответа метода `HighlyAvailable` в cloudapi/lb с uint64 на bool |
#### sep
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-834 | Тип ответа метода `DelConsumerNodes` с bool на interface в cloudbroker/sep |
#### sep
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-833 | Тип ответа метода `ConfigFieldEdit` с bool на структуру `RecordConfigFieldEdit` в cloudbroker/sep |
### Удалено
#### grid
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-826 | Структура запроса `AddRequest` и метод `Add` в cloudbroker/grid |
#### sep
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-832 | Опциональное поле `Sync` из структуры запроса `AddPoolRequest` в cloudbroker/sep |
+16 -4
View File
@@ -123,6 +123,8 @@ go get -u repository.basistech.ru/BASIS/dynamix-golang-sdk/v14
- `Trunk` - получение информации о транковых портах; - `Trunk` - получение информации о транковых портах;
- `VFPool` - управление пулом виртуальных сетевых функций; - `VFPool` - управление пулом виртуальных сетевых функций;
- `VINS` - управление виртуальными изолированными сетями; - `VINS` - управление виртуальными изолированными сетями;
- `VGPU` - управление виртуальными графическими процессорами;
- `VMFolder` – управление директориями ВМ;
- `Zone` - управление зонами. - `Zone` - управление зонами.
### Cloudbroker ### Cloudbroker
@@ -151,7 +153,6 @@ go get -u repository.basistech.ru/BASIS/dynamix-golang-sdk/v14
- `PCIDevice` - управление устройствами; - `PCIDevice` - управление устройствами;
- `Prometheus` - получение статистики prometheus; - `Prometheus` - получение статистики prometheus;
- `Resmon` - получение статистики resource monitoring; - `Resmon` - получение статистики resource monitoring;
- `ResourceOptimizer` - управление инструментом оптимизации ресурсов (DRS);
- `RG` - управление ресурсными группами аккаунта; - `RG` - управление ресурсными группами аккаунта;
- `Security group` – управление группами безопасности; - `Security group` – управление группами безопасности;
- `SEP` - управление storage endpoint (sep); - `SEP` - управление storage endpoint (sep);
@@ -161,7 +162,8 @@ go get -u repository.basistech.ru/BASIS/dynamix-golang-sdk/v14
- `User` - управление пользователями (индивидуально); - `User` - управление пользователями (индивидуально);
- `VGPU` - управление виртуальными графическими процессорами; - `VGPU` - управление виртуальными графическими процессорами;
- `VFPool` - управление пулом виртуальных сетевых функций; - `VFPool` - управление пулом виртуальных сетевых функций;
- `VINS` - управление виртуальными изолированными сетями. - `VINS` - управление виртуальными изолированными сетями;
- `VMFolder` – управление директориями ВМ;
- `Zone` - управление зонами. - `Zone` - управление зонами.
### SDN ### SDN
@@ -173,12 +175,14 @@ go get -u repository.basistech.ru/BASIS/dynamix-golang-sdk/v14
- `Address pool` - управление пулами адресов; - `Address pool` - управление пулами адресов;
- `DefaultSecurityPolicies` - управление политиками хранения по умолчанию; - `DefaultSecurityPolicies` - управление политиками хранения по умолчанию;
- `ExtNet` - управление виртуальными сетями, отвечающими за внешний доступ; - `ExtNet` - управление виртуальными сетями, отвечающими за внешний доступ;
- `Hypervisors` - управление гипервизорами;
- `FloatingIPs` - управление плавающими IP-адресами; - `FloatingIPs` - управление плавающими IP-адресами;
- `Logical ports` - управление логическими портами; - `Logical ports` - управление логическими портами;
- `NetworkObjectGroups` - управление группами объектов сети; - `NetworkObjectGroups` - управление группами объектов сети;
- `Routers` - управление роутерами; - `Routers` - управление роутерами;
- `SecurityPolicies` - управление политиками хранения; - `SecurityPolicies` - управление политиками хранения;
- `Segments` - управление сегментами; - `Segments` - управление сегментами;
- `Version` - получение информации о версии SDN;
## Работа с библиотекой ## Работа с библиотекой
@@ -334,6 +338,8 @@ func main() {
- `pkg/cloudapi/trunk` - для `Trunk` - `pkg/cloudapi/trunk` - для `Trunk`
- `pkg/cloudapi/vfpool` - для `VFPool` - `pkg/cloudapi/vfpool` - для `VFPool`
- `pkg/cloudapi/vins` - для `VINS` - `pkg/cloudapi/vins` - для `VINS`
- `pkg/cloudapi/vgpu` - для `VGPU`
- `pkg/cloudapi/vmfolder` - для `VMFolder`
- `pkg/cloudapi/zone` - для `Zone` - `pkg/cloudapi/zone` - для `Zone`
- **cloudbroker**: - **cloudbroker**:
- `pkg/cloudbroker/account` - для `Account` - `pkg/cloudbroker/account` - для `Account`
@@ -357,7 +363,6 @@ func main() {
- `pkg/cloudbroker/pcidevice` - для `PCIDevice` - `pkg/cloudbroker/pcidevice` - для `PCIDevice`
- `pkg/cloudbroker/prometheus` - для `Prometheus` - `pkg/cloudbroker/prometheus` - для `Prometheus`
- `pkg/cloudbroker/resmon` - для `Resmon` - `pkg/cloudbroker/resmon` - для `Resmon`
- `pkg/cloudbroker/resource_optimizer` - для `ResourceOptimizer`
- `pkg/cloudbroker/rg` - для `RG` - `pkg/cloudbroker/rg` - для `RG`
- `pkg/cloudbroker/secgroup` - для `Security group` - `pkg/cloudbroker/secgroup` - для `Security group`
- `pkg/cloudbroker/sep` - для `SEP` - `pkg/cloudbroker/sep` - для `SEP`
@@ -368,18 +373,21 @@ 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`
- `pkg/sdn/adrspools` - для `Address pool` - `pkg/sdn/adrspools` - для `Address pool`
- `pkg/sdn/defsecpolicies` - для `DefaultSecurityPolicies` - `pkg/sdn/defsecpolicies` - для `DefaultSecurityPolicies`
- `pkg/sdn/external_networks` - для `ExtNet` - `pkg/sdn/external_networks` - для `ExtNet`
- `pkg/sdn/hypervisors` - для `Hypervisors`
- `pkg/sdn/flips` - для `FloatingIPs` - `pkg/sdn/flips` - для `FloatingIPs`
- `pkg/sdn/logicalports` - для `Logical ports` - `pkg/sdn/logicalports` - для `Logical ports`
- `pkg/sdn/netobjgroups` - для `NetworkObjectGroups` - `pkg/sdn/netobjgroups` - для `NetworkObjectGroups`
- `pkg/sdn/routers` - для `Routers` - `pkg/sdn/routers` - для `Routers`
- `pkg/sdn/secpolicies` - для `SecurityPolicies` - `pkg/sdn/secpolicies` - для `SecurityPolicies`
- `pkg/sdn/segments` - для `Segments` - `pkg/sdn/segments` - для `Segments`
- `pkg/sdn/version` - для `Version`
Все поля структуры имеют описание, в которых содержится: Все поля структуры имеют описание, в которых содержится:
@@ -531,6 +539,8 @@ func main() {
- `.Trunk()` - для работы с `Trunk` - `.Trunk()` - для работы с `Trunk`
- `.VFPool()` - для работы с `VFPool` - `.VFPool()` - для работы с `VFPool`
- `.VINS()` - для работы с `VINS` - `.VINS()` - для работы с `VINS`
- `.VGPU()` - для работы с `VGPU`
- `.VMFolder()` - для работы с `VMFolder`
- `.Zone()` - для работы с `Zone` - `.Zone()` - для работы с `Zone`
Доступные методы для `.CloudBroker()`: Доступные методы для `.CloudBroker()`:
@@ -556,7 +566,6 @@ func main() {
- `.PCIDevice()` - для работы с `PCIDevice` - `.PCIDevice()` - для работы с `PCIDevice`
- `.Prometheus()` - для работы с `Prometheus` - `.Prometheus()` - для работы с `Prometheus`
- `.Resmon()` - для работы с `Resmon` - `.Resmon()` - для работы с `Resmon`
- `.ResourceOptimizer()` - для работы с `ResourceOptimizer`
- `.RG()` - для работы с `RG` - `.RG()` - для работы с `RG`
- `.SecurityGroup()` - для работы с `Security Group` - `.SecurityGroup()` - для работы с `Security Group`
- `.SEP()` - для работы с `SEP` - `.SEP()` - для работы с `SEP`
@@ -567,6 +576,7 @@ func main() {
- `.VGPU()` - для работы с `VGPU` - `.VGPU()` - для работы с `VGPU`
- `.VFPool()` - для работы с `VFPool` - `.VFPool()` - для работы с `VFPool`
- `.VINS()` - для работы с `VINS` - `.VINS()` - для работы с `VINS`
- `.VMFolder()` - для работы с `VMFolder`
- `.Zone()` - для работы с `Zone` - `.Zone()` - для работы с `Zone`
Доступные методы для `.SDN()`: Доступные методы для `.SDN()`:
@@ -575,12 +585,14 @@ func main() {
- `.AddressPool()` - для работы с `Addres pool` - `.AddressPool()` - для работы с `Addres pool`
- `.DefaultSecurityPolicies()` - для работы с `DefaultSecurityPolicies` - `.DefaultSecurityPolicies()` - для работы с `DefaultSecurityPolicies`
- `.ExtNet()` - для работы с `ExtNet` - `.ExtNet()` - для работы с `ExtNet`
- `.Hypervisors()` - для работы с `Hypervisors`
- `.FloatingIPs()` - для работы с `FloatingIPs` - `.FloatingIPs()` - для работы с `FloatingIPs`
- `.LogicalPorts()` - для работы с `Logical ports` - `.LogicalPorts()` - для работы с `Logical ports`
- `.NetworkObjectGroups()` - для работы с `NetworkObjectGroups` - `.NetworkObjectGroups()` - для работы с `NetworkObjectGroups`
- `.Routers()` - для работы с `Routers` - `.Routers()` - для работы с `Routers`
- `.SecurityPolicies()` - для работы с `SecurityPolicies` - `.SecurityPolicies()` - для работы с `SecurityPolicies`
- `.Segments()` - для работы с `Segments` - `.Segments()` - для работы с `Segments`
- `.Version()` - для работы с `Version`
3. Вызвать метод, отвечающий за выполнение запроса и передать в него: 3. Вызвать метод, отвечающий за выполнение запроса и передать в него:
+1 -1
View File
@@ -440,7 +440,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)
+4
View File
@@ -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()
+1
View File
@@ -2,6 +2,7 @@ package validators
import ( import (
"errors" "errors"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/multierror" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/multierror"
"github.com/go-playground/validator/v10" "github.com/go-playground/validator/v10"
+2
View File
@@ -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",
+5
View File
@@ -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
+1
View File
@@ -4,6 +4,7 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
+1
View File
@@ -4,6 +4,7 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
+2 -1
View File
@@ -3,8 +3,9 @@ package compute
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// ChangeLinkStateRequest struct to change link state // ChangeLinkStateRequest struct to change link state
+8
View File
@@ -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"`
+6
View File
@@ -551,6 +551,9 @@ type RecordCompute struct {
// Zone ID // Zone ID
// Required: false // Required: false
ZoneID uint64 `json:"zoneId"` ZoneID uint64 `json:"zoneId"`
// Folder ID
FolderID uint64 `json:"folder_id"`
} }
type LoaderMetaIso struct { type LoaderMetaIso struct {
// Name // Name
@@ -1249,6 +1252,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
+1 -1
View File
@@ -15,7 +15,7 @@ type RedeployRequest struct {
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
// Storage policy id of compute. The rules of the specified storage policy will be used. // Storage policy id of compute. The rules of the specified storage policy will be used.
// Required: true // Required: false
StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"` StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"`
// ID of the new OS image, if image change is required // ID of the new OS image, if image change is required
+6
View File
@@ -37,6 +37,12 @@ type ItemLocation struct {
// Is Zero Access enabled // Is Zero Access enabled
ZeroAccessEnabled bool `json:"zeroaccess_enabled"` ZeroAccessEnabled bool `json:"zeroaccess_enabled"`
// Is BRO enabled
BROEnabled bool `json:"bro_enabled"`
// Are VM Folders enabled
VMFoldersEnabled bool `json:"vm_folders_enabled"`
} }
// List of locations // List of locations
+1
View File
@@ -2,6 +2,7 @@ package pcidevice
import ( import (
"encoding/json" "encoding/json"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/serialization" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/serialization"
) )
+8
View File
@@ -0,0 +1,8 @@
package cloudapi
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/pkg/cloudapi/vgpu"
// Accessing the VGPU method group
func (ca *CloudAPI) VGPU() *vgpu.VGPU {
return vgpu.New(ca.client)
}
+10
View File
@@ -0,0 +1,10 @@
package vgpu
// IDs gets array of VGPU IDs from ListVGPU struct
func (l ListVGPU) IDs() []uint64 {
res := make([]uint64, 0, len(l.Data))
for _, v := range l.Data {
res = append(res, v.ID)
}
return res
}
+88
View File
@@ -0,0 +1,88 @@
package vgpu
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// ListRequest struct to get list of VGPU
type ListRequest struct {
// Find by id
// Required: false
ByID uint64 `url:"by_id,omitempty" json:"by_id,omitempty"`
// Find by vgpu status
// Required: false
Status string `url:"status,omitempty" json:"status,omitempty"`
// Find by vgpu type
// Required: false
Type string `url:"type,omitempty" json:"type,omitempty"`
// Find by vgpu mode
// Required: false
Mode string `url:"mode,omitempty" json:"mode,omitempty"`
// Find by id resgroup
// Required: false
RGID uint64 `url:"rgId,omitempty" json:"rgId,omitempty"`
// Find by account id
// Required: false
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
// Find by compute id
// Required: false
ComputeID uint64 `url:"computeId,omitempty" json:"computeId,omitempty"`
// Find by pgpu id
// Required: false
PGPUID uint64 `url:"pgpuId,omitempty" json:"pgpuId,omitempty"`
// Sort by one of supported fields, format +|-(field)
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
// Page size
// Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of all VGPU as a ListVGPU struct
func (v VGPU) List(ctx context.Context, req ListRequest) (*ListVGPU, error) {
res, err := v.ListRaw(ctx, req)
if err != nil {
return nil, err
}
list := ListVGPU{}
err = json.Unmarshal(res, &list)
if err != nil {
return nil, err
}
return &list, nil
}
// ListRaw gets list of all VGPU as an array of bytes
func (v VGPU) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/vgpu/list"
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
return res, err
}
+69
View File
@@ -0,0 +1,69 @@
package vgpu
type ItemVGPU struct {
// Account ID
AccountID uint64 `json:"accountId"`
// Created time
CreatedTime uint64 `json:"createdTime"`
// Deleted time
DeletedTime uint64 `json:"deletedTime"`
//Grid ID
GID uint64 `json:"gid"`
// GUID
GUID uint64 `json:"guid"`
// VGPU ID
ID uint64 `json:"id"`
// Last claimed by
LastClaimedBy uint64 `json:"lastClaimedBy"`
// Last update time
LastUpdateTime uint64 `json:"lastUpdateTime"`
// Mode
Mode string `json:"mode"`
// Bus number
BusNumber int `json:"bus_number"`
// PCI Slot
PCISlot int `json:"pciSlot"`
// PGPUID
PGPUID uint64 `json:"pgpuid"`
// Profile ID
ProfileID uint64 `json:"profileId"`
// RAM
RAM uint64 `json:"ram"`
// Reference ID
ReferenceID string `json:"referenceId"`
// RGID
RGID uint64 `json:"rgId"`
// Status
Status string `json:"status"`
// Type
Type string `json:"type"`
// VMID
VMID uint64 `json:"vmid"`
}
// List of VGPU
type ListVGPU struct {
// Data
Data []ItemVGPU `json:"data"`
// Entry count
EntryCount uint64 `json:"entryCount"`
}
+43
View File
@@ -0,0 +1,43 @@
package vgpu
import (
"encoding/json"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/serialization"
)
// Serialize returns JSON-serialized []byte. Used as a wrapper over json.Marshal and json.MarshalIndent functions.
//
// In order to serialize with indent make sure to follow these guidelines:
// - First argument -> prefix
// - Second argument -> indent
func (l ListVGPU) Serialize(params ...string) (serialization.Serialized, error) {
if len(l.Data) == 0 {
return []byte{}, nil
}
if len(params) > 1 {
prefix := params[0]
indent := params[1]
return json.MarshalIndent(l, prefix, indent)
}
return json.Marshal(l)
}
// Serialize returns JSON-serialized []byte. Used as a wrapper over json.Marshal and json.MarshalIndent functions.
//
// In order to serialize with indent make sure to follow these guidelines:
// - First argument -> prefix
// - Second argument -> indent
func (i ItemVGPU) Serialize(params ...string) (serialization.Serialized, error) {
if len(params) > 1 {
prefix := params[0]
indent := params[1]
return json.MarshalIndent(i, prefix, indent)
}
return json.Marshal(i)
}
+15
View File
@@ -0,0 +1,15 @@
package vgpu
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/interfaces"
// Structure for creating request to VGPU
type VGPU struct {
client interfaces.Caller
}
// Builder for VGPU endpoints
func New(client interfaces.Caller) *VGPU {
return &VGPU{
client: client,
}
}
+10
View File
@@ -0,0 +1,10 @@
package cloudapi
import (
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/pkg/cloudapi/vmfolder"
)
// Accessing the VMFolder method group
func (ca *CloudAPI) VMFolder() *vmfolder.VMFolder {
return vmfolder.New(ca.client)
}
+47
View File
@@ -0,0 +1,47 @@
package vmfolder
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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
}
+43
View File
@@ -0,0 +1,43 @@
package vmfolder
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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
}
+47
View File
@@ -0,0 +1,47 @@
package vmfolder
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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
}
+43
View File
@@ -0,0 +1,43 @@
package vmfolder
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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
}
+39
View File
@@ -0,0 +1,39 @@
package vmfolder
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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
}
+47
View File
@@ -0,0 +1,47 @@
package vmfolder
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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
}
+56
View File
@@ -0,0 +1,56 @@
package vmfolder
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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
}
+79
View File
@@ -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"`
}
+43
View File
@@ -0,0 +1,43 @@
package vmfolder
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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
}
+43
View File
@@ -0,0 +1,43 @@
package vmfolder
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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
}
+17
View File
@@ -0,0 +1,17 @@
package vmfolder
import (
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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,
}
}
+30
View File
@@ -81,6 +81,21 @@ type RecordZone struct {
// SSO URL // SSO URL
SSOURL string `json:"sso_url"` SSOURL string `json:"sso_url"`
// SSO type
SSOType string `json:"sso_type"`
// Ping address
PingAddr string `json:"ping_addr"`
// Broadcast address
BroadcastAddr string `json:"broadcast_addr"`
// Skip ssl verify
SSLSkipVerify bool `json:"ssl_skip_verify"`
// Domain
Domain string `json:"domain"`
} }
// A zone item from a list // A zone item from a list
@@ -130,9 +145,24 @@ type ItemZone struct {
// SSO URL // SSO URL
SSOURL string `json:"sso_url"` SSOURL string `json:"sso_url"`
// SSO type
SSOType string `json:"sso_type"`
// Status // Status
Status string `json:"status"` Status string `json:"status"`
// Updated timestamp // Updated timestamp
UpdatedTime uint64 `json:"updatedTime"` UpdatedTime uint64 `json:"updatedTime"`
// Ping address
PingAddr string `json:"ping_addr"`
// Broadcast address
BroadcastAddr string `json:"broadcast_addr"`
// Skip ssl verify
SSLSkipVerify bool `json:"ssl_skip_verify"`
// Domain
Domain string `json:"domain"`
} }
@@ -3,8 +3,9 @@ package account
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter // SetCPUAllocationParameterRequest struct for setting CPU allocation parameter
+9 -7
View File
@@ -2,8 +2,8 @@ package apiaccess
import ( import (
"context" "context"
"encoding/json"
"net/http" "net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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
} }
+73 -30
View File
@@ -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"`
+9 -8
View File
@@ -4,7 +4,6 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"net/http" "net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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
} }
+2 -1
View File
@@ -3,8 +3,9 @@ package compute
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// ChangeLinkStateRequest struct for changing link state // ChangeLinkStateRequest struct for changing link state
+8
View File
@@ -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"`
+6
View File
@@ -902,6 +902,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 {
@@ -1195,6 +1198,9 @@ type RecordCompute struct {
//todo //todo
_ uint64 `json:"nodeId"` _ uint64 `json:"nodeId"`
// Folder ID
FolderID uint64 `json:"folder_id"`
} }
type LoaderMetaIso struct { type LoaderMetaIso struct {
+1 -1
View File
@@ -23,7 +23,7 @@ type RedeployRequest struct {
OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"` OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"`
// Storage policy id of compute. The rules of the specified storage policy will be used. // Storage policy id of compute. The rules of the specified storage policy will be used.
// Required: true // Required: false
StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"` StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"`
// New size for the boot disk in GB, if boot disk size change is required // New size for the boot disk in GB, if boot disk size change is required
+2 -1
View File
@@ -3,8 +3,9 @@ package disks
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// DepresentRequest struct to depresent disk from node // DepresentRequest struct to depresent disk from node
+2 -1
View File
@@ -3,8 +3,9 @@ package disks
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// PresentRequest struct to present disk to node // PresentRequest struct to present disk to node
+12
View File
@@ -96,6 +96,12 @@ type RecordGrid struct {
// SDN support // SDN support
SDNSupport bool `json:"sdn_support"` SDNSupport bool `json:"sdn_support"`
// Is BRO enabled
BROEnabled bool `json:"bro_enabled"`
// Whether VM folders are enabled
VMFoldersEnabled bool `json:"vm_folders_enabled"`
} }
// Information about grid // Information about grid
@@ -132,6 +138,12 @@ type ItemGridList struct {
// Is Zero Access enabled // Is Zero Access enabled
ZeroAccessEnabled bool `json:"zeroaccess_enabled"` ZeroAccessEnabled bool `json:"zeroaccess_enabled"`
// Is BRO enabled
BROEnabled bool `json:"bro_enabled"`
// Whether VM folders are enabled
VMFoldersEnabled bool `json:"vm_folders_enabled"`
} }
// List Grids // List Grids
@@ -3,8 +3,9 @@ package grid
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// SetCPUAllocationParameterRequest for setting CPU allocation parameter // SetCPUAllocationParameterRequest for setting CPU allocation parameter
@@ -3,8 +3,9 @@ package grid
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// SetCPUAllocationRatioForVMRequest for setting CPU allocation ratio for computes // SetCPUAllocationRatioForVMRequest for setting CPU allocation ratio for computes
+2 -1
View File
@@ -3,8 +3,9 @@ package pcidevice
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// DeleteRequest struct to deleting PCI device // DeleteRequest struct to deleting PCI device
+2 -1
View File
@@ -3,8 +3,9 @@ package pcidevice
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// DisableRequest struct for disabling PCI device // DisableRequest struct for disabling PCI device
+2 -1
View File
@@ -3,8 +3,9 @@ package pcidevice
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// EnableRequest struct for enabling PCI device // EnableRequest struct for enabling PCI device
+1
View File
@@ -2,6 +2,7 @@ package pcidevice
import ( import (
"encoding/json" "encoding/json"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/serialization" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/serialization"
) )
-10
View File
@@ -1,10 +0,0 @@
package cloudbroker
import (
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/pkg/cloudbroker/resource_optimizer"
)
// Accessing the ResourceOptimizer method group
func (cb *CloudBroker) ResourceOptimizer() *resource_optimizer.ResourceOptimizer {
return resource_optimizer.New(cb.client)
}
@@ -1,42 +0,0 @@
package resource_optimizer
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// DRSAddNodesRequest struct to add nodes to DRS
type DRSAddNodesRequest struct {
// ID of the zone
// Required: true
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
// IDs of the nodes to add
// Required: true
NodeIDs []uint64 `url:"node_ids" json:"node_ids" validate:"required"`
}
// DRSAddNodes adds nodes to DRS in the specified zone
func (ro ResourceOptimizer) DRSAddNodes(ctx context.Context, req DRSAddNodesRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/resource_optimizer/drs_add_nodes"
res, err := ro.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
@@ -1,58 +0,0 @@
package resource_optimizer
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// DRSCreateRequest struct to create DRS
type DRSCreateRequest struct {
// ID of the zone
// Required: true
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
// Application ID
// Required: true
AppID string `url:"app_id" json:"app_id" validate:"required"`
// Application secret
// Required: true
AppSecret string `url:"app_secret" json:"app_secret" validate:"required"`
// Decort URL
// Required: true
DecortURL string `url:"decort_url" json:"decort_url" validate:"required"`
// SSO URL
// Required: true
SSOURL string `url:"sso_url" json:"sso_url" validate:"required"`
// DRS name
// Required: true
DRSName string `url:"drs_name" json:"drs_name" validate:"required"`
}
// DRSCreate creates a new DRS in the specified zone
func (ro ResourceOptimizer) DRSCreate(ctx context.Context, req DRSCreateRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/resource_optimizer/drs_create"
res, err := ro.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
@@ -1,42 +0,0 @@
package resource_optimizer
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// DRSDelNodesRequest struct to delete nodes from DRS
type DRSDelNodesRequest struct {
// ID of the zone
// Required: true
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
// IDs of the nodes to delete
// Required: true
NodeIDs []uint64 `url:"node_ids" json:"node_ids" validate:"required"`
}
// DRSDelNodes removes nodes from DRS in the specified zone
func (ro ResourceOptimizer) DRSDelNodes(ctx context.Context, req DRSDelNodesRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/resource_optimizer/drs_del_nodes"
res, err := ro.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
@@ -1,38 +0,0 @@
package resource_optimizer
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// DRSRemoveRequest struct to remove DRS
type DRSRemoveRequest struct {
// ID of the zone
// Required: true
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
}
// DRSRemove removes DRS from the specified zone
func (ro ResourceOptimizer) DRSRemove(ctx context.Context, req DRSRemoveRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/resource_optimizer/drs_remove"
res, err := ro.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
@@ -1,38 +0,0 @@
package resource_optimizer
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// DRSStartRequest struct to start DRS
type DRSStartRequest struct {
// ID of the zone
// Required: true
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
}
// DRSStart starts DRS in the specified zone
func (ro ResourceOptimizer) DRSStart(ctx context.Context, req DRSStartRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/resource_optimizer/drs_start"
res, err := ro.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
@@ -1,38 +0,0 @@
package resource_optimizer
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// DRSStopRequest struct to stop DRS
type DRSStopRequest struct {
// ID of the zone
// Required: true
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
}
// DRSStop stops DRS in the specified zone
func (ro ResourceOptimizer) DRSStop(ctx context.Context, req DRSStopRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/resource_optimizer/drs_stop"
res, err := ro.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
@@ -1,58 +0,0 @@
package resource_optimizer
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// DRSUpdateRequest struct to update DRS
type DRSUpdateRequest struct {
// ID of the zone
// Required: true
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
// Application ID
// Required: false
AppID string `url:"app_id,omitempty" json:"app_id,omitempty"`
// Application secret
// Required: false
AppSecret string `url:"app_secret,omitempty" json:"app_secret,omitempty"`
// Decort URL
// Required: false
DecortURL string `url:"decort_url,omitempty" json:"decort_url,omitempty"`
// SSO URL
// Required: false
SSOURL string `url:"sso_url,omitempty" json:"sso_url,omitempty"`
// DRS name
// Required: false
DRSName string `url:"drs_name,omitempty" json:"drs_name,omitempty"`
}
// DRSUpdate updates DRS configuration in the specified zone
func (ro ResourceOptimizer) DRSUpdate(ctx context.Context, req DRSUpdateRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/resource_optimizer/drs_update"
res, err := ro.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
@@ -1,16 +0,0 @@
// API Actor API for managing resource optimizer
package resource_optimizer
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/interfaces"
// Structure for creating request to resource_optimizer
type ResourceOptimizer struct {
client interfaces.Caller
}
// Builder for resource_optimizer endpoints
func New(client interfaces.Caller) *ResourceOptimizer {
return &ResourceOptimizer{
client: client,
}
}
@@ -3,8 +3,9 @@ package rg
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter // SetCPUAllocationParameterRequest struct for setting CPU allocation parameter
@@ -3,8 +3,9 @@ package rg
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// SetCPUAllocationRatioRequest struct for setting CPU allocation ratio // SetCPUAllocationRatioRequest struct for setting CPU allocation ratio
+8 -7
View File
@@ -2,8 +2,8 @@ package sep
import ( import (
"context" "context"
"encoding/json"
"net/http" "net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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
} }
+4 -10
View File
@@ -38,7 +38,7 @@ type UpdateRequest struct {
type wrapperUpdateRequest struct { type wrapperUpdateRequest struct {
UpdateRequest UpdateRequest
Config []string `url:"config,omitempty"` Config string `url:"config,omitempty"`
} }
// Update updates vfpool device // Update updates vfpool device
@@ -48,21 +48,15 @@ func (v VFPool) Update(ctx context.Context, req UpdateRequest) (bool, error) {
return false, validators.ValidationErrors(validators.GetErrors(err)) return false, validators.ValidationErrors(validators.GetErrors(err))
} }
var config []string var config string
if len(req.Config) != 0 { if len(req.Config) != 0 {
config = make([]string, 0, len(req.Config)) b, err := json.Marshal(req.Config)
for c := range req.Config {
b, err := json.Marshal(req.Config[c])
if err != nil { if err != nil {
return false, err return false, err
} }
config = append(config, string(b)) config = string(b)
}
} else {
config = []string{}
} }
reqWrapped := wrapperUpdateRequest{ reqWrapped := wrapperUpdateRequest{
+2 -1
View File
@@ -3,8 +3,9 @@ package vgpu
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// AllocateRequest struct for allocating VGPU // AllocateRequest struct for allocating VGPU
+2 -1
View File
@@ -3,8 +3,9 @@ package vgpu
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// CreateRequest struct for creating VGPU // CreateRequest struct for creating VGPU
+2 -1
View File
@@ -3,8 +3,9 @@ package vgpu
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// DeallocateRequest struct for deallocating VGPU // DeallocateRequest struct for deallocating VGPU
+2 -1
View File
@@ -3,8 +3,9 @@ package vgpu
import ( import (
"context" "context"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"strconv" "strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// DestroyRequest struct for destroying VGPU // DestroyRequest struct for destroying VGPU
+10
View File
@@ -0,0 +1,10 @@
package cloudbroker
import (
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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
}
+43
View File
@@ -0,0 +1,43 @@
package vmfolder
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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
}
+47
View File
@@ -0,0 +1,47 @@
package vmfolder
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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
}
+39
View File
@@ -0,0 +1,39 @@
package vmfolder
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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
}
+47
View File
@@ -0,0 +1,47 @@
package vmfolder
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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
}
+56
View File
@@ -0,0 +1,56 @@
package vmfolder
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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
}
+82
View File
@@ -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"`
}
+43
View File
@@ -0,0 +1,43 @@
package vmfolder
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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
}
+43
View File
@@ -0,0 +1,43 @@
package vmfolder
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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
}
+17
View File
@@ -0,0 +1,17 @@
package vmfolder
import (
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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,
}
}
+30
View File
@@ -81,6 +81,21 @@ type RecordZone struct {
// SSO URL // SSO URL
SSOURL string `json:"sso_url"` SSOURL string `json:"sso_url"`
// SSO type
SSOType string `json:"sso_type"`
// Ping address
PingAddr string `json:"ping_addr"`
// Broadcast address
BroadcastAddr string `json:"broadcast_addr"`
// Skip ssl verify
SSLSkipVerify bool `json:"ssl_skip_verify"`
// Domain
Domain string `json:"domain"`
} }
// A zone item from a list // A zone item from a list
@@ -130,9 +145,24 @@ type ItemZone struct {
// SSO URL // SSO URL
SSOURL string `json:"sso_url"` SSOURL string `json:"sso_url"`
// SSO type
SSOType string `json:"sso_type"`
// Status // Status
Status string `json:"status"` Status string `json:"status"`
// Updated timestamp // Updated timestamp
UpdatedTime uint64 `json:"updatedTime"` UpdatedTime uint64 `json:"updatedTime"`
// Ping address
PingAddr string `json:"ping_addr"`
// Broadcast address
BroadcastAddr string `json:"broadcast_addr"`
// Skip ssl verify
SSLSkipVerify bool `json:"ssl_skip_verify"`
// Domain
Domain string `json:"domain"`
} }
+5 -11
View File
@@ -3,7 +3,6 @@ package acsgroups
import ( import (
"context" "context"
"net/http" "net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
@@ -16,24 +15,19 @@ type DeleteRequest struct {
GroupID string `url:"access_group_id" json:"access_group_id" validate:"required"` GroupID string `url:"access_group_id" json:"access_group_id" validate:"required"`
} }
// Delete a access groups // Delete an access groups
func (i AccessGroups) Delete(ctx context.Context, req DeleteRequest) (bool, error) { func (i AccessGroups) Delete(ctx context.Context, req DeleteRequest) (string, error) {
err := validators.ValidateRequest(req) err := validators.ValidateRequest(req)
if err != nil { if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err)) return "", validators.ValidationErrors(validators.GetErrors(err))
} }
url := "/sdn/access_group/delete" url := "/sdn/access_group/delete"
res, err := i.client.DecortApiCallCtype(ctx, http.MethodDelete, url, constants.MIMEJSON, req) res, err := i.client.DecortApiCallCtype(ctx, http.MethodDelete, url, constants.MIMEJSON, req)
if err != nil { if err != nil {
return false, err return "", err
} }
result, err := strconv.ParseBool(string(res)) return string(res), nil
if err != nil {
return false, err
}
return result, nil
} }
-3
View File
@@ -11,21 +11,18 @@ var testAccessGroups = AccessGroupList{
DisplayName: "Developers", DisplayName: "Developers",
Comment: "First group", Comment: "First group",
CreatedAt: "2023-01-01", CreatedAt: "2023-01-01",
CreatedBy: "admin",
}, },
{ {
ID: "group2", ID: "group2",
DisplayName: "Admins", DisplayName: "Admins",
Comment: "Second group", Comment: "Second group",
CreatedAt: "2023-01-02", CreatedAt: "2023-01-02",
CreatedBy: "admin",
}, },
{ {
ID: "group3", ID: "group3",
DisplayName: "Users", DisplayName: "Users",
Comment: "Third group", Comment: "Third group",
CreatedAt: "2023-01-03", CreatedAt: "2023-01-03",
CreatedBy: "admin",
}, },
}, },
} }
-2
View File
@@ -15,9 +15,7 @@ type AccessGroup struct {
DisplayName string `json:"display_name"` DisplayName string `json:"display_name"`
Comment string `json:"comment"` Comment string `json:"comment"`
CreatedAt string `json:"created_at"` CreatedAt string `json:"created_at"`
CreatedBy string `json:"created_by"`
UpdatedAt string `json:"updated_at"` UpdatedAt string `json:"updated_at"`
UpdatedBy string `json:"updated_by"`
NetObjectAccessGroup NetObjectAccessGroup `json:"net_object_access_group"` NetObjectAccessGroup NetObjectAccessGroup `json:"net_object_access_group"`
DefaultSecurityPolicy DefaultSecurityPolicy `json:"default_security_policy"` DefaultSecurityPolicy DefaultSecurityPolicy `json:"default_security_policy"`
} }
+10
View File
@@ -0,0 +1,10 @@
package sdn
import (
hv "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/pkg/sdn/hypervisors"
)
// Accessing the SDN method group
func (sdn *SDN) Hypervisors() *hv.Hypervisors {
return hv.New(sdn.client)
}
+30
View File
@@ -0,0 +1,30 @@
package hypervisors
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// ConnectNodeRequest to connect a node
type ConnectNodeRequest struct {
// Node to connect
// Required: true
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
}
func (hv Hypervisors) ConnectNode(ctx context.Context, req ConnectNodeRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/sdn/hypervisor/connect_node"
result, err := hv.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return "", err
}
return string(result), nil
}
+43
View File
@@ -0,0 +1,43 @@
package hypervisors
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// DeleteRequest to delete a hypervisor
type DeleteRequest struct {
// Name of a hypervisor
// Required: true
Name string `url:"name" json:"name" validate:"required"`
}
// Delete a hypervisor
func (hv Hypervisors) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/sdn/hypervisor/delete"
res, err := hv.client.DecortApiCallCtype(ctx, http.MethodDelete, url, constants.MIMEJSON, req)
if err != nil {
return false, err
}
if string(res) == "" {
return true, nil
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
+50
View File
@@ -0,0 +1,50 @@
package hypervisors
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// GetRequest struct to get information about hypervisor
type GetRequest struct {
// Name
// Required: true
Name string `url:"name" json:"name" validate:"required"`
// Port info (available options: detailed, general)
// Required: false
PortInfo string `url:"port_info,omitempty" json:"port_info,omitempty"`
}
// Get gets current configuration of a hypervisor as a RecordHypervisor
func (hv Hypervisors) Get(ctx context.Context, req GetRequest) (*RecordHypervisor, error) {
res, err := hv.GetRaw(ctx, req)
if err != nil {
return nil, err
}
info := RecordHypervisor{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}
// GetRaw gets information about a hypervisor as an array of bytes
func (hv Hypervisors) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/sdn/hypervisor/get"
res, err := hv.client.DecortApiCall(ctx, http.MethodGet, url, req)
return res, err
}
+17
View File
@@ -0,0 +1,17 @@
package hypervisors
import (
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/interfaces"
)
// Structure for creating request to hypervisors
type Hypervisors struct {
client interfaces.Caller
}
// Builder for hypervisors endpoints
func New(client interfaces.Caller) *Hypervisors {
return &Hypervisors{
client,
}
}
+90
View File
@@ -0,0 +1,90 @@
package hypervisors
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// ListRequest struct to get a list of hypervisors
type ListRequest struct {
// Page
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
// Per page
// Required: false
PerPage uint64 `url:"per_page,omitempty" json:"per_page,omitempty"`
// Sort by (available options: name, hostname, last_sync, display_name, ip, created_at, updated_at)
// Required: false
SortBy string `url:"sort_by,omitempty" json:"sort_by,omitempty"`
// Sort order (available options: asc, desc)
// Required: false
SortOrder string `url:"sort_order,omitempty" json:"sort_order,omitempty"`
// Port info (available options: detailed, general)
// Required: false
PortInfo string `url:"port_info,omitempty" json:"port_info,omitempty"`
// Hostname
// Required: false
Hostname string `url:"hostname,omitempty" json:"hostname,omitempty"`
// Display name
// Required: false
DisplayName string `url:"display_name,omitempty" json:"display_name,omitempty"`
// IP
// Required: false
IP string `url:"ip,omitempty" json:"ip,omitempty"`
// Created from
// Required: false
CreatedFrom string `url:"created_from,omitempty" json:"created_from,omitempty"`
// Created to
// Required: false
CreatedTo string `url:"created_to,omitempty" json:"created_to,omitempty"`
// Updated from
// Required: false
UpdatedFrom string `url:"updated_from,omitempty" json:"updated_from,omitempty"`
// Updated to
// Required: false
UpdatedTo string `url:"updated_to,omitempty" json:"updated_to,omitempty"`
}
// List of hypervisors
func (hv Hypervisors) List(ctx context.Context, req ListRequest) (HypervisorsList, error) {
res, err := hv.ListRaw(ctx, req)
if err != nil {
return nil, err
}
hvs := HypervisorsList{}
err = json.Unmarshal(res, &hvs)
if err != nil {
return nil, err
}
return hvs, nil
}
// ListRaw gets a list of all hypervisors as an array of bytes
func (hv Hypervisors) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
if err := validators.ValidateRequest(req); err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/sdn/hypervisor/list"
res, err := hv.client.DecortApiCall(ctx, http.MethodGet, url, req)
return res, err
}
+58
View File
@@ -0,0 +1,58 @@
package hypervisors
// Main information about hypervisor
type RecordHypervisor struct {
// Created at
CreatedAt string `json:"created_at"`
// Display name
DisplayName string `json:"display_name"`
// Hostname
Hostname string `json:"hostname"`
// IP
IP string `json:"ip"`
// Synced at
SyncedAt string `json:"synced_at"`
// Name
Name string `json:"name"`
// Ports
Ports Ports `json:"ports"`
// Status
Status string `json:"status"`
}
// List of hypervisors
type HypervisorsList []RecordHypervisor
// Hypervisor ports
type Ports struct {
Data []Port `json:"data"`
Info Info `json:"info"`
}
// Info about a port
type Port struct {
// ID of a port
ID string `json:"id"`
// Unique ID of a port
UniqueIdentifier string `json:"unique_identifier"`
// Display name of a port
DisplayName string `json:"display_name"`
// Is a port up
UP bool `json:"up"`
}
// Port counters
type Info struct {
ActivePorts uint64 `json:"active_ports"`
TotalPorts uint64 `json:"total_ports"`
}
@@ -0,0 +1,50 @@
package hypervisors
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// UpdateDisplayNameRequest struct to update display name for a hypervisor
type UpdateDisplayNameRequest struct {
// Current name of the hypervisor
// Required: true
Name string `url:"name" json:"name" validate:"required"`
// New display name to set
// Required: true
DisplayName string `url:"display_name" json:"display_name" validate:"required"`
}
// UpdateDisplayName updates display name for a hypervisor
func (hv Hypervisors) UpdateDisplayName(ctx context.Context, req UpdateDisplayNameRequest) (*RecordHypervisor, error) {
res, err := hv.UpdateDisplayNameRaw(ctx, req)
if err != nil {
return nil, err
}
info := RecordHypervisor{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}
// UpdateDisplayNameRaw update display name for a hypervisor and get its information as an array of bytes
func (hv Hypervisors) UpdateDisplayNameRaw(ctx context.Context, req UpdateDisplayNameRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/sdn/hypervisor/update_display_name"
res, err := hv.client.DecortApiCall(ctx, http.MethodPut, url, req)
return res, err
}
+10 -9
View File
@@ -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: false
IsDiscovered interface{} `url:"is_discovered,omitempty" json:"is_discovered,omitempty" validate:"omitempty,isBool"`
} }
// Create creates a logical port // Create creates a logical port
+15
View File
@@ -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
+11 -7
View File
@@ -67,11 +67,15 @@ type UpdateRequest struct {
// Labels // Labels
// Required: false // Required: false
Labels UpdateLabels `url:"labels,omitempty" json:"labels,omitempty"` Labels *UpdateLabels `url:"labels,omitempty" json:"labels"`
} }
// UpdateAddress struct representing update address // UpdateAddress struct representing update address
type UpdateAddress struct { type UpdateAddress struct {
// ID of the address
// Required: true
ID string `url:"id" json:"id" validate:"required"`
// IP address // IP address
// Required: true // Required: true
IP string `url:"ip" json:"ip" validate:"required"` IP string `url:"ip" json:"ip" validate:"required"`
@@ -81,8 +85,8 @@ type UpdateAddress struct {
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 discovered. True or False // Is discovered. True or False
// Required: false // Required: true
IsDiscovered interface{} `url:"is_discovered,omitempty" json:"is_discovered,omitempty" validate:"omitempty,isBool"` IsDiscovered interface{} `url:"is_discovered" json:"is_discovered" validate:"required,isBool"`
// Is primary. True or False // Is primary. True or False
// Required: true // Required: true
@@ -103,11 +107,11 @@ type AddAddress struct {
// 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 discovered. True or False // Is discovered
// Required: false // Required: true
IsDiscovered interface{} `url:"is_discovered,omitempty" json:"is_discovered,omitempty" validate:"omitempty,isBool"` IsDiscovered interface{} `url:"is_discovered" json:"is_discovered" validate:"required,isBool"`
// 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"`
+13 -5
View File
@@ -2,6 +2,7 @@ package netobjgroups
import ( import (
"context" "context"
"encoding/json"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
@@ -24,18 +25,25 @@ type AttachExtNetPortsRequest struct {
} }
// AttachExtNetPorts attaches external network ports to a network object group // AttachExtNetPorts attaches external network ports to a network object group
func (nog NetworkObjectGroups) AttachExtNetPorts(ctx context.Context, req AttachExtNetPortsRequest) (bool, error) { func (nog NetworkObjectGroups) AttachExtNetPorts(ctx context.Context, req AttachExtNetPortsRequest) (*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/network_object_group/attach_external_network_ports" url := "/sdn/network_object_group/attach_external_network_ports"
_, err = nog.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req) res, err := nog.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil { if err != nil {
return false, err return nil, err
} }
return true, nil info := RecordVersion{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
} }
+14 -5
View File
@@ -2,6 +2,7 @@ package netobjgroups
import ( import (
"context" "context"
"encoding/json"
"net/http" "net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
@@ -26,6 +27,7 @@ type AttachLogicalPortsRequest struct {
// Required: true // Required: true
PortBindings []PortBindings `url:"port_bindings" json:"port_bindings" validate:"required,dive"` PortBindings []PortBindings `url:"port_bindings" json:"port_bindings" validate:"required,dive"`
} }
type PortBindings struct { type PortBindings struct {
// ID of a logical port // ID of a logical port
// Required: true // Required: true
@@ -37,18 +39,25 @@ type PortBindings struct {
} }
// AttachLogicalPorts attaches logical ports to a network object group // AttachLogicalPorts attaches logical ports to a network object group
func (nog NetworkObjectGroups) AttachLogicalPorts(ctx context.Context, req AttachLogicalPortsRequest) (bool, error) { func (nog NetworkObjectGroups) AttachLogicalPorts(ctx context.Context, req AttachLogicalPortsRequest) (*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/network_object_group/attach_logical_ports" url := "/sdn/network_object_group/attach_logical_ports"
_, err = nog.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req) res, err := nog.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil { if err != nil {
return false, err return nil, err
} }
return true, nil info := RecordVersion{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
} }
+9 -1
View File
@@ -26,6 +26,14 @@ type CreateRequest struct {
// Logical ports bindings // Logical ports bindings
// Required: false // Required: false
LogicalPortsBindings []LogicalPortsBindings `url:"logical_ports_binding,omitempty" json:"logical_ports_bindings,omitempty" validate:"omitempty,dive"` LogicalPortsBindings []LogicalPortsBindings `url:"logical_ports_binding,omitempty" json:"logical_ports_bindings,omitempty" validate:"omitempty,dive"`
// L2 connection ports bindings
// Required: false
L2ConnectionPortsBindings []LogicalPortsBindings `url:"l2_connection_ports_binding,omitempty" json:"l2_connection_ports_bindings,omitempty" validate:"omitempty,dive"`
// Addresses
// Required: false
Addresses []NetAddressRequest `url:"addresses,omitempty" json:"addresses,omitempty" validate:"omitempty,dive"`
} }
type LogicalPortsBindings struct { type LogicalPortsBindings struct {
// Port ID // Port ID
@@ -34,7 +42,7 @@ type LogicalPortsBindings struct {
// Port version // Port version
// Required: true // Required: true
PortVersion int64 `url:"port_version" json:"port_version" validate:"required"` PortVersion uint64 `url:"port_version" json:"port_version" validate:"required"`
} }
// Create creates a network object group // Create creates a network object group
+9 -3
View File
@@ -9,7 +9,7 @@ import (
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
) )
// DetachLogicalPortsRequest struct to detach an logical port from a network object group // DetachLogicalPortsRequest struct to detach logical ports from a network object group
type DetachLogicalPortsRequest struct { type DetachLogicalPortsRequest struct {
// ID of a network object group // ID of a network object group
// Required: true // Required: true
@@ -23,13 +23,19 @@ type DetachLogicalPortsRequest struct {
// Required: true // Required: true
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"` VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
// Port bindings
// Required: true
PortBindings []DetachLogicalPortBinding `url:"port_bindings" json:"port_bindings" validate:"required,dive"`
}
type DetachLogicalPortBinding struct {
// ID of a logical port // ID of a logical port
// Required: true // Required: true
LogicalPortID string `url:"logical_port_id" json:"logical_port_id" validate:"required"` PortID string `url:"port_id" json:"port_id" validate:"required"`
// Version of a logical port // Version of a logical port
// Required: true // Required: true
LogicalPortVersion uint64 `url:"logical_port_version" json:"logical_port_version" validate:"required"` PortVersion uint64 `url:"port_version" json:"port_version" validate:"required"`
} }
// DetachLogicalPorts detaches logical ports from a network object group // DetachLogicalPorts detaches logical ports from a network object group
+323 -23
View File
@@ -19,6 +19,9 @@ type RecordNetObjGroup struct {
// Access group name // Access group name
AccessGroupName string `json:"access_group_name"` AccessGroupName string `json:"access_group_name"`
// Addresses
Addresses NetAddresses `json:"addresses"`
// Counters // Counters
Counters Counter `json:"counters"` Counters Counter `json:"counters"`
@@ -37,21 +40,36 @@ type RecordNetObjGroup struct {
// ID of a network object group // ID of a network object group
ID string `json:"id"` ID string `json:"id"`
// L2 connection ports attached to a network object group
L2ConnectionPorts L2ConnectionPorts `json:"l2_connection_ports"`
// Logical ports attached to a network object group // Logical ports attached to a network object group
LogicalPorts LogicalPorts `json:"logical_ports"` LogicalPorts LogicalPorts `json:"logical_ports"`
// Name of a network object group // Name of a network object group
Name string `json:"name"` Name string `json:"name"`
// Purpose of a network object group
Purpose string `json:"purpose"`
// Security policies of a network object group // Security policies of a network object group
SecurityPolicies SecurityPolicies `json:"security_policies"` SecurityPolicies SecurityPolicies `json:"security_policies"`
// Type of a network object group
Type string `json:"type"`
// Version ID // Version ID
VersionID uint64 `json:"version_id"` VersionID uint64 `json:"version_id"`
} }
// Info about counters // Info about counters
type Counter struct { type Counter struct {
// Amount of addresses
AddressesCount uint64 `json:"addresses_count"`
// Amount of L2 connection ports
L2ConnectionPortsCount uint64 `json:"l2_connection_ports_count"`
// Amount of logical ports // Amount of logical ports
LogicalPortsCount uint64 `json:"logical_ports_count"` LogicalPortsCount uint64 `json:"logical_ports_count"`
@@ -62,23 +80,133 @@ type Counter struct {
SecurityRulesCount uint64 `json:"security_rules_count"` SecurityRulesCount uint64 `json:"security_rules_count"`
} }
// List of counters // Info about a net address
type Counters []Counter type NetAddress struct {
// ID
ID string `json:"id"`
// Info about an external network port // IP address
type ExternalNetworkPort struct { IPAddr string `json:"ip_addr"`
// IP address range end
IPAddrRangeEnd string `json:"ip_addr_range_end"`
// IP prefix
IPPrefix string `json:"ip_prefix"`
// MAC address
MACAddr string `json:"mac_addr"`
// Net address type
NetAddressType string `json:"net_address_type"`
}
// List of net addresses
type NetAddresses []NetAddress
// Request info about a net address
type NetAddressRequest struct {
// IP address
// Required: false
IPAddr string `url:"ip_addr" json:"ip_addr"`
// IP address range end
// Required: false
IPAddrRangeEnd string `url:"ip_addr_range_end" json:"ip_addr_range_end"`
// IP prefix
// Required: false
IPPrefix string `url:"ip_prefix" json:"ip_prefix"`
// MAC address
// Required: false
MACAddr string `url:"mac_addr" json:"mac_addr"`
// Net address type
// Required: true
NetAddressType string `url:"net_address_type" json:"net_address_type" validate:"required"`
}
// Info about an L2 connection port
type L2ConnectionPort struct {
// Access group ID
AccessGroupID string `json:"access_group_id"`
// Created at
CreatedAt string `json:"created_at"`
// ID
ID string `json:"id"`
// L2 external network
L2ExternalNetwork L2ExternalNetwork `json:"l2_external_network"`
// Updated at
UpdatedAt string `json:"updated_at"`
// Version ID
VersionID uint64 `json:"version_id"`
}
// List of L2 connection ports
type L2ConnectionPorts []L2ConnectionPort
// Info about an L2 external network
type L2ExternalNetwork struct {
// Bridge network name // Bridge network name
BridgeNetworkName string `json:"bridge_network_name"` BridgeNetworkName string `json:"bridge_network_name"`
// Default gateaway for IPv4 // Created at
DefaultGateawayIPv4 string `json:"default_gateaway_ipv4"` CreatedAt string `json:"created_at"`
// Default gateaway for IPv6
DefaultGateawayIPv6 string `json:"default_gateaway_ipv6"`
// Description // Description
Description string `json:"description"` Description string `json:"description"`
// Display name
DisplayName string `json:"display_name"`
// Hypervisors
Hypervisors []string `json:"hypervisors"`
// ID
ID string `json:"id"`
// Updated at
UpdatedAt string `json:"updated_at"`
// Version ID
VersionID uint64 `json:"version_id"`
// VLAN Tag
VLANTag *int `json:"vlan_tag"`
}
// Info about an external network port
type ExternalNetworkPort struct {
// Access group ID
AccessGroupID string `json:"access_group_id"`
// Access group name
AccessGroupName string `json:"access_group_name"`
// Bridge network name
BridgeNetworkName string `json:"bridge_network_name"`
// Comment
Comment string `json:"comment"`
// Default gateway for IPv4
DefaultGatewayIPv4 string `json:"default_gateway_ipv4"`
// Default gateway for IPv6
DefaultGatewayIPv6 string `json:"default_gateway_ipv6"`
// Description
Description string `json:"description"`
// Is a logical port enabled
Enabled bool `json:"enabled"`
// Details of external network ports // Details of external network ports
ExternalNetworkPorts ExternalNetworkPortsField `json:"external_network_ports"` ExternalNetworkPorts ExternalNetworkPortsField `json:"external_network_ports"`
@@ -88,11 +216,14 @@ type ExternalNetworkPort struct {
// ID of an external network port // ID of an external network port
ID string `json:"id"` ID string `json:"id"`
// IP v4
IPv4 string `json:"ipv4"`
// Status // Status
Status Status `json:"status"` Status Status `json:"status"`
// Version ID // Version ID
VersionID string `json:"version_id"` VersionID uint64 `json:"version_id"`
// Subnet for V4 // Subnet for V4
SubnetV4 string `json:"subnet_v4"` SubnetV4 string `json:"subnet_v4"`
@@ -107,7 +238,10 @@ type ExternalNetworkPort struct {
UpdatedAt string `json:"updated_at"` UpdatedAt string `json:"updated_at"`
// VLAN Tag // VLAN Tag
VLANTag string `json:"vlan_tag"` VLANTag int `json:"vlan_tag"`
// MAC
MAC string `json:"mac"`
} }
// List of external network ports // List of external network ports
@@ -142,6 +276,9 @@ type LogicalPort struct {
// Is a logical port enabled // Is a logical port enabled
Enabled bool `json:"enabled"` Enabled bool `json:"enabled"`
// Exclude firewall settings
ExcludeFirewall ExcludeFirewall `json:"exclude_firewall"`
// External network ID // External network ID
ExternalNetworkID string `json:"external_network_id"` ExternalNetworkID string `json:"external_network_id"`
@@ -151,6 +288,9 @@ type LogicalPort struct {
// Hypervisor display name // Hypervisor display name
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"`
@@ -170,9 +310,30 @@ type LogicalPort struct {
VersionID uint64 `json:"version_id"` VersionID uint64 `json:"version_id"`
} }
// List a logical ports // List of logical ports
type LogicalPorts []LogicalPort type LogicalPorts []LogicalPort
// Info about exclude firewall settings
type ExcludeFirewall struct {
// Exclusion reason
ExclusionReason string `json:"exclusion_reason"`
// Is logical port addresses excluded
LogicalPortAddressesExcluded bool `json:"logical_port_addresses_excluded"`
// Is logical port excluded
LogicalPortExcluded bool `json:"logical_port_excluded"`
}
// Labels for a logical port
type Labels struct {
// VM ID
VMID string `json:"vm_id"`
// VM name
VMName string `json:"vm_name"`
}
// Info about a security policy // Info about a security policy
type SecurityPolicy struct { type SecurityPolicy struct {
// Access group ID // Access group ID
@@ -181,8 +342,8 @@ type SecurityPolicy struct {
// Access group name // Access group name
AccessGroupName string `json:"access_group_name"` AccessGroupName string `json:"access_group_name"`
// Applied to net object group ID // Applied net object groups
AppliedToNetObjectGroupID string `json:"applied_to_net_object_group_id"` AppliedNetObjectGroups AppliedNetObjectGroups `json:"applied_net_object_groups"`
// Created at // Created at
CreatedAt string `json:"created_at"` CreatedAt string `json:"created_at"`
@@ -211,6 +372,9 @@ type SecurityPolicy struct {
// Status // Status
Status Status `json:"status"` Status Status `json:"status"`
// Type
Type string `json:"type"`
// Version ID // Version ID
VersionID uint64 `json:"version_id"` VersionID uint64 `json:"version_id"`
@@ -221,6 +385,21 @@ type SecurityPolicy struct {
// List of security policies // List of security policies
type SecurityPolicies []SecurityPolicy type SecurityPolicies []SecurityPolicy
// Info about an applied net object group in a security policy
type AppliedNetObjectGroup struct {
// ID
ID string `json:"id"`
// Name
Name string `json:"name"`
// Version ID
VersionID uint64 `json:"version_id"`
}
// List of applied net object groups
type AppliedNetObjectGroups []AppliedNetObjectGroup
// Details of external network ports field // Details of external network ports field
type ExternalNetworkPortField struct { type ExternalNetworkPortField struct {
// Access group ID // Access group ID
@@ -261,11 +440,14 @@ type ExternalNetworkPortsField []ExternalNetworkPortField
// Info about a status // Info about a status
type Status struct { type Status struct {
// Common // Operation status
Common string `json:"common"` OperationStatus string `json:"operation_status"`
// Info about hypervisors // Info about hypervisors
Hypervisors HypervisorsInfo `json:"hypervisors"` Hypervisors HypervisorsInfo `json:"hypervisors"`
// Hypervisor status
HypervisorStatus string `json:"hypervisor_status"`
} }
// Config for IP v6 // Config for IP v6
@@ -396,9 +578,6 @@ type Bindings struct {
// Is an address detected // Is an address detected
AddressDetection bool `json:"address_detection"` AddressDetection bool `json:"address_detection"`
// Is excluded from firewall
IsExcludedFromFirewall bool `json:"is_excluded_from_firewall"`
// Version ID // Version ID
VersionID uint64 `json:"version_id"` VersionID uint64 `json:"version_id"`
@@ -648,8 +827,8 @@ type RoutersInfo struct {
// Info about a hypervisor // Info about a hypervisor
type HypervisorInfo struct { type HypervisorInfo struct {
// Status // Operation status
Status string `json:"status"` OperationStatus string `json:"operation_status"`
// Name // Name
Name string `json:"name"` Name string `json:"name"`
@@ -696,7 +875,128 @@ type LogicalPortAddress struct {
// List of logical port addresses // List of logical port addresses
type LogicalPortAddresses []LogicalPortAddress type LogicalPortAddresses []LogicalPortAddress
// TODO // Info about a security rule
type SecurityRule struct{} type SecurityRule struct {
// Access group ID
AccessGroupID string `json:"access_group_id"`
// Action
Action string `json:"action"`
// Description
Description string `json:"description"`
// Destination net object
DestinationNetObject *SecurityRuleNetObject `json:"destination_net_object"`
// Direction
Direction string `json:"direction"`
// Display name
DisplayName string `json:"display_name"`
// Is enabled
Enabled bool `json:"enabled"`
// Filter
Filter *SecurityRuleFilter `json:"filter"`
// ID
ID string `json:"id"`
// Is log enabled
LogEnabled bool `json:"log_enabled"`
// Log name
LogName string `json:"log_name"`
// Log severity
LogSeverity string `json:"log_severity"`
// Priority
Priority int `json:"priority"`
// Security policy ID
SecurityPolicyID string `json:"security_policy_id"`
// Source net object
SourceNetObject *SecurityRuleNetObject `json:"source_net_object"`
// Is statistics enabled
StatisticsEnabled bool `json:"statistics_enabled"`
// Type
Type string `json:"type"`
// Version ID
VersionID uint64 `json:"version_id"`
}
// List of security rules
type SecurityRules []SecurityRule type SecurityRules []SecurityRule
// Info about a security rule net object
type SecurityRuleNetObject struct {
// Display name
DisplayName string `json:"display_name"`
// Net address pool ID
NetAddressPoolID string `json:"net_address_pool_id"`
// Net object group ID
NetObjectGroupID string `json:"net_object_group_id"`
}
// Info about a security rule filter
type SecurityRuleFilter struct {
// Filters
Filters SecurityRuleFilters `json:"filters"`
// Name
Name string `json:"name"`
}
// Security rule filters
type SecurityRuleFilters struct {
// Filter all traffic
All bool `json:"all"`
// Filter ARP traffic
ARP bool `json:"arp"`
// Filter DHCP traffic
DHCP bool `json:"dhcp"`
// Custom filter expression
Expression string `json:"expression"`
// Filter ICMP traffic
ICMP bool `json:"icmp"`
// Filter IP traffic
IP bool `json:"ip"`
// Filter IPv4 traffic
IPv4 bool `json:"ip_v4"`
// Filter IPv6 traffic
IPv6 bool `json:"ip_v6"`
// Keep tracking opened sessions
KeepOpenedSessions bool `json:"keep_opened_sessions"`
// Filter Neighbor Discovery traffic
ND bool `json:"nd"`
// Filter TCP traffic
TCP bool `json:"tcp"`
// List of TCP destination ports to filter
TCPDstPorts []string `json:"tcp_dst_ports"`
// Filter UDP traffic
UDP bool `json:"udp"`
// List of UDP destination ports to filter
UDPDstPorts []string `json:"udp_dst_ports"`
}
Loaded 100 of 111 files, more files were not shown because too many files have changed in this diff. Show more