This commit is contained in:
2026-04-03 16:26:42 +03:00
parent 9258a1574b
commit 30e464e4d2
22 changed files with 251 additions and 100 deletions

View File

@@ -1,4 +1,4 @@
## Version 1.14.5 ## Version 1.14.6
Методы `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 и в следующих версиях будут удалены
@@ -9,41 +9,69 @@
### Добавлено ### Добавлено
#### compute #### extnet
| Идентификатор<br>задачи | Описание | | Идентификатор<br>задачи | Описание |
| --- | --- | | --- | --- |
| BGOS-360 | Валидация поля `Label` в структуре запроса `SnapshotCreateRequest` в cloudapi/compute и cloudbroker/compute | | BGOS-825 | Опциональное поле `EnableSecGroups` в структуру запроса `CreateRequest` в cloudbroker/extnet |
#### image #### grid
| Идентификатор<br>задачи | Описание | | Идентификатор<br>задачи | Описание |
| --- | --- | | --- | --- |
| BGOS-820 | Обязательное поле `SEPID` в структуру запроса `MultiImageExportRequest` в cloudbroker/image | | BGOS-828 | Вычисляемое поле `ZeroAccessEnabled` в структуру ответа `ItemLocation` в cloudbroker/grid |
#### locations #### dpdknet
| Идентификатор<br>задачи | Описание | | Идентификатор<br>задачи | Описание |
| --- | --- | | --- | --- |
| BGOS-823 | Вычисляемое поле `ZeroAccessEnabled` в структуру ответа `ItemLocation` в cloudapi/locations | | BGOS-825 | Опциональное поле `EnableSecGroups` в структуру запроса `CreateRequest` в cloudbroker/dpdknet |
#### resource_optimizer ### sep
| Идентификатор<br>задачи | Описание | | Идентификатор<br>задачи | Описание |
| --- | --- | | --- | --- |
| BGOS-818 | Группа методов `cloudbroker/resource_optimizer` для управления инструментом оптимизации ресурсов (DRS) | | BGOS-832 | Метод `AddPoolAsync` в cloudbroker/sep |
### zone #### vins
| Идентификатор<br>задачи | Описание | | Идентификатор<br>задачи | Описание |
| --- | --- | | --- | --- |
| BGOS-819 | Вычисляемые поля `DRS`, `DRSUID`, `AppID`, `DecortURL`, `DRSName` и `SSOURL` в структуру ответа `RecordZone` в cloudapi/zone и в cloudbroker/zone | | BGOS-825 | Опциональное поле `EnableSecGroups` в структуру запроса `CreateInAccountRequest` в cloudbroker/vins и cloudapi/vins |
| BGOS-819 | Структура ответа `ItemZone` в cloudapi/zone и в cloudbroker/zone | | BGOS-825 | Опциональное поле `EnableSecGroups` в структуру запроса `CreateInRGRequest` в cloudbroker/vins и cloudapi/vins |
| BGOS-819 | Опциональное поле `DRS` в структуру запроса `CreateRequest` в cloudbroker/zone |
### Изменено ### Изменено
#### image #### compute
| Идентификатор<br>задачи | Описание | | Идентификатор<br>задачи | Описание |
| --- | --- | | --- | --- |
| BGOS-822 | Тип полей `HotResize` и `Bootable` в структуре запроса `EditRequest` с bool на interface в cloudbroker/image | | BGOS-827 | Описание поля `EnableSecGroups` в структуре запроса `NetAttachRequest` в cloudapi/compute и в cloudbroker/compute |
#### node #### kvmx86
| Идентификатор<br>задачи | Описание | | Идентификатор<br>задачи | Описание |
| --- | --- | | --- | --- |
| BGOS-821 | Тип вычисляемого поля `VCPU` с `uint64` на `float64` в структуре ответа `FreeResourcesInfo` в cloudbroker/node | | 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 |

View File

@@ -74,6 +74,7 @@ type NetAttachRequest struct {
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"` SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
// Flag indicating whether security groups are enabled for this interface // Flag indicating whether security groups are enabled for this interface
// Not applicable to netType VFNIC, TRUNK, or SDN
// Required: false // Required: false
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"` EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`

