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,12 +7,18 @@ import (
"strconv"
)
// Request struct for delete load balancer
type DeleteRequest struct {
LBID uint64 `url:"lbId"`
Permanently bool `url:"permanently"`
// ID of the load balancer instance to delete
// Required: true
LBID uint64 `url:"lbId"`
// Set to true to delete load balancer immediately bypassing recycle bin
// Required: false
Permanently bool `url:"permanently,omitempty"`
}
func (lbrq DeleteRequest) Validate() error {
func (lbrq DeleteRequest) validate() error {
if lbrq.LBID == 0 {
return errors.New("validation-error: field LBID can not be empty or equal to 0")
}
@@ -20,8 +26,9 @@ func (lbrq DeleteRequest) Validate() error {
return nil
}
// Delete deletes specified load balancer
func (l LB) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
err := req.Validate()
err := req.validate()
if err != nil {
return false, err
}