v1.16.7
v1.16.7
This commit is contained in:
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
|
||||
}
|
||||
Reference in New Issue
Block a user