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
@@ -71,9 +71,7 @@ type BackendCreateRequest struct {
func (l 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 := "/cloudapi/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 (l 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 := "/cloudapi/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 (l 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 := "/cloudapi/lb/backendServerAdd"

View File

@@ -8,13 +8,13 @@ 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
LBID uint64 `url:"lbId" json:"lbId" validate:"required"`
// Must match one of the existing backens - name of the backend to add servers to
// Must match one of the existing backends - name of the backend to add servers to
// Required: true
BackendName string `url:"backendName" json:"backendName" validate:"required"`
@@ -28,9 +28,7 @@ type BackendServerDeleteRequest struct {
func (l 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 := "/cloudapi/lb/backendServerDelete"

View File

@@ -8,13 +8,13 @@ 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
LBID uint64 `url:"lbId" json:"lbId" validate:"required"`
// Must match one of the existing backens - name of the backend to add servers to
// Must match one of the existing backends - name of the backend to add servers to
// Required: true
BackendName string `url:"backendName" json:"backendName" validate:"required"`
@@ -76,9 +76,7 @@ type BackendServerUpdateRequest struct {
func (l 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 := "/cloudapi/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 (l 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 := "/cloudapi/lb/backendUpdate"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for reset config
// ConfigResetRequest struct for reset config
type ConfigResetRequest struct {
// ID of the load balancer instance to ConfigReset
// Required: true
@@ -20,9 +20,7 @@ type ConfigResetRequest struct {
func (l 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 := "/cloudapi/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 (l 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 (l 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 := "/cloudapi/lb/delete"

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for disable/enable load balancer
// DisableEnableRequest struct for disable/enable load balancer
type DisableEnableRequest struct {
// ID of the load balancer instance to disable/enable
// Required: true
@@ -19,9 +19,7 @@ type DisableEnableRequest struct {
func (l LB) Disable(ctx context.Context, req DisableEnableRequest) (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 := "/cloudapi/lb/disable"
@@ -43,9 +41,7 @@ func (l LB) Disable(ctx context.Context, req DisableEnableRequest) (bool, error)
func (l LB) Enable(ctx context.Context, req DisableEnableRequest) (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 := "/cloudapi/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 (l LB) FrontendBind(ctx context.Context, req FrontendBindRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return "", validators.ValidationError(validationError)
}
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/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 (l LB) FrontendBindDelete(ctx context.Context, req FrontendBindDeleteRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return "", validators.ValidationError(validationError)
}
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/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 to update binding
type FrontendBindUpdateRequest struct {
// ID of the load balancer instance to FrontendBindUpdate
// Required: true
@@ -38,9 +38,7 @@ type FrontendBindUpdateRequest struct {
func (l LB) FrontendBindUpdate(ctx context.Context, req FrontendBindUpdateRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return "", validators.ValidationError(validationError)
}
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/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 to 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 := "/cloudapi/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 to delete frontend
type FrontendDeleteRequest struct {
// ID of the load balancer instance to FrontendDelete
// Required: true
@@ -24,9 +24,7 @@ type FrontendDeleteRequest struct {
func (l 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 := "/cloudapi/lb/frontendDelete"

View File

@@ -36,9 +36,7 @@ func (l LB) Get(ctx context.Context, req GetRequest) (*RecordLB, error) {
func (l 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 := "/cloudapi/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

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) (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))
}
url := "/cloudapi/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 (l 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 := "/cloudapi/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 (l 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 := "/cloudapi/lb/restore"

View File

@@ -8,7 +8,7 @@ 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 load balancer instance to start
// Required: true
@@ -19,9 +19,7 @@ type StartRequest struct {
func (l 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 := "/cloudapi/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 load balancer instance to stop
// Required: true
@@ -19,9 +19,7 @@ type StopRequest struct {
func (l 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 := "/cloudapi/lb/start"

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 (l 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 := "/cloudapi/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 updates sysct paarams for lb
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