47 lines
1.3 KiB
Go
47 lines
1.3 KiB
Go
package disks
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
"strconv"
|
|
|
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
|
)
|
|
|
|
// ReplicationSetScheduleRequest to apply a replication profile schedule to an asynchronous replication pair
|
|
type ReplicationSetScheduleRequest 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"`
|
|
}
|
|
|
|
// ReplicationSetSchedule applies a replication profile schedule to an asynchronous replication pair
|
|
func (d Disks) ReplicationSetSchedule(ctx context.Context, req ReplicationSetScheduleRequest) (bool, error) {
|
|
err := validators.ValidateRequest(req)
|
|
if err != nil {
|
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
|
}
|
|
|
|
url := "/cloudapi/disks/replication_set_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
|
|
}
|