View File

@@ -69,6 +69,7 @@ type Interface struct {
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"` SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
// Flag indicating whether security groups are enabled for this interface // Flag indicating whether security groups are enabled for this interface
// Not applicable to netType VFNIC, TRUNK, or SDN
// Required: false // Required: false
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"` EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`

View File

@@ -16,22 +16,22 @@ type HighlyAvailableRequest struct {
} }
// HighlyAvailable makes load balancer highly available // HighlyAvailable makes load balancer highly available
func (l LB) HighlyAvailable(ctx context.Context, req HighlyAvailableRequest) (uint64, error) { func (l LB) HighlyAvailable(ctx context.Context, req HighlyAvailableRequest) (bool, error) {
err := validators.ValidateRequest(req) err := validators.ValidateRequest(req)
if err != nil { if err != nil {
return 0, validators.ValidationErrors(validators.GetErrors(err)) return false, validators.ValidationErrors(validators.GetErrors(err))
} }
url := "/cloudapi/lb/makeHighlyAvailable" url := "/cloudapi/lb/makeHighlyAvailable"
res, err := l.client.DecortApiCall(ctx, http.MethodPost, url, req) res, err := l.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil { if err != nil {
return 0, err return false, err
} }
result, err := strconv.ParseUint(string(res), 10, 64) result, err := strconv.ParseBool(string(res))
if err != nil { if err != nil {
return 0, err return false, err
} }
return result, nil return result, nil

View File

@@ -57,6 +57,11 @@ type CreateInAccountRequest struct {
// Zone ID // Zone ID
// Required: false // Required: false
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"` ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
// Enable security groups for VINS
// Required: false
// Default: false
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
} }
type wrapperCreateRequestInAcc struct { type wrapperCreateRequestInAcc struct {

View File

@@ -51,6 +51,11 @@ type CreateInRGRequest struct {
// Zone ID // Zone ID
// Required: false // Required: false
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"` ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
// Enable security groups for VINS
// Required: false
// Default: false
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
} }
type wrapperCreateRequestInRG struct { type wrapperCreateRequestInRG struct {

View File

@@ -74,6 +74,7 @@ type NetAttachRequest struct {
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"` SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
// Flag indicating whether security groups are enabled for this interface // Flag indicating whether security groups are enabled for this interface
// Not applicable to netType VFNIC, TRUNK, or SDN
// Required: false // Required: false
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"` EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`

View File

@@ -37,6 +37,11 @@ type CreateRequest struct {
// List of resource groups IDs to which DPDK network will be available. Empty field means all resource groups in the system. // List of resource groups IDs to which DPDK network will be available. Empty field means all resource groups in the system.
// Required: false // Required: false
RGAccess []uint64 `url:"rgAccess,omitempty" json:"rgAccess,omitempty"` RGAccess []uint64 `url:"rgAccess,omitempty" json:"rgAccess,omitempty"`
// Enable security groups for DPDK network
// Required: false
// Default: false
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
} }
// Create creates a DPDK networks // Create creates a DPDK networks

View File

@@ -104,6 +104,11 @@ type CreateRequest struct {
// Required: false // Required: false
// Default: false // Default: false
HAMode bool `url:"highlyAvailable,omitempty" json:"highlyAvailable,omitempty"` HAMode bool `url:"highlyAvailable,omitempty" json:"highlyAvailable,omitempty"`
// Enable security groups for external network
// Required: false
// Default: false
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
} }
type wrapperCreateRequest struct { type wrapperCreateRequest struct {

View File

@@ -1,46 +0,0 @@
package grid
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// AddRequest struct for location code
type AddRequest struct {
// Grid (platform) ID
// Required: true
GID uint64 `url:"gid" json:"gid" validate:"required"`
// Name of the location
// Required: true
Name string `url:"name" json:"name" validate:"required"`
// Location code typicly used in dns names
// Required: true
LocationCode string `url:"locationcode" json:"locationcode" validate:"required"`
}
// Add location code (e.g. DNS name of this grid)
func (g Grid) Add(ctx context.Context, req AddRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/grid/add"
res, err := g.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
}

View File

@@ -129,6 +129,9 @@ type ItemGridList struct {
// SDN support // SDN support
SDNSupport bool `json:"sdn_support"` SDNSupport bool `json:"sdn_support"`
// Is Zero Access enabled
ZeroAccessEnabled bool `json:"zeroaccess_enabled"`
} }
// List Grids // List Grids

View File

@@ -51,6 +51,7 @@ type Interface struct {
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"` SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
// Flag indicating whether security groups are enabled for this interface // Flag indicating whether security groups are enabled for this interface
// Not applicable to netType VFNIC, TRUNK, or SDN
// Required: false // Required: false
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"` EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`

View File

@@ -45,6 +45,7 @@ type InterfaceMassCreate struct {
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"` SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
// Flag indicating whether security groups are enabled for this interface // Flag indicating whether security groups are enabled for this interface
// Not applicable to netType VFNIC, TRUNK, or SDN
// Required: false // Required: false
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"` EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`

View File

@@ -3,6 +3,8 @@ package sep
import ( import (
"context" "context"
"net/http" "net/http"
"strconv"
"strings"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
) )
@@ -13,32 +15,66 @@ type AddPoolRequest struct {
// Required: true // Required: true
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"` SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
// Method Async/Sync
// Default: true
// Required: false
Sync bool `url:"sync" json:"sync"`
// Pool structure which contains fields such as "name", "usage_limit", "types", "system", "accessAccountIds", "accessResGroupIds". Added fields for other pool types: Des, Ovs - "uris" list of "ip, port". // Pool structure which contains fields such as "name", "usage_limit", "types", "system", "accessAccountIds", "accessResGroupIds". Added fields for other pool types: Des, Ovs - "uris" list of "ip, port".
// Dorado, Tatlin no additional fields required. Hitachi - "id", "snapshotable", "snapshot_pool_id", "minLdevId", "maxLdevId", "clone_technology". Shared - "description", "wwns", "allocate_type", "stripes", "metadata_size", "metadatatalun". Local - "description", "node_consumer", "block_disk". // Dorado, Tatlin no additional fields required. Hitachi - "id", "snapshotable", "snapshot_pool_id", "minLdevId", "maxLdevId", "clone_technology". Shared - "description", "wwns", "allocate_type", "stripes", "metadata_size", "metadatatalun". Local - "description", "node_consumer", "block_disk".
// Required: true // Required: true
Pool string `url:"pool" json:"pool" validate:"required"` Pool string `url:"pool" json:"pool" validate:"required"`
} }
// AddPool adds pool to SEP type wrapperAddPoolRequest struct {
func (s SEP) AddPool(ctx context.Context, req AddPoolRequest) (string, error) { AddPoolRequest
AsyncMode bool `url:"asyncMode"`
}
// AddPool adds pool to SEP in sync mode.
// It returns result of operation and error.
func (s SEP) AddPool(ctx context.Context, req AddPoolRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
reqWrapped := wrapperAddPoolRequest{
AddPoolRequest: req,
AsyncMode: false,
}
url := "/cloudbroker/sep/addPool"
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
// AddPoolAsync adds pool to SEP in async mode.
// It returns guid of task and error.
func (s SEP) AddPoolAsync(ctx context.Context, req AddPoolRequest) (string, error) {
err := validators.ValidateRequest(req) err := validators.ValidateRequest(req)
if err != nil { if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err)) return "", validators.ValidationErrors(validators.GetErrors(err))
} }
reqWrapped := wrapperAddPoolRequest{
AddPoolRequest: req,
AsyncMode: true,
}
url := "/cloudbroker/sep/addPool" url := "/cloudbroker/sep/addPool"
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req) res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil { if err != nil {
return "", err return "", err
} }
result := string(res) result := strings.ReplaceAll(string(res), "\"", "")
return result, nil return result, nil
} }

View File

@@ -2,8 +2,8 @@ package sep
import ( import (
"context" "context"
"encoding/json"
"net/http" "net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
) )
@@ -34,23 +34,25 @@ type ConfigFieldEditRequest struct {
} }
// ConfigFieldEdit edits SEP config field value // ConfigFieldEdit edits SEP config field value
func (s SEP) ConfigFieldEdit(ctx context.Context, req ConfigFieldEditRequest) (bool, error) { func (s SEP) ConfigFieldEdit(ctx context.Context, req ConfigFieldEditRequest) (*RecordConfigFieldEdit, 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/sep/configFieldEdit" url := "/cloudbroker/sep/configFieldEdit"
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 false, err return nil, err
} }
result, err := strconv.ParseBool(string(res)) info := RecordConfigFieldEdit{}
err = json.Unmarshal(res, &info)
if err != nil { if err != nil {
return false, err return nil, err
} }
return result, nil return &info, nil
} }

