v1.15.5
This commit is contained in:
dayterr
2026-07-10 15:37:02 +03:00
parent 6ff4b83368
commit 416a6c4263
15 changed files with 571 additions and 100 deletions

View File

@@ -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
}

View File

@@ -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