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.
decort-golang-sdk/pkg/cloudbroker/node/enable.go

41 lines
943 B

package node
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// EnableRequest struct to enable node from maintenance status to enabled
type EnableRequest struct {
// Node ID
// Required: true
NID uint64 `url:"nid" json:"nid" validate:"required"`
// Message
// Required: false
Message string `url:"message,omitempty" json:"message,omitempty"`
// Reason
// Required: false
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
}
// Enable enables node from maintenance status to enabled
func (n Node) Enable(ctx context.Context, req EnableRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/node/enable"
res, err := n.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return "", err
}
return string(res), nil
}