This commit is contained in:
2023-10-25 17:37:18 +03:00
parent b666789c7d
commit 4120cd2b1a
639 changed files with 2010 additions and 3224 deletions

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for create backend
// BackendCreateRequest struct to create backend
type BackendCreateRequest struct {
// ID of the load balancer instance to backendCreate
// Required: true
@@ -67,13 +67,11 @@ type BackendCreateRequest struct {
Weight uint64 `url:"weight,omitempty" json:"weight,omitempty"`
}
// BackendCreate creates new backend on the specified load balancer
// BackendCreate creates new backend on the specified load balancer
func (lb LB) BackendCreate(ctx context.Context, req BackendCreateRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/backendCreate"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for delete backend
// BackendDeleteRequest struct to delete backend
type BackendDeleteRequest struct {
// ID of the load balancer instance to BackendDelete
// Required: true
@@ -24,9 +24,7 @@ type BackendDeleteRequest struct {
func (lb LB) BackendDelete(ctx context.Context, req BackendDeleteRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/backendDelete"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for add server definition to the backend
// BackendServerAddRequest struct to add server definition to the backend
type BackendServerAddRequest struct {
// ID of the load balancer instance to BackendServerAdd
// Required: true
@@ -76,9 +76,7 @@ type BackendServerAddRequest struct {
func (lb LB) BackendServerAdd(ctx context.Context, req BackendServerAddRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/backendServerAdd"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for delete server definition
// BackendServerDeleteRequest struct to delete server definition
type BackendServerDeleteRequest struct {
// ID of the load balancer instance to BackendServerDelete
// Required: true
@@ -28,9 +28,7 @@ type BackendServerDeleteRequest struct {
func (lb LB) BackendServerDelete(ctx context.Context, req BackendServerDeleteRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/backendServerDelete"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for update server
// BackendServerUpdateRequest struct to update server
type BackendServerUpdateRequest struct {
// ID of the load balancer instance to BackendServerAdd
// Required: true
@@ -76,9 +76,7 @@ type BackendServerUpdateRequest struct {
func (lb LB) BackendServerUpdate(ctx context.Context, req BackendServerUpdateRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/backendServerUpdate"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for update backend
// BackendUpdateRequest struct to update backend
type BackendUpdateRequest struct {
// ID of the load balancer instance to backendCreate
// Required: true
@@ -71,9 +71,7 @@ type BackendUpdateRequest struct {
func (lb LB) BackendUpdate(ctx context.Context, req BackendUpdateRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/backendUpdate"

View File

@@ -8,21 +8,19 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for reset config
// ConfigResetRequest struct to reset config
type ConfigResetRequest struct {
// ID of the load balancer instance to ConfigReset
// Required: true
LBID uint64 `url:"lbId" json:"lbId" validate:"required"`
}
// ConfigReset reset current software configuration of the specified load balancer.
// ConfigReset resets current software configuration of the specified load balancer.
// Warning: this action cannot be undone!
func (lb LB) ConfigReset(ctx context.Context, req ConfigResetRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/configReset"

View File

@@ -12,7 +12,7 @@ import (
type Params []string
// Request struct for create load balancer
// CreateRequest struct to create load balancer
type CreateRequest struct {
// ID of the resource group where this load balancer instance will be located
// Required: true
@@ -57,9 +57,7 @@ type wrapperCreateRequest struct {
func (lb LB) Create(ctx context.Context, req CreateRequest) (uint64, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return 0, validators.ValidationError(validationError)
}
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
if req.ExtNetID == 0 && req.VINSID == 0 {

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for delete load balancer
// DeleteRequest struct to delete load balancer
type DeleteRequest struct {
// ID of the load balancer instance to delete
// Required: true
@@ -23,9 +23,7 @@ type DeleteRequest struct {
func (lb LB) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/delete"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for disable load balancer
// DisableRequest struct to disable load balancer
type DisableRequest struct {
// ID of the load balancer instance to disable
// Required: true
@@ -19,9 +19,7 @@ type DisableRequest struct {
func (lb LB) Disable(ctx context.Context, req DisableRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/disable"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for enable load balancer
// EnableRequest struct to enable load balancer
type EnableRequest struct {
// ID of the load balancer instance to enable
// Required: true
@@ -19,9 +19,7 @@ type EnableRequest struct {
func (lb LB) Enable(ctx context.Context, req EnableRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/enable"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for frontend bind
// FrontendBindRequest struct for frontend bind
type FrontendBindRequest struct {
// ID of the load balancer instance to FrontendBind
// Required: true
@@ -38,9 +38,7 @@ type FrontendBindRequest struct {
func (lb LB) FrontendBind(ctx context.Context, req FrontendBindRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/frontendBind"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for delete bind
// FrontendBindDeleteRequest struct to delete bind
type FrontendBindDeleteRequest struct {
// ID of the load balancer instance to FrontendBindDelete
// Required: true
@@ -27,9 +27,7 @@ type FrontendBindDeleteRequest struct {
func (lb LB) FrontendBindDelete(ctx context.Context, req FrontendBindDeleteRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/frontendBindDelete"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for update binding
// FrontendBindUpdateRequest struct for update binding
type FrontendBindUpdateRequest struct {
// ID of the load balancer instance to FrontendBindUpdate
// Required: true
@@ -38,9 +38,7 @@ type FrontendBindUpdateRequest struct {
func (lb LB) FrontendBindUpdate(ctx context.Context, req FrontendBindUpdateRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/frontendBindingUpdate"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for create frontend
// FrontendCreateRequest struct for create frontend
type FrontendCreateRequest struct {
// ID of the load balancer instance to FrontendCreate
// Required: true
@@ -29,9 +29,7 @@ type FrontendCreateRequest struct {
func (l LB) FrontendCreate(ctx context.Context, req FrontendCreateRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/frontendCreate"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for delete frontend
// FrontendDeleteRequest struct for delete frontend
type FrontendDeleteRequest struct {
// ID of the load balancer instance to FrontendDelete
// Required: true
@@ -24,9 +24,7 @@ type FrontendDeleteRequest struct {
func (lb LB) FrontendDelete(ctx context.Context, req FrontendDeleteRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/frontendDelete"

View File

@@ -36,9 +36,7 @@ func (lb LB) Get(ctx context.Context, req GetRequest) (*RecordLB, error) {
func (lb LB) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return nil, validators.ValidationError(validationError)
}
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/get"

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// Request struct for get list of deleted load balancers
// ListDeletedRequest struct to get list of deleted load balancers
type ListDeletedRequest struct {
// Find by ID
// Required: false
@@ -62,5 +62,4 @@ func (lb LB) ListDeleted(ctx context.Context, req ListDeletedRequest) (*ListLB,
}
return &list, nil
}

View File

@@ -8,20 +8,18 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for make Load Balancer Highly available
// HighlyAvailableRequest struct to make Load Balancer Highly available
type HighlyAvailableRequest struct {
// ID of the LB instance
// Required: true
LBID uint64 `url:"lbId" json:"lbId" validate:"required"`
}
// Make Load Balancer Highly available
// HighlyAvailable makes Load Balancer Highly available
func (l LB) HighlyAvailable(ctx context.Context, req HighlyAvailableRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/makeHighlyAvailable"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for restart load balancer
// RestartRequest struct to restart load balancer
type RestartRequest struct {
// ID of the load balancer instance to restart
// Required: true
@@ -19,9 +19,7 @@ type RestartRequest struct {
func (lb LB) Restart(ctx context.Context, req RestartRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/restart"

View File

@@ -8,20 +8,18 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for restore load balancer
// RestoreRequest struct to restore load balancer
type RestoreRequest struct {
// ID of the load balancer instance to restore
// Required: true
LBID uint64 `url:"lbId" json:"lbId" validate:"required"`
}
// Restore restore load balancer from recycle bin
// Restore restores load balancer from recycle bin
func (lb LB) Restore(ctx context.Context, req RestoreRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/restore"

View File

@@ -8,20 +8,18 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for start load balancer
// StartRequest struct to start load balancer
type StartRequest struct {
// ID of the LB instance to start
// Required: true
LBID uint64 `url:"lbId" json:"lbId" validate:"required"`
LBID uint64 `url:"lbId" json:"lbId" validate:"required"`
}
// Start starts specified load balancer instance
func (lb LB) Start(ctx context.Context, req StartRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/start"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for stop load balancer
// StopRequest struct to stop load balancer
type StopRequest struct {
// ID of the LB instance to stop
// Required: true
@@ -19,9 +19,7 @@ type StopRequest struct {
func (lb LB) Stop(ctx context.Context, req StopRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/stop"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for update load balancer
// UpdateRequest struct to update load balancer
type UpdateRequest struct {
// ID of the load balancer to update
// Required: true
@@ -24,9 +24,7 @@ type UpdateRequest struct {
func (lb LB) Update(ctx context.Context, req UpdateRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/lb/update"

View File

@@ -9,7 +9,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for update sysct params for lb
// UpdateSysctParamsRequest struct to update sysct params for lb
type UpdateSysctParamsRequest struct {
// ID of the LB instance
// Required: true
@@ -25,13 +25,11 @@ type wrapperUpdateSysctParamsRequest struct {
Params []string `url:"sysctlParams" validate:"required"`
}
// Create method will create a new load balancer instance
// UpdateSysctParams method will create a new load balancer instance
func (l LB) UpdateSysctParams(ctx context.Context, req UpdateSysctParamsRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return false, validators.ValidationError(validationError)
}
return false, validators.ValidationErrors(validators.GetErrors(err))
}
var params []string