v1.14.7
This commit is contained in:
30
pkg/sdn/hypervisors/connect_node.go
Normal file
30
pkg/sdn/hypervisors/connect_node.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user