v1.8.1
This commit is contained in:
@@ -57,7 +57,7 @@ type FromPlatformDiskRequest struct {
|
||||
// List of types of compute suitable for image
|
||||
// Example: [ "KVM_X86" ]
|
||||
// Required: false
|
||||
Drivers []string `url:"drivers" json:"drivers" validate:"min=1,max=2,imageDrivers"`
|
||||
Drivers []string `url:"drivers,omitempty" json:"drivers,omitempty"`
|
||||
|
||||
// Does this machine supports hot resize
|
||||
// Required: false
|
||||
|
||||
@@ -32,7 +32,7 @@ type ListRequest struct {
|
||||
|
||||
// Find by shared, true or false
|
||||
// Required: false
|
||||
Shared bool `url:"shared,omitempty" json:"shared,omitempty"`
|
||||
Shared interface{} `url:"shared,omitempty" json:"shared,omitempty" validate:"omitempty,isBool"`
|
||||
|
||||
// ID of the account the disks belong to
|
||||
// Required: false
|
||||
|
||||
@@ -28,7 +28,7 @@ type ListDeletedRequest struct {
|
||||
|
||||
// Find by shared, true or false
|
||||
// Required: false
|
||||
Shared bool `url:"shared,omitempty" json:"shared,omitempty"`
|
||||
Shared interface{} `url:"shared,omitempty" json:"shared,omitempty" validate:"omitempty,isBool"`
|
||||
|
||||
// ID of the account the disks belong to
|
||||
// Required: false
|
||||
|
||||
@@ -75,7 +75,7 @@ type ItemDisk struct {
|
||||
PurgeTime uint64 `json:"purgeTime"`
|
||||
|
||||
// Replication
|
||||
Replication interface{} `json:"replication"`
|
||||
Replication ItemReplication `json:"replication"`
|
||||
|
||||
// Resource ID
|
||||
ResID string `json:"resId"`
|
||||
@@ -265,8 +265,10 @@ type ListDisks struct {
|
||||
|
||||
// List of unattached disks
|
||||
type ListDisksUnattached struct {
|
||||
// Data
|
||||
Data []ItemDiskUnattached `json:"data"`
|
||||
|
||||
// Entry count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
@@ -407,7 +409,7 @@ type RecordDisk struct {
|
||||
PurgeTime uint64 `json:"purgeTime"`
|
||||
|
||||
// Replication
|
||||
Replication interface{} `json:"replication"`
|
||||
Replication ItemReplication `json:"replication"`
|
||||
|
||||
// Resource ID
|
||||
ResID string `json:"resId"`
|
||||
@@ -449,6 +451,26 @@ type RecordDisk struct {
|
||||
VMID uint64 `json:"vmid"`
|
||||
}
|
||||
|
||||
type ItemReplication struct {
|
||||
// DiskID
|
||||
DiskID uint64 `json:"diskId"`
|
||||
|
||||
// PoolID
|
||||
PoolID string `json:"poolId"`
|
||||
|
||||
// Role
|
||||
Role string `json:"role"`
|
||||
|
||||
// SelfVolumeID
|
||||
SelfVolumeID string `json:"selfVolumeId"`
|
||||
|
||||
// StorageID
|
||||
StorageID string `json:"storageId"`
|
||||
|
||||
// VolumeID
|
||||
VolumeID string `json:"volumeId"`
|
||||
}
|
||||
|
||||
type ListTypes struct {
|
||||
// Data
|
||||
Data []interface{} `json:"data"`
|
||||
|
||||
@@ -15,23 +15,18 @@ type ReplicationStatusRequest struct {
|
||||
}
|
||||
|
||||
// ReplicationStatus get replication status
|
||||
func (d Disks) ReplicationStatus(ctx context.Context, req ReplicationStatusRequest) (interface{}, error) {
|
||||
func (d Disks) ReplicationStatus(ctx context.Context, req ReplicationStatusRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudapi/disks/replicationStatus"
|
||||
|
||||
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return "", err
|
||||
}
|
||||
|
||||
// result, err := strconv.ParseBool(string(res))
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
|
||||
return res, nil
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user