v1.3.0
This commit is contained in:
@@ -2,31 +2,26 @@ package sep
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for enable SEP
|
||||
type EnableRequest struct {
|
||||
// Storage endpoint provider ID
|
||||
// Required: true
|
||||
SEPID uint64 `url:"sep_id" json:"sep_id"`
|
||||
}
|
||||
|
||||
func (srq EnableRequest) validate() error {
|
||||
if srq.SEPID == 0 {
|
||||
return errors.New("validation-error: field SEPID must be set")
|
||||
}
|
||||
|
||||
return nil
|
||||
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
|
||||
}
|
||||
|
||||
// Enable enables SEP by ID
|
||||
func (s SEP) Enable(ctx context.Context, req EnableRequest) (bool, error) {
|
||||
err := req.validate()
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/sep/enable"
|
||||
|
||||
Reference in New Issue
Block a user