You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
893 B
37 lines
893 B
package node
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
|
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
|
)
|
|
|
|
// EnableNodesRequest struct to enable nodes from maintenance status to enabled
|
|
type EnableNodesRequest struct {
|
|
// List of Node IDs
|
|
// Required: true
|
|
NIDs []uint64 `url:"nids" json:"nids" validate:"required"`
|
|
|
|
// Message
|
|
// Required: false
|
|
Message string `url:"message,omitempty" json:"message,omitempty"`
|
|
}
|
|
|
|
// EnableNodes enables nodes from maintenance status to enabled
|
|
func (n Node) EnableNodes(ctx context.Context, req EnableNodesRequest) (string, error) {
|
|
err := validators.ValidateRequest(req)
|
|
if err != nil {
|
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
|
}
|
|
|
|
url := "/cloudbroker/node/enableNodes"
|
|
|
|
res, err := n.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
return string(res), nil
|
|
}
|