From 3b0a73c4241f979b6ac76c17863310a89ae06e55 Mon Sep 17 00:00:00 2001 From: Alexey Fetisov Date: Fri, 20 Nov 2026 17:14:41 +0300 Subject: [PATCH] v16.12.0 --- CHANGELOG.md | 48 +++++++++++++++++-- pkg/cloudapi/audit/audit.go | 4 +- pkg/cloudapi/audit/models.go | 38 ++++++++++++++- pkg/cloudapi/disks/models.go | 18 +++++++ pkg/cloudapi/disks/replication_cancel_sync.go | 39 +++++++++++++++ pkg/cloudapi/zone/models.go | 6 +++ pkg/cloudbroker/audit/audit.go | 4 +- pkg/cloudbroker/disks/models.go | 18 +++++++ .../disks/replication_cancel_sync.go | 39 +++++++++++++++ pkg/cloudbroker/disks/replication_reverse.go | 2 +- .../grid/set_mem_allocation_ratio.go | 2 +- pkg/cloudbroker/k8ci/access_add.go | 2 +- pkg/cloudbroker/k8ci/access_remove.go | 2 +- pkg/cloudbroker/node/models.go | 4 +- .../node/set_mem_allocation_ratio.go | 4 +- pkg/cloudbroker/user/create.go | 2 +- pkg/cloudbroker/zone/models.go | 6 +++ 17 files changed, 218 insertions(+), 20 deletions(-) create mode 100644 pkg/cloudapi/disks/replication_cancel_sync.go create mode 100644 pkg/cloudbroker/disks/replication_cancel_sync.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 7176ce1d..025ce5ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## Version 16.11.0 +## Version 16.12.0 ### Deprecated @@ -8,32 +8,70 @@ | Метод | CloudAPI | CloudBroker | | --- | --- | --- | | `account/AddUser` | :heavy_check_mark: | :heavy_check_mark: | +| `account/AddUserAsync` | :heavy_check_mark: | :heavy_check_mark: | | `account/DeleteUser` | :heavy_check_mark: | :heavy_check_mark: | +| `account/DeleteUserAsync` | :heavy_check_mark: | :heavy_check_mark: | | `account/UpdateUser` | :heavy_check_mark: | :heavy_check_mark: | +| `account/UpdateUserAsync` | :heavy_check_mark: | :heavy_check_mark: | | `compute/CreateTemplate` | :heavy_check_mark: | :heavy_check_mark: | +| `compute/CreateTemplateAsync` | :x: | :heavy_check_mark: | | `compute/CreateTemplateFromBlank` | :heavy_check_mark: | :heavy_check_mark: | +| `compute/CreateTemplateFromBlankAsync` | :heavy_check_mark: | :heavy_check_mark: | | `compute/DiskQOS` | :heavy_check_mark: | :heavy_check_mark: | +| `compute/DiskQOSAsync` | :heavy_check_mark: | :heavy_check_mark: | | `compute/Migrate` | :x: | :heavy_check_mark: | +| `compute/AsyncMigrate` | :x: | :heavy_check_mark: | | `compute/MigrateAbort` | :x: | :heavy_check_mark: | +| `compute/MigrateAbortAsync` | :x: | :heavy_check_mark: | | `compute/MigrateStorage` | :x: | :heavy_check_mark: | | `compute/MigrateStorageAbort` | :x: | :heavy_check_mark: | +| `compute/MigrateStorageAbortAsync` | :x: | :heavy_check_mark: | | `compute/MigrateStorageCleanUp` | :x: | :heavy_check_mark: | +| `compute/MigrateStorageCleanUpAsync` | :x: | :heavy_check_mark: | | `compute/MigrateStorageInfo` | :x: | :heavy_check_mark: | +| `compute/MigrateStorageInfoRaw` | :x: | :heavy_check_mark: | | `compute/MigrateStorageList` | :x: | :heavy_check_mark: | | `compute/UserGrant` | :heavy_check_mark: | :heavy_check_mark: | | `compute/UserList` | :heavy_check_mark: | :heavy_check_mark: | | `compute/UserRevoke` | :heavy_check_mark: | :heavy_check_mark: | | `compute/UserUpdate` | :heavy_check_mark: | :heavy_check_mark: | | `disks/FromPlatformDisk` | :heavy_check_mark: | :heavy_check_mark: | +| `disks/FromPlatformDiskAsync` | :heavy_check_mark: | :heavy_check_mark: | | `rg/AccessGrant` | :heavy_check_mark: | :heavy_check_mark: | | `rg/AccessRevoke` | :heavy_check_mark: | :heavy_check_mark: | | `sep/ConfigFieldEdit` | :x: | :heavy_check_mark: | | `apiaccess/userList` | :x: | :heavy_check_mark: | +### Добавлено -### Исправлено - -#### extnet +#### audit | Идентификатор задачи | Описание | | --- | --- | -| BGOS-1167 | Значение поля `AsyncMode` с `true` на `false` в структуре запроса `asyncWrapperCreateRequest` в методе `Create` в cloudbroker/extnet | +| BGOS-1174 | Вычисляемое поле `TTL` в структуре ответа `RecordAudit` в cloudapi/audit | + +#### disks +| Идентификатор задачи | Описание | +| --- | --- | +| BGOS-1178 | Вычисляемые поля `ReadBytesSecMaxLength`, `ReadIOPSSecMaxLength`, `TotalBytesSecMaxLength`, `TotalIOPSSecMaxLength`, `WriteBytesSecMaxLength` и `WriteIOPSSecMaxLength` в структуре ответа `IOTune` в cloudapi/disks | +| BGOS-1178 | Вычисляемые поля `ReadBytesSecMaxLength`, `ReadIOPSSecMaxLength`, `TotalBytesSecMaxLength`, `TotalIOPSSecMaxLength`, `WriteBytesSecMaxLength` и `WriteIOPSSecMaxLength` в структуре ответа `IOTune` в cloudbroker/disks | +| BGOS-1169 | Метод `ReplicationCancelSync` и структура запроса `ReplicationCancelSyncRequest` в cloudapi/disks | +| BGOS-1169 | Метод `ReplicationCancelSync` и структура запроса `ReplicationCancelSyncRequest` в cloudbroker/disks | + +#### zone +| Идентификатор задачи | Описание | +| --- | --- | +| BGOS-1175 | Вычисляемое поле `TTL` в структуры ответа `RecordZone` и `ItemZone` в cloudapi/zone | +| BGOS-1175 | Вычисляемое поле `TTL` в структуры ответа `RecordZone` и `ItemZone` в cloudbroker/zone | + +### Изменено + +#### grid +| Идентификатор задачи | Описание | +| --- | --- | +| BGOS-1172 | Тип обязательного поля `Ratio` с `uint64` на `float64` в структуре запроса `SetMemAllocationRatioRequest` в cloudbroker/grid | + +#### node +| Идентификатор задачи | Описание | +| --- | --- | +| BGOS-1173 | Тип вычисляемого поля `MemAllocationRatio` с `uint64` на `float64` в структурах ответа `RecordNode` и `ItemNode` в cloudbroker/node | +| BGOS-1173 | Тип обязательного поля `Ratio` с `uint64` на `float64` в структуре запроса `SetMemAllocationRatioRequest` в cloudbroker/node | diff --git a/pkg/cloudapi/audit/audit.go b/pkg/cloudapi/audit/audit.go index 3f1fbf0e..5e6cc30d 100644 --- a/pkg/cloudapi/audit/audit.go +++ b/pkg/cloudapi/audit/audit.go @@ -8,8 +8,8 @@ type Audit struct { } // Builder for audit endpoint -func New(client interfaces.Caller) *Audit { +func New(client interfaces.Caller) *Audit{ return &Audit{ client: client, } -} +} \ No newline at end of file diff --git a/pkg/cloudapi/audit/models.go b/pkg/cloudapi/audit/models.go index 7d9e78ef..3df097a7 100644 --- a/pkg/cloudapi/audit/models.go +++ b/pkg/cloudapi/audit/models.go @@ -1,8 +1,10 @@ package audit +import "encoding/json" + // Main info about audit type RecordAudit struct { - // Arguments + // Arguments as JSON text Arguments string `json:"args"` // Call @@ -14,7 +16,7 @@ type RecordAudit struct { // Correlation ID CorrelationID string `json:"correlation_id"` - // Kwargs + // Keyword arguments as JSON text Kwargs string `json:"kwargs"` // RemoteAddr @@ -43,6 +45,38 @@ type RecordAudit struct { // Public Session ID PublicSessionID string `json:"public_session_id"` + + // TTL + TTL string `json:"_ttl"` +} + +// UnmarshalJSON accepts both JSON-encoded strings and structured arguments. +func (r *RecordAudit) UnmarshalJSON(data []byte) error { + type recordAudit RecordAudit + response := struct { + *recordAudit + Arguments auditJSONText `json:"args"` + Kwargs auditJSONText `json:"kwargs"` + }{ + recordAudit: (*recordAudit)(r), + Arguments: auditJSONText{value: &r.Arguments, opening: '['}, + Kwargs: auditJSONText{value: &r.Kwargs, opening: '{'}, + } + + return json.Unmarshal(data, &response) +} + +type auditJSONText struct { + value *string + opening byte +} + +func (f *auditJSONText) UnmarshalJSON(data []byte) error { + if len(data) > 0 && data[0] == f.opening { + *f.value = string(data) + return nil + } + return json.Unmarshal(data, f.value) } // Main info about audit diff --git a/pkg/cloudapi/disks/models.go b/pkg/cloudapi/disks/models.go index 84ee186e..86f70b76 100644 --- a/pkg/cloudapi/disks/models.go +++ b/pkg/cloudapi/disks/models.go @@ -399,6 +399,24 @@ type IOTune struct { // WriteIOPSSecMax WriteIOPSSecMax uint64 `json:"write_iops_sec_max"` + + // ReadBytesSecMaxLength + ReadBytesSecMaxLength uint64 `json:"read_bytes_sec_max_length"` + + // ReadIOPSSecMaxLength + ReadIOPSSecMaxLength uint64 `json:"read_iops_sec_max_length"` + + // TotalBytesSecMaxLength + TotalBytesSecMaxLength uint64 `json:"total_bytes_sec_max_length"` + + // TotalIOPSSecMaxLength + TotalIOPSSecMaxLength uint64 `json:"total_iops_sec_max_length"` + + // WriteBytesSecMaxLength + WriteBytesSecMaxLength uint64 `json:"write_bytes_sec_max_length"` + + // WriteIOPSSecMaxLength + WriteIOPSSecMaxLength uint64 `json:"write_iops_sec_max_length"` } // Detailed information about disk diff --git a/pkg/cloudapi/disks/replication_cancel_sync.go b/pkg/cloudapi/disks/replication_cancel_sync.go new file mode 100644 index 00000000..35cf8138 --- /dev/null +++ b/pkg/cloudapi/disks/replication_cancel_sync.go @@ -0,0 +1,39 @@ +package disks + +import ( + "context" + "net/http" + "strconv" + "strings" + + "repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants" + "repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators" +) + +type ReplicationCancelSyncRequest struct { + // Disk ID + // Required: true + DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"` +} + +// ReplicationCancelSync cancels ongoing disk replication synchronization +func (d Disks) ReplicationCancelSync(ctx context.Context, req ReplicationCancelSyncRequest) (bool, error) { + err := validators.ValidateRequest(req) + if err != nil { + return false, validators.ValidationErrors(validators.GetErrors(err)) + } + + url := "/cloudapi/disks/replication_cancel_sync" + + res, err := d.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req) + if err != nil { + return false, err + } + + result, err := strconv.ParseBool(strings.TrimSpace(string(res))) + if err != nil { + return false, err + } + + return result, nil +} diff --git a/pkg/cloudapi/zone/models.go b/pkg/cloudapi/zone/models.go index ba84c697..d443df0e 100644 --- a/pkg/cloudapi/zone/models.go +++ b/pkg/cloudapi/zone/models.go @@ -129,6 +129,9 @@ type RecordZone struct { // Timeout TaskDiskTimeout string `json:"task_disk_timeout"` + + // TTL + TTL string `json:"ttl"` } // A zone item from a list @@ -219,4 +222,7 @@ type ItemZone struct { // Timeout TaskDiskTimeout string `json:"task_disk_timeout"` + + // TTL + TTL string `json:"ttl"` } diff --git a/pkg/cloudbroker/audit/audit.go b/pkg/cloudbroker/audit/audit.go index 3f1fbf0e..5e6cc30d 100644 --- a/pkg/cloudbroker/audit/audit.go +++ b/pkg/cloudbroker/audit/audit.go @@ -8,8 +8,8 @@ type Audit struct { } // Builder for audit endpoint -func New(client interfaces.Caller) *Audit { +func New(client interfaces.Caller) *Audit{ return &Audit{ client: client, } -} +} \ No newline at end of file diff --git a/pkg/cloudbroker/disks/models.go b/pkg/cloudbroker/disks/models.go index 01840db9..645682c9 100644 --- a/pkg/cloudbroker/disks/models.go +++ b/pkg/cloudbroker/disks/models.go @@ -40,6 +40,24 @@ type IOTune struct { // WriteIOPSSecMax WriteIOPSSecMax uint64 `json:"write_iops_sec_max"` + + // ReadBytesSecMaxLength + ReadBytesSecMaxLength uint64 `json:"read_bytes_sec_max_length"` + + // ReadIOPSSecMaxLength + ReadIOPSSecMaxLength uint64 `json:"read_iops_sec_max_length"` + + // TotalBytesSecMaxLength + TotalBytesSecMaxLength uint64 `json:"total_bytes_sec_max_length"` + + // TotalIOPSSecMaxLength + TotalIOPSSecMaxLength uint64 `json:"total_iops_sec_max_length"` + + // WriteBytesSecMaxLength + WriteBytesSecMaxLength uint64 `json:"write_bytes_sec_max_length"` + + // WriteIOPSSecMaxLength + WriteIOPSSecMaxLength uint64 `json:"write_iops_sec_max_length"` } // Main information about disks diff --git a/pkg/cloudbroker/disks/replication_cancel_sync.go b/pkg/cloudbroker/disks/replication_cancel_sync.go new file mode 100644 index 00000000..cee84d3d --- /dev/null +++ b/pkg/cloudbroker/disks/replication_cancel_sync.go @@ -0,0 +1,39 @@ +package disks + +import ( + "context" + "net/http" + "strconv" + "strings" + + "repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants" + "repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators" +) + +type ReplicationCancelSyncRequest struct { + // Disk ID + // Required: true + DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"` +} + +// ReplicationCancelSync cancels ongoing disk replication synchronization +func (d Disks) ReplicationCancelSync(ctx context.Context, req ReplicationCancelSyncRequest) (bool, error) { + err := validators.ValidateRequest(req) + if err != nil { + return false, validators.ValidationErrors(validators.GetErrors(err)) + } + + url := "/cloudbroker/disks/replication_cancel_sync" + + res, err := d.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req) + if err != nil { + return false, err + } + + result, err := strconv.ParseBool(strings.TrimSpace(string(res))) + if err != nil { + return false, err + } + + return result, nil +} diff --git a/pkg/cloudbroker/disks/replication_reverse.go b/pkg/cloudbroker/disks/replication_reverse.go index b8dae636..7735a131 100644 --- a/pkg/cloudbroker/disks/replication_reverse.go +++ b/pkg/cloudbroker/disks/replication_reverse.go @@ -17,7 +17,7 @@ type ReplicationReverseRequest struct { // Use planned failover for asynchronous replication // Required: false - // Default: true + // Default: true Planned interface{} `url:"planned,omitempty" json:"planned,omitempty" validate:"omitempty,isBool"` } diff --git a/pkg/cloudbroker/grid/set_mem_allocation_ratio.go b/pkg/cloudbroker/grid/set_mem_allocation_ratio.go index 9d88c76a..31783bad 100644 --- a/pkg/cloudbroker/grid/set_mem_allocation_ratio.go +++ b/pkg/cloudbroker/grid/set_mem_allocation_ratio.go @@ -16,7 +16,7 @@ type SetMemAllocationRatioRequest struct { // Allocation ratio // Required: true - Ratio uint64 `url:"ratio" json:"ratio" validate:"required"` + Ratio float64 `url:"ratio" json:"ratio" validate:"required,gte=1"` } // SetMemAllocationRatio sets memory allocation ratio diff --git a/pkg/cloudbroker/k8ci/access_add.go b/pkg/cloudbroker/k8ci/access_add.go index 810bdbbf..a3ac3991 100644 --- a/pkg/cloudbroker/k8ci/access_add.go +++ b/pkg/cloudbroker/k8ci/access_add.go @@ -19,7 +19,7 @@ type AccessAddRequest struct { } // Add accountId to sharedWith access list for k8ci. -func (k K8CI) AccessAdd(ctx context.Context, req AccessAddRequest) (string, error) { +func (k K8CI) AccessAdd (ctx context.Context, req AccessAddRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { return "", validators.ValidationErrors(validators.GetErrors(err)) diff --git a/pkg/cloudbroker/k8ci/access_remove.go b/pkg/cloudbroker/k8ci/access_remove.go index d811f6ca..8038e85d 100644 --- a/pkg/cloudbroker/k8ci/access_remove.go +++ b/pkg/cloudbroker/k8ci/access_remove.go @@ -19,7 +19,7 @@ type AccessRemoveRequest struct { } // Remove accountId from sharedWith access list for k8ci. -func (k K8CI) AccessRemove(ctx context.Context, req AccessRemoveRequest) (string, error) { +func (k K8CI) AccessRemove (ctx context.Context, req AccessRemoveRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { return "", validators.ValidationErrors(validators.GetErrors(err)) diff --git a/pkg/cloudbroker/node/models.go b/pkg/cloudbroker/node/models.go index 75b7f554..d5797c61 100644 --- a/pkg/cloudbroker/node/models.go +++ b/pkg/cloudbroker/node/models.go @@ -27,7 +27,7 @@ type RecordNode struct { IsolatedCpus []interface{} `json:"isolatedCpus"` // MemAllocationRatio - MemAllocationRatio uint64 `json:"mem_allocation_ratio"` + MemAllocationRatio float64 `json:"mem_allocation_ratio"` // Name Name string `json:"name"` @@ -363,7 +363,7 @@ type ItemNode struct { CPUAllocationRatio uint64 `json:"cpu_allocation_ratio"` // MemAllocationRatio - MemAllocationRatio uint64 `json:"mem_allocation_ratio"` + MemAllocationRatio float64 `json:"mem_allocation_ratio"` // Packages Packages map[string]PackageInfo `json:"packages"` diff --git a/pkg/cloudbroker/node/set_mem_allocation_ratio.go b/pkg/cloudbroker/node/set_mem_allocation_ratio.go index 64693829..22da1da1 100644 --- a/pkg/cloudbroker/node/set_mem_allocation_ratio.go +++ b/pkg/cloudbroker/node/set_mem_allocation_ratio.go @@ -14,9 +14,9 @@ type SetMemAllocationRatioRequest struct { // Required: true NodeID uint64 `url:"node_id" json:"node_id" validate:"required"` - // Allocation ratio (zero or positive value) + // Allocation ratio (at least 1) // Required: true - Ratio uint64 `url:"ratio" json:"ratio" validate:"required"` + Ratio float64 `url:"ratio" json:"ratio" validate:"required,gte=1"` } // SetMemAllocationRatio set memory allocation ratio diff --git a/pkg/cloudbroker/user/create.go b/pkg/cloudbroker/user/create.go index af56f26b..1667f45d 100644 --- a/pkg/cloudbroker/user/create.go +++ b/pkg/cloudbroker/user/create.go @@ -31,7 +31,7 @@ type CreateRequest struct { Provider string `url:"provider,omitempty" json:"provider,omitempty" validate:"omitempty,userProvider"` // Whether we create a service account - // Default value: false + // Default value: false // Required: false ServiceAccount interface{} `url:"serviceaccount,omitempty" json:"serviceaccount,omitempty" validate:"omitempty,isBool"` } diff --git a/pkg/cloudbroker/zone/models.go b/pkg/cloudbroker/zone/models.go index 6b038dc7..0f206ca0 100644 --- a/pkg/cloudbroker/zone/models.go +++ b/pkg/cloudbroker/zone/models.go @@ -198,6 +198,9 @@ type RecordZone struct { // Timeout TaskDiskTimeout string `json:"task_disk_timeout"` + + // TTL + TTL string `json:"ttl"` } // A zone item from a list @@ -291,4 +294,7 @@ type ItemZone struct { // Timeout TaskDiskTimeout string `json:"task_disk_timeout"` + + // TTL + TTL string `json:"ttl"` }