v16.4.0
v16.4.0
This commit is contained in:
1 parent
4c05d94552
commit
2c7f0d29df
159 files changed
+2249
-216
No files matched your search
@@ -0,0 +1,77 @@
|
||||
package stpolicy
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||
)
|
||||
|
||||
// CalendarRequest struct for replication schedule calendar
|
||||
type CalendarRequest struct {
|
||||
// Weekly schedule
|
||||
// Required: true
|
||||
Weekly []string `url:"weekly" json:"weekly" validate:"required"`
|
||||
}
|
||||
|
||||
// SchedulesRequest struct for replication profile schedule
|
||||
type SchedulesRequest struct {
|
||||
// Type of the schedule
|
||||
// Required: true
|
||||
Type string `url:"type" json:"type" validate:"required"`
|
||||
|
||||
// Name of the schedule
|
||||
// Required: false
|
||||
Name string `url:"name,omitempty" json:"name,omitempty"`
|
||||
|
||||
// Min interval
|
||||
// Required: false
|
||||
MINInterval uint64 `url:"min_interval,omitempty" json:"min_interval,omitempty"`
|
||||
|
||||
// Calendar of the schedule
|
||||
// Required: false
|
||||
Calendar []CalendarRequest `url:"calendar,omitempty" json:"calendar,omitempty" validate:"omitempty,dive"`
|
||||
}
|
||||
|
||||
// CreateReplicationProfileRequest struct to create replication profile
|
||||
type CreateReplicationProfileRequest struct {
|
||||
// Name of the replication profile
|
||||
// Required: true
|
||||
Name string `url:"name" json:"name" validate:"required"`
|
||||
|
||||
// Replication type
|
||||
// Required: true
|
||||
ReplicationType string `url:"replication_type" json:"replication_type" validate:"required"`
|
||||
|
||||
// Max copy rate
|
||||
// Required: false
|
||||
MAXCopyRate uint64 `url:"max_copy_rate,omitempty" json:"max_copy_rate,omitempty"`
|
||||
|
||||
// List of schedules
|
||||
// Required: false
|
||||
Schedules []SchedulesRequest `url:"schedules,omitempty" json:"schedules,omitempty" validate:"omitempty,dive"`
|
||||
}
|
||||
|
||||
// CreateReplicationProfile creates a new replication profile
|
||||
func (sp StPolicy) CreateReplicationProfile(ctx context.Context, req CreateReplicationProfileRequest) (uint64, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/storage_policy/create_replication_profile"
|
||||
|
||||
res, err := sp.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseUint(string(res), 10, 64)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
Reference in new issue
Block a user