v1.15.5
v1.15.5
This commit is contained in:
@@ -2,8 +2,8 @@ package hypervisors
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
@@ -17,27 +17,21 @@ type DeleteRequest struct {
|
||||
}
|
||||
|
||||
// Delete a hypervisor
|
||||
func (hv Hypervisors) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
||||
func (hv Hypervisors) Delete(ctx context.Context, req DeleteRequest) (*RecordVersion, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/sdn/hypervisor/delete"
|
||||
|
||||
res, err := hv.client.DecortApiCallCtype(ctx, http.MethodDelete, url, constants.MIMEJSON, req)
|
||||
info := RecordVersion{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if string(res) == "" {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
package hypervisors
|
||||
|
||||
// Information about a version
|
||||
type RecordVersion struct {
|
||||
// Version ID
|
||||
VersionID uint64 `json:"version_id"`
|
||||
}
|
||||
|
||||
// Main information about hypervisor
|
||||
type RecordHypervisor struct {
|
||||
// Created at
|
||||
|
||||
Reference in New Issue
Block a user