This commit is contained in:
stSolo
2022-12-22 17:56:47 +03:00
parent 8712561853
commit d4b1ab7133
672 changed files with 28509 additions and 4419 deletions

View File

@@ -7,21 +7,28 @@ import (
"strconv"
)
// Request struct for delete server definition
type BackendServerDeleteRequest struct {
LBID uint64 `url:"lbId"`
// ID of the load balancer instance to BackendServerDelete
// Required: true
LBID uint64 `url:"lbId"`
// Must match one of the existing backens - name of the backend to add servers to
// Required: true
BackendName string `url:"backendName"`
ServerName string `url:"serverName"`
// Must be unique among all servers defined for this backend - name of the server definition to add
// Required: true
ServerName string `url:"serverName"`
}
func (lbrq BackendServerDeleteRequest) Validate() error {
func (lbrq BackendServerDeleteRequest) validate() error {
if lbrq.LBID == 0 {
return errors.New("validation-error: field LBID can not be empty or equal to 0")
}
if lbrq.BackendName == "" {
return errors.New("validation-error: field BackendName can not be empty")
}
if lbrq.ServerName == "" {
return errors.New("validation-error: field ServerName can not be empty")
}
@@ -29,8 +36,10 @@ func (lbrq BackendServerDeleteRequest) Validate() error {
return nil
}
// BackendServerDelete deletes server definition from the backend on the specified load balancer.
// Warning: you cannot undo this action!
func (l LB) BackendServerDelete(ctx context.Context, req BackendServerDeleteRequest) (bool, error) {
err := req.Validate()
err := req.validate()
if err != nil {
return false, err
}