View File

@@ -2,8 +2,8 @@ package sep
import ( import (
"context" "context"
"encoding/json"
"net/http" "net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
) )
@@ -25,22 +25,24 @@ type DelConsumerNodesRequest struct {
} }
// DelConsumerNodes excludes consumer nodes from SEP parameters // DelConsumerNodes excludes consumer nodes from SEP parameters
func (s SEP) DelConsumerNodes(ctx context.Context, req DelConsumerNodesRequest) (bool, error) { func (s SEP) DelConsumerNodes(ctx context.Context, req DelConsumerNodesRequest) (interface{}, 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/sep/delConsumerNodes" url := "/cloudbroker/sep/delConsumerNodes"
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 false, err return nil, err
} }
result, err := strconv.ParseBool(string(res)) var result interface{}
err = json.Unmarshal(res, &result)
if err != nil { if err != nil {
return false, err return nil, err
} }
return result, nil return result, nil

View File

@@ -1,5 +1,7 @@
package sep package sep
import "encoding/json"
// Total resource information // Total resource information
type Total struct { type Total struct {
// Capacity limit // Capacity limit
@@ -185,3 +187,93 @@ type ListAvailableSEP struct {
// Data // Data
Data []SEPData `json:"data"` Data []SEPData `json:"data"`
} }
// Disk clean settings
type DiskCleanSettings struct {
// Block size
BlockSize string `json:"blocksize"`
// Write bytes per second
WBPS uint64 `json:"wbps"`
// Write I/O operations per second
WIOPS uint64 `json:"wiops"`
}
// Pool configuration
type PoolConfig struct {
// Disk clean
DiskClean *string `json:"disk_clean"`
// Disk clean settings
DiskCleanSettings DiskCleanSettings `json:"disk_clean_settings"`
// Pool name
Name string `json:"name"`
// Usage limit
UsageLimit uint64 `json:"usage_limit"`
// Additional properties
AdditionalProperties map[string]interface{} `json:"-"`
}
func (p *PoolConfig) UnmarshalJSON(data []byte) error {
type tmpAlias PoolConfig
if err := json.Unmarshal(data, (*tmpAlias)(p)); err != nil {
return err
}
all := make(map[string]interface{})
if err := json.Unmarshal(data, &all); err != nil {
return err
}
delete(all, "disk_clean")
delete(all, "disk_clean_settings")
delete(all, "name")
delete(all, "usage_limit")
if len(all) > 0 {
p.AdditionalProperties = all
}
return nil
}
// Sep configuration information
type RecordConfigFieldEdit struct {
// Format
Format string `json:"format"`
// Pools
Pools []PoolConfig `json:"pools"`
// Protocol
Protocol string `json:"protocol"`
// Additional properties
AdditionalProperties map[string]interface{} `json:"-"`
}
func (r *RecordConfigFieldEdit) UnmarshalJSON(data []byte) error {
type tmpAlias RecordConfigFieldEdit
if err := json.Unmarshal(data, (*tmpAlias)(r)); err != nil {
return err
}
all := make(map[string]interface{})
if err := json.Unmarshal(data, &all); err != nil {
return err
}
delete(all, "format")
delete(all, "pools")
delete(all, "protocol")
if len(all) > 0 {
r.AdditionalProperties = all
}
return nil
}

View File

@@ -57,6 +57,11 @@ type CreateInAccountRequest struct {
// Zone ID // Zone ID
// Required: false // Required: false
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"` ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
// Enable security groups for VINS
// Required: false
// Default: false
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
} }
type wrapperCreateRequestInAcc struct { type wrapperCreateRequestInAcc struct {

View File

@@ -51,6 +51,11 @@ type CreateInRGRequest struct {
// Zone ID // Zone ID
// Required: false // Required: false
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"` ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
// Enable security groups for VINS
// Required: false
// Default: false
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
} }
type wrapperCreateRequestInRG struct { type wrapperCreateRequestInRG struct {

View File

@@ -26,17 +26,17 @@ func NewMigrator(cfg *Config, c decortsdk.ClientInterface) Migrator {
} }
} }
func (m *migrator) Migrate(ctxOrigin context.Context, dxVMID, stackID uint64) (bool, error) { func (m *migrator) Migrate(ctxOrigin context.Context, dxVMID, nodeID uint64) (bool, error) {
req := compute.MigrateRequest{ req := compute.MigrateRequest{
ComputeID: dxVMID, ComputeID: dxVMID,
TargetStackID: stackID, TargetNodeID: nodeID,
Force: false, Force: false,
} }
ctx, cancel := context.WithTimeout(ctxOrigin, m.cfg.QueryTimeout) ctx, cancel := context.WithTimeout(ctxOrigin, m.cfg.QueryTimeout)
ok, err := m.client.CloudBroker().Compute().Migrate(ctx, req) ok, err := m.client.CloudBroker().Compute().Migrate(ctx, req)
cancel() cancel()
if err != nil { if err != nil {
return false, errors.Join(err, fmt.Errorf("Migrate VM %d to Node %d", dxVMID, stackID)) return false, errors.Join(err, fmt.Errorf("Migrate VM %d to Node %d", dxVMID, nodeID))
} }
return ok, nil return ok, nil
} }

