This commit is contained in:
dayterr
2026-04-10 16:38:00 +03:00
parent 30e464e4d2
commit 5cdae8520f
16 changed files with 458 additions and 62 deletions

View File

@@ -0,0 +1,30 @@
package hypervisors
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// ConnectNodeRequest to connect a node
type ConnectNodeRequest struct {
// Node to connect
// Required: true
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
}
func (hv Hypervisors) ConnectNode(ctx context.Context, req ConnectNodeRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/sdn/hypervisor/connect_node"
result, err := hv.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return "", err
}
return string(result), nil
}