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/cloudapi/lb/frontend_bind_update.go

55 lines
1.6 KiB

package lb
import (
"context"
"net/http"
"strings"
3 years ago
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
2 years ago
// FrontendBindUpdateRequest struct to update binding
type FrontendBindUpdateRequest struct {
3 years ago
// ID of the load balancer instance to FrontendBindUpdate
// Required: true
3 years ago
LBID uint64 `url:"lbId" json:"lbId" validate:"required"`
3 years ago
// Name of the frontend to update
// Required: true
3 years ago
FrontendName string `url:"frontendName" json:"frontendName" validate:"required"`
3 years ago
// Name of the binding to update
// Required: true
3 years ago
BindingName string `url:"bindingName" json:"bindingName" validate:"required"`
3 years ago
// If specified must be within the IP range of either Ext Net or ViNS,
// where this load balancer is connected - new IP address to use for this binding.
// If omitted, current IP address is retained
2 years ago
// Required: true
BindingAddress string `url:"bindingAddress" json:"bindingAddress" validate:"required"`
3 years ago
// New port number to use for this binding.
// If omitted, current port number is retained
2 years ago
// Required: true
BindingPort uint64 `url:"bindingPort" json:"bindingPort" validate:"required"`
}
3 years ago
// FrontendBindUpdate updates binding for the specified load balancer frontend
func (l LB) FrontendBindUpdate(ctx context.Context, req FrontendBindUpdateRequest) (string, error) {
3 years ago
err := validators.ValidateRequest(req)
if err != nil {
2 years ago
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/lb/frontendBindingUpdate"
res, err := l.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return "", err
}
3 years ago
result := strings.ReplaceAll(string(res), "\"", "")
return result, nil
}