View File

@@ -60,17 +60,17 @@ func TestMigrator(t *testing.T) {
assert.NoError(t, err) assert.NoError(t, err)
dxVMID := uint64(100500) dxVMID := uint64(100500)
stackID := uint64(100501) nodeID := uint64(100501)
// Записываем поведение клиента // Записываем поведение клиента
mockCaller.EXPECT().DecortApiCall(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Eq(compute.AsyncWrapperMigrateRequest{ mockCaller.EXPECT().DecortApiCall(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Eq(compute.AsyncWrapperMigrateRequest{
MigrateRequest: compute.MigrateRequest{ MigrateRequest: compute.MigrateRequest{
ComputeID: dxVMID, ComputeID: dxVMID,
TargetStackID: stackID, TargetNodeID: nodeID,
}, },
SyncMode: true})).Return(b, nil).AnyTimes() SyncMode: true})).Return(b, nil).AnyTimes()
ok, err := migrator.Migrate(context.Background(), dxVMID, stackID) ok, err := migrator.Migrate(context.Background(), dxVMID, nodeID)
assert.NoError(t, err) assert.NoError(t, err)
assert.True(t, ok) assert.True(t, ok)
} }

View File

@@ -749,7 +749,6 @@ func getRequestsMapCloudbroker() map[string]interface{} {
"/restmachine/cloudbroker/flipgroup/list": flipgroup_cb.ListRequest{}, "/restmachine/cloudbroker/flipgroup/list": flipgroup_cb.ListRequest{},
// grid // grid
"/restmachine/cloudbroker/grid/add": grid_cb.AddRequest{},
"/restmachine/cloudbroker/grid/addCustomBackupPath": grid_cb.AddCustomBackupPathRequest{}, "/restmachine/cloudbroker/grid/addCustomBackupPath": grid_cb.AddCustomBackupPathRequest{},
"/restmachine/cloudbroker/grid/changeSettings": grid_cb.ChangeSettingsRequest{}, "/restmachine/cloudbroker/grid/changeSettings": grid_cb.ChangeSettingsRequest{},
"/restmachine/cloudbroker/grid/executeMaintenanceScript": grid_cb.ExecuteMaintenanceScriptRequest{}, "/restmachine/cloudbroker/grid/executeMaintenanceScript": grid_cb.ExecuteMaintenanceScriptRequest{},