v1.9.0
This commit is contained in:
@@ -17,11 +17,22 @@ type EnableRequest struct {
|
||||
// Required: false
|
||||
Message string `url:"message,omitempty" json:"message,omitempty"`
|
||||
|
||||
// Do not check locks, iscsi-sessions or disk-present
|
||||
// Default: true
|
||||
// Required: false
|
||||
Force interface{} `url:"force" json:"force" validate:"isBool" `
|
||||
|
||||
// Reason
|
||||
// Required: false
|
||||
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperEnableRequest struct {
|
||||
EnableRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// Enable enables node from maintenance status to enabled
|
||||
func (n Node) Enable(ctx context.Context, req EnableRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -29,9 +40,44 @@ func (n Node) Enable(ctx context.Context, req EnableRequest) (string, error) {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
if req.Force == nil {
|
||||
req.Force = true
|
||||
}
|
||||
|
||||
reqWrapped := wrapperEnableRequest{
|
||||
EnableRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/node/enable"
|
||||
|
||||
res, err := n.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := n.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
// EnableAsync enables node from maintenance status to enabled with AsyncMode
|
||||
func (n Node) EnableAsync(ctx context.Context, req EnableRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
if req.Force == nil {
|
||||
req.Force = true
|
||||
}
|
||||
|
||||
reqWrapped := wrapperEnableRequest{
|
||||
EnableRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/node/enable"
|
||||
|
||||
res, err := n.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -16,10 +16,6 @@ type EnableNodesRequest struct {
|
||||
// Message
|
||||
// Required: false
|
||||
Message string `url:"message,omitempty" json:"message,omitempty"`
|
||||
|
||||
// Reason
|
||||
// Required: false
|
||||
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
|
||||
}
|
||||
|
||||
// EnableNodes enables nodes from maintenance status to enabled
|
||||
|
||||
Reference in New Issue
Block a user