v1.16.7
v1.16.7
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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"`
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -18,6 +18,11 @@ type ChangeDiskStoragePolicyRequest struct {
|
||||
// ID of the storage policy to which to connect account
|
||||
// Required: true
|
||||
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
|
||||
|
||||
// Keep current disk I/O tune settings in the domain XML
|
||||
// Required: false
|
||||
// Default: false
|
||||
KeepCurrentIOTune interface{} `url:"keep_current_iot,omitempty" json:"keep_current_iot,omitempty" validate:"omitempty,isBool"`
|
||||
}
|
||||
|
||||
type wrapperChangeDiskStoragePolicyRequest struct {
|
||||
|
||||
@@ -67,6 +67,30 @@ type LimitIORequest struct {
|
||||
// Required: false
|
||||
WriteIOPSSecMax uint64 `url:"write_iops_sec_max,omitempty" json:"write_iops_sec_max,omitempty"`
|
||||
|
||||
// Duration in seconds of the total bytes burst. Requires TotalBytesSecMax
|
||||
// Required: false
|
||||
TotalBytesSecMaxLength uint64 `url:"total_bytes_sec_max_length,omitempty" json:"total_bytes_sec_max_length,omitempty"`
|
||||
|
||||
// Duration in seconds of the read bytes burst. Requires ReadBytesSecMax
|
||||
// Required: false
|
||||
ReadBytesSecMaxLength uint64 `url:"read_bytes_sec_max_length,omitempty" json:"read_bytes_sec_max_length,omitempty"`
|
||||
|
||||
// Duration in seconds of the write bytes burst. Requires WriteBytesSecMax
|
||||
// Required: false
|
||||
WriteBytesSecMaxLength uint64 `url:"write_bytes_sec_max_length,omitempty" json:"write_bytes_sec_max_length,omitempty"`
|
||||
|
||||
// Duration in seconds of the total IOPS burst. Requires TotalIOPSSecMax
|
||||
// Required: false
|
||||
TotalIOPSSecMaxLength uint64 `url:"total_iops_sec_max_length,omitempty" json:"total_iops_sec_max_length,omitempty"`
|
||||
|
||||
// Duration in seconds of the read IOPS burst. Requires ReadIOPSSecMax
|
||||
// Required: false
|
||||
ReadIOPSSecMaxLength uint64 `url:"read_iops_sec_max_length,omitempty" json:"read_iops_sec_max_length,omitempty"`
|
||||
|
||||
// Duration in seconds of the write IOPS burst. Requires WriteIOPSSecMax
|
||||
// Required: false
|
||||
WriteIOPSSecMaxLength uint64 `url:"write_iops_sec_max_length,omitempty" json:"write_iops_sec_max_length,omitempty"`
|
||||
|
||||
// SizeIOPSSec
|
||||
// Required: false
|
||||
SizeIOPSSec uint64 `url:"size_iops_sec,omitempty" json:"size_iops_sec,omitempty"`
|
||||
|
||||
@@ -199,6 +199,9 @@ type InfoDisk struct {
|
||||
|
||||
// Cache mode of disk
|
||||
Cache string `json:"cache"`
|
||||
|
||||
// Whether CRT is tracked
|
||||
CRTTracking bool `json:"crt_tracking"`
|
||||
}
|
||||
|
||||
type ItemReplication struct {
|
||||
|
||||
@@ -30,6 +30,14 @@ type ReplicateRequest struct {
|
||||
// ID of the storage policy under the disk will be created
|
||||
// Required: true
|
||||
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
|
||||
|
||||
// Copy rate for an asynchronous replication pair (in MB/s)
|
||||
// Required: false
|
||||
CopyRate uint64 `url:"copy_rate,omitempty" json:"copy_rate,omitempty"`
|
||||
|
||||
// Name of the schedule from the replication profile
|
||||
// Required: false
|
||||
Schedule string `url:"schedule,omitempty" json:"schedule,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperReplicateRequest struct {
|
||||
|
||||
38
pkg/cloudbroker/disks/replication_disable_schedule.go
Normal file
38
pkg/cloudbroker/disks/replication_disable_schedule.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package disks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// ReplicationDisableScheduleRequest to remove the schedule from an asynchronous replication pair
|
||||
type ReplicationDisableScheduleRequest struct {
|
||||
// Disk ID
|
||||
// Required: true
|
||||
DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"`
|
||||
}
|
||||
|
||||
// ReplicationDisableSchedule removes the schedule from an asynchronous replication pair
|
||||
func (d Disks) ReplicationDisableSchedule(ctx context.Context, req ReplicationDisableScheduleRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/disks/replication_disable_schedule"
|
||||
|
||||
res, err := d.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
|
||||
}
|
||||
46
pkg/cloudbroker/disks/replication_enable_schedule.go
Normal file
46
pkg/cloudbroker/disks/replication_enable_schedule.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package disks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// ReplicationEnableScheduleRequest to apply a replication profile schedule to an asynchronous replication pair
|
||||
type ReplicationEnableScheduleRequest struct {
|
||||
// Disk ID
|
||||
// Required: true
|
||||
DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"`
|
||||
|
||||
// ID of the replication profile assigned to the pair
|
||||
// Required: true
|
||||
ProfileID uint64 `url:"profile_id" json:"profile_id" validate:"required"`
|
||||
|
||||
// Name of the interval or calendar schedule from the profile
|
||||
// Required: true
|
||||
ScheduleName string `url:"schedule_name" json:"schedule_name" validate:"required"`
|
||||
}
|
||||
|
||||
// ReplicationEnableSchedule applies a replication profile schedule to an asynchronous replication pair
|
||||
func (d Disks) ReplicationEnableSchedule(ctx context.Context, req ReplicationEnableScheduleRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/disks/replication_enable_schedule"
|
||||
|
||||
res, err := d.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
|
||||
}
|
||||
78
pkg/cloudbroker/disks/replication_promote.go
Normal file
78
pkg/cloudbroker/disks/replication_promote.go
Normal file
@@ -0,0 +1,78 @@
|
||||
package disks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// ReplicationPromoteRequest to promote the primary side of an asynchronous replication pair
|
||||
type ReplicationPromoteRequest struct {
|
||||
// Disk ID
|
||||
// Required: true
|
||||
DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperReplicationPromoteRequest struct {
|
||||
ReplicationPromoteRequest
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// ReplicationPromote promotes the primary side of an asynchronous replication pair
|
||||
func (d Disks) ReplicationPromote(ctx context.Context, req ReplicationPromoteRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/disks/replication_promote"
|
||||
|
||||
aReq := wrapperReplicationPromoteRequest{
|
||||
ReplicationPromoteRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := d.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
|
||||
}
|
||||
|
||||
// ReplicationPromoteAsync promotes the primary side of an asynchronous replication pair in async mode
|
||||
func (d Disks) ReplicationPromoteAsync(ctx context.Context, req ReplicationPromoteRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/disks/replication_promote"
|
||||
|
||||
aReq := wrapperReplicationPromoteRequest{
|
||||
ReplicationPromoteRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
var resp string
|
||||
|
||||
err = json.Unmarshal(res, &resp)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
@@ -14,6 +14,11 @@ type ReplicationReverseRequest struct {
|
||||
// Id of the disk
|
||||
// Required: true
|
||||
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
|
||||
|
||||
// Use planned failover for asynchronous replication
|
||||
// Required: false
|
||||
// Default: true
|
||||
Planned interface{} `url:"planned,omitempty" json:"planned,omitempty" validate:"omitempty,isBool"`
|
||||
}
|
||||
|
||||
type wrapperReplicationReverseRequest struct {
|
||||
|
||||
42
pkg/cloudbroker/disks/replication_set_copy_rate.go
Normal file
42
pkg/cloudbroker/disks/replication_set_copy_rate.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package disks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// ReplicationSetCopyRateRequest to set the copy rate of an asynchronous replication pair
|
||||
type ReplicationSetCopyRateRequest struct {
|
||||
// Disk ID
|
||||
// Required: true
|
||||
DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"`
|
||||
|
||||
// Copy rate in MB/s
|
||||
// Required: true
|
||||
CopyRate uint64 `url:"copy_rate" json:"copy_rate" validate:"required"`
|
||||
}
|
||||
|
||||
// ReplicationSetCopyRate sets the copy rate of an asynchronous replication pair
|
||||
func (d Disks) ReplicationSetCopyRate(ctx context.Context, req ReplicationSetCopyRateRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/disks/replication_set_copy_rate"
|
||||
|
||||
res, err := d.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
|
||||
}
|
||||
@@ -18,6 +18,14 @@ type ReplicationStartRequest struct {
|
||||
// ID of target disk. Secondary disk in replication
|
||||
// Required: true
|
||||
TargetDiskID uint64 `url:"targetDiskId" json:"targetDiskId" validate:"required"`
|
||||
|
||||
// Copy rate for an asynchronous replication pair (in MB/s)
|
||||
// Required: false
|
||||
CopyRate uint64 `url:"copy_rate,omitempty" json:"copy_rate,omitempty"`
|
||||
|
||||
// Name of the schedule from the replication profile
|
||||
// Required: false
|
||||
Schedule string `url:"schedule,omitempty" json:"schedule,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperReplicationStartRequest struct {
|
||||
|
||||
38
pkg/cloudbroker/disks/replication_sync_now.go
Normal file
38
pkg/cloudbroker/disks/replication_sync_now.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package disks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// ReplicationSyncNowRequest to start manual synchronization of an asynchronous replication pair
|
||||
type ReplicationSyncNowRequest struct {
|
||||
// Disk ID
|
||||
// Required: true
|
||||
DiskID uint64 `url:"disk_id" json:"disk_id" validate:"required"`
|
||||
}
|
||||
|
||||
// ReplicationSyncNow starts manual synchronization of an asynchronous replication pair
|
||||
func (d Disks) ReplicationSyncNow(ctx context.Context, req ReplicationSyncNowRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/disks/replication_sync_now"
|
||||
|
||||
res, err := d.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
|
||||
}
|
||||
@@ -34,6 +34,10 @@ type ListRequest struct {
|
||||
// Required: false
|
||||
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
|
||||
|
||||
// Sort by node ID
|
||||
// Required: false
|
||||
NodeID uint64 `url:"node_id,omitempty" json:"node_id,omitempty"`
|
||||
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
@@ -23,7 +23,7 @@ type AddPoolRequest struct {
|
||||
|
||||
type wrapperAddPoolRequest struct {
|
||||
AddPoolRequest
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
AsyncMode bool `url:"async_mode"`
|
||||
}
|
||||
|
||||
// AddPool adds pool to SEP in sync mode.
|
||||
|
||||
@@ -30,6 +30,10 @@ type ListRequest struct {
|
||||
// Required: false
|
||||
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
|
||||
|
||||
// API access ID
|
||||
// Required: false
|
||||
APIAccessID uint64 `url:"apiaccess_id,omitempty" json:"apiaccess_id,omitempty"`
|
||||
|
||||
// Page number.
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
@@ -2,6 +2,7 @@ package vgpu
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
@@ -14,6 +15,10 @@ type CreateRequest struct {
|
||||
// Required: true
|
||||
PGPUID uint64 `url:"pgpu_id" json:"pgpu_id" validate:"required"`
|
||||
|
||||
// Name
|
||||
// Required: true
|
||||
Name string `url:"name" json:"name" validate:"required"`
|
||||
|
||||
// Virtual profile id
|
||||
// Required: false
|
||||
ProfileID string `url:"profile_id,omitempty" json:"profile_id,omitempty"`
|
||||
@@ -31,6 +36,11 @@ type CreateRequest struct {
|
||||
AccountIDs []uint64 `url:"account_ids,omitempty" json:"account_ids,omitempty"`
|
||||
}
|
||||
|
||||
type asyncWrapperCreateRequest struct {
|
||||
CreateRequest
|
||||
AsyncMode bool `url:"async_mode"`
|
||||
}
|
||||
|
||||
// Create creates VGPU
|
||||
func (v VGPU) Create(ctx context.Context, req CreateRequest) (uint64, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -40,7 +50,12 @@ func (v VGPU) Create(ctx context.Context, req CreateRequest) (uint64, error) {
|
||||
|
||||
url := "/cloudbroker/vgpu/create"
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
aReq := asyncWrapperCreateRequest{
|
||||
CreateRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -52,3 +67,33 @@ func (v VGPU) Create(ctx context.Context, req CreateRequest) (uint64, error) {
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// CreateAsync creates VGPU in async mode
|
||||
func (v VGPU) CreateAsync(ctx context.Context, req CreateRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/vgpu/create"
|
||||
|
||||
aReq := asyncWrapperCreateRequest{
|
||||
CreateRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
var resp string
|
||||
|
||||
err = json.Unmarshal(res, &resp)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package vgpu
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
@@ -15,6 +16,11 @@ type DestroyRequest struct {
|
||||
VGPUID uint64 `url:"vgpu_id" json:"vgpu_id" validate:"required"`
|
||||
}
|
||||
|
||||
type asyncWrapperDestroyRequest struct {
|
||||
DestroyRequest
|
||||
AsyncMode bool `url:"async_mode"`
|
||||
}
|
||||
|
||||
// Destroy destroys VGPU
|
||||
func (v VGPU) Destroy(ctx context.Context, req DestroyRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -24,7 +30,12 @@ func (v VGPU) Destroy(ctx context.Context, req DestroyRequest) (bool, error) {
|
||||
|
||||
url := "/cloudbroker/vgpu/destroy"
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
aReq := asyncWrapperDestroyRequest{
|
||||
DestroyRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -36,3 +47,32 @@ func (v VGPU) Destroy(ctx context.Context, req DestroyRequest) (bool, error) {
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Destroy destroys VGPU in async mode
|
||||
func (v VGPU) DestroyAsync(ctx context.Context, req DestroyRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/vgpu/destroy"
|
||||
|
||||
aReq := asyncWrapperDestroyRequest{
|
||||
DestroyRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
var resp string
|
||||
|
||||
err = json.Unmarshal(res, &resp)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
82
pkg/cloudbroker/vgpu/edit.go
Normal file
82
pkg/cloudbroker/vgpu/edit.go
Normal file
@@ -0,0 +1,82 @@
|
||||
package vgpu
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// EditRequest to edit the name
|
||||
type EditRequest struct {
|
||||
// VGPU ID
|
||||
// Required: true
|
||||
VGPUID uint64 `url:"vgpu_id" json:"vgpu_id" validate:"required"`
|
||||
|
||||
// New name
|
||||
// Required: false
|
||||
Name string `url:"name,omitempty" json:"name,omitempty"`
|
||||
}
|
||||
|
||||
type asyncWrapperEditRequest struct {
|
||||
EditRequest
|
||||
AsyncMode bool `url:"async_mode"`
|
||||
}
|
||||
|
||||
// Edit edits the name
|
||||
func (v VGPU) Edit(ctx context.Context, req EditRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/vgpu/edit"
|
||||
|
||||
aReq := asyncWrapperEditRequest{
|
||||
EditRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := v.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
|
||||
}
|
||||
|
||||
// Edit Async edits the name in async mode
|
||||
func (v VGPU) EditAsync(ctx context.Context, req EditRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/vgpu/edit"
|
||||
|
||||
aReq := asyncWrapperEditRequest{
|
||||
EditRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
var resp string
|
||||
|
||||
err = json.Unmarshal(res, &resp)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
@@ -42,6 +42,10 @@ type ListRequest struct {
|
||||
// Required: false
|
||||
SortBy string `url:"sort_by,omitempty" json:"sort_by,omitempty" validate:"omitempty,sortBy"`
|
||||
|
||||
// Sort by name
|
||||
// Required: false
|
||||
Name string `url:"name,omitempty" json:"name,omitempty"`
|
||||
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
@@ -60,6 +60,12 @@ type ItemVGPU struct {
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Node ID
|
||||
NodeID uint64 `json:"node_id"`
|
||||
}
|
||||
|
||||
// List of VGPU
|
||||
|
||||
@@ -72,7 +72,7 @@ type CreateInAccountRequest struct {
|
||||
|
||||
type asyncWrapperCreateInAccountRequest struct {
|
||||
CreateInAccountRequest
|
||||
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// CreateInAccount creates VINS in account level
|
||||
|
||||
@@ -66,7 +66,7 @@ type CreateInRGRequest struct {
|
||||
|
||||
type asyncWrapperCreateInRgRequest struct {
|
||||
CreateInRGRequest
|
||||
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// CreateInRG creates VINS in resource group level
|
||||
|
||||
@@ -18,7 +18,7 @@ type EnableRequest struct {
|
||||
|
||||
type asyncWrapperEnableRequest struct {
|
||||
EnableRequest
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
AsyncMode bool `url:"async_mode"`
|
||||
}
|
||||
|
||||
// Enable enables VINS by ID
|
||||
|
||||
@@ -18,7 +18,7 @@ type VNFDevRedeployRequest struct {
|
||||
|
||||
type asyncWrapperVNFDevRedeployRequest struct {
|
||||
VNFDevRedeployRequest
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
AsyncMode bool `url:"async_mode"`
|
||||
}
|
||||
|
||||
// VNFDevRedeploy redeploys VINS VNFDevs
|
||||
|
||||
@@ -18,7 +18,7 @@ type VNFDevRestartRequest struct {
|
||||
|
||||
type asyncWrapperVNFDevRestartRequest struct {
|
||||
VNFDevRestartRequest
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
AsyncMode bool `url:"async_mode"`
|
||||
}
|
||||
|
||||
// VNFDevRestart reboots VINSes primary VNF device
|
||||
|
||||
@@ -18,7 +18,7 @@ type VNFDevStartRequest struct {
|
||||
|
||||
type asyncWrapperVNFDevStartRequest struct {
|
||||
VNFDevStartRequest
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
AsyncMode bool `url:"async_mode"`
|
||||
}
|
||||
|
||||
// VNFDevStart starts VINSes primary VNF device
|
||||
|
||||
Reference in New Issue
Block a user