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/zone/add_node.go

44 lines
902 B

package zone
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// AddNodeRequest struct to add node to zone
type AddNodeRequest struct {
// ID of zone
// Required: true
ID uint64 `url:"id" json:"id" validate:"required"`
// List of node ids
// Required: true
NodeIDs []uint64 `url:"nodeIds" json:"nodeIds" validate:"required"`
}
// AddNode add nodes to zone
func (e Zone) AddNode(ctx context.Context, req AddNodeRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/zone/addNode"
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}