v1.16.7
This commit is contained in:
dayterr
2026-10-09 16:23:35 +03:00
parent 25e2242360
commit 8cde0e9371
80 changed files with 2303 additions and 606 deletions

View File

@@ -30,6 +30,8 @@ type wrapperDiskQOSRequest struct {
}
// DiskQOS changes QOS of the disk
//
// Deprecated: will be removed in SDK v1.17
func (c Compute) DiskQOS(ctx context.Context, req DiskQOSRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -57,6 +59,8 @@ func (c Compute) DiskQOS(ctx context.Context, req DiskQOSRequest) (bool, error)
}
// DiskQOSAsync changes QOS of the disk with AsyncMode
//
// Deprecated: will be removed in SDK v1.17
func (c Compute) DiskQOSAsync(ctx context.Context, req DiskQOSRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {

View File

@@ -21,6 +21,10 @@ type DiskSwitchToReplicationRequest struct {
// Delete replication relationship
// Required: false
StopReplication bool `url:"stopReplication" json:"stopReplication"`
// Use planned failover for asynchronous replication
// Required: false
Planned interface{} `url:"planned,omitempty" json:"planned,omitempty" validate:"omitempty,isBool"`
}
type wrapperDiskSwitchToReplicationRequest struct {

View File

@@ -26,6 +26,8 @@ type AsyncWrapperMigrateRequest struct {
}
// Migrate migrates compute to another node
//
// Deprecated: will be removed in SDK v1.17
func (c Compute) Migrate(ctx context.Context, req MigrateRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -50,6 +52,8 @@ func (c Compute) Migrate(ctx context.Context, req MigrateRequest) (bool, error)
}
// AsyncMigrate migrates compute to another node in async mode
//
// Deprecated: will be removed in SDK v1.17
func (c Compute) AsyncMigrate(ctx context.Context, req MigrateRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {

View File

@@ -22,6 +22,8 @@ type wrapperMigrateAbortRequest struct {
}
// MigrateAbort aborts compute migration
//
// Deprecated: will be removed in SDK v1.17
func (c Compute) MigrateAbort(ctx context.Context, req MigrateAbortRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -46,6 +48,8 @@ func (c Compute) MigrateAbort(ctx context.Context, req MigrateAbortRequest) (str
}
// MigrateAbortAsync aborts compute migration with AsyncMode
//
// Deprecated: will be removed in SDK v1.17
func (c Compute) MigrateAbortAsync(ctx context.Context, req MigrateAbortRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {

View File

@@ -3,6 +3,7 @@ package compute
import (
"context"
"net/http"
"strconv"
"strings"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
@@ -25,17 +26,48 @@ type MigrateStorageRequest struct {
// Target node ID
// Required: true
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
}
// Async API call
// Required: true
Async interface{} `url:"async_mode" json:"async_mode" validate:"required,isBool"`
type wrapperMigrateStorageRequest struct {
MigrateStorageRequest
AsyncMode bool `url:"async_mode,omitempty"`
}
// MigrateStorage gets complex compute migration
// Compute will be migrated to specified node, and compute disks will
// be migrated to specified SEP to specified pool.
// This action can take up to 84 hours
func (c Compute) MigrateStorage(ctx context.Context, req MigrateStorageRequest) (string, error) {
func (c Compute) MigrateStorage(ctx context.Context, req MigrateStorageRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/migrateStorage"
aReq := wrapperMigrateStorageRequest{
MigrateStorageRequest: req,
AsyncMode: false,
}
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}
// MigrateStorageAsync gets complex compute migration in async mode
// Compute will be migrated to specified node, and compute disks will
// be migrated to specified SEP to specified pool.
// This action can take up to 84 hours
func (c Compute) MigrateStorageAsync(ctx context.Context, req MigrateStorageRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
@@ -43,7 +75,12 @@ func (c Compute) MigrateStorage(ctx context.Context, req MigrateStorageRequest)
url := "/cloudbroker/compute/migrateStorage"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
aReq := wrapperMigrateStorageRequest{
MigrateStorageRequest: req,
AsyncMode: true,
}
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
if err != nil {
return "", err
}

View File

@@ -27,6 +27,8 @@ type wrapperMigrateStorageAbortRequest struct {
}
// MigrateStorageAbort aborts complex compute migration job
//
// Deprecated: will be removed in SDK v1.17
func (c Compute) MigrateStorageAbort(ctx context.Context, req MigrateStorageAbortRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -54,6 +56,8 @@ func (c Compute) MigrateStorageAbort(ctx context.Context, req MigrateStorageAbor
}
// MigrateStorageAbortAsync aborts complex compute migration job with AsyncMode
//
// Deprecated: will be removed in SDK v1.17
func (c Compute) MigrateStorageAbortAsync(ctx context.Context, req MigrateStorageAbortRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {

View File

@@ -24,6 +24,8 @@ type wrapperMigrateStorageCleanUpRequest struct {
// MigrateStorageCleanUp cleanup resources after finished (success of failed) complex compute migration.
// If the migration was successful, then old disks will be removed, else new (target) disks will be removed.
// Do it wisely!
//
// Deprecated: will be removed in SDK v1.17
func (c Compute) MigrateStorageCleanUp(ctx context.Context, req MigrateStorageCleanUpRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -51,6 +53,8 @@ func (c Compute) MigrateStorageCleanUp(ctx context.Context, req MigrateStorageCl
}
// MigrateStorageCleanUpAsync cleanup resources after finished migration with AsyncMode
//
// Deprecated: will be removed in SDK v1.17
func (c Compute) MigrateStorageCleanUpAsync(ctx context.Context, req MigrateStorageCleanUpRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {

View File

@@ -16,6 +16,8 @@ type MigrateStorageInfoRequest struct {
}
// MigrateStorageInfo gets info about last (include ongoing) storage migration
//
// Deprecated: will be removed in SDK v1.17
func (c Compute) MigrateStorageInfo(ctx context.Context, req MigrateStorageInfoRequest) (*RecordMigrateStorageInfo, error) {
res, err := c.MigrateStorageInfoRaw(ctx, req)
if err != nil {
@@ -33,6 +35,8 @@ func (c Compute) MigrateStorageInfo(ctx context.Context, req MigrateStorageInfoR
}
// MigrateStorageInfoRaw gets info about last (include ongoing) storage migration as an array of bytes
//
// Deprecated: will be removed in SDK v1.17
func (c Compute) MigrateStorageInfoRaw(ctx context.Context, req MigrateStorageInfoRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {

View File

@@ -32,6 +32,8 @@ type MigrateStorageListRequest struct {
}
// MigrateStorageList gets list of the jobs.
//
// Deprecated: will be removed in SDK v1.17
func (c Compute) MigrateStorageList(ctx context.Context, req MigrateStorageListRequest) (*ListMigrateStorage, error) {
if err := validators.ValidateRequest(req); err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))

View File

@@ -424,6 +424,9 @@ type ItemDisk struct {
// Created time
CreatedTime uint64 `json:"createdTime"`
// Whether CRT tracking is enabled
CRTTracking bool `json:"crt_tracking"`
// Device name
DeviceName string `json:"devicename"`

View File

@@ -18,15 +18,11 @@ type SnapshotEvictDiskRequest struct {
// ID of the disk instance
// Required: true
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
// Is mode async
// Required: false
AsyncMode interface{} `url:"async_mode,omitempty" json:"async_mode,omitempty" validate:"omitempty,isBool"`
}
type asyncWrapperSnapshotEvictDiskRequest struct {
SnapshotEvictDiskRequest
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
AsyncMode bool `url:"async_mode,omitempty" json:"async_mode,omitempty"`
}
// SnapshotEvictDisk evicts specified disk from all snapshots of a compute instance