49 lines
1.1 KiB
Go
49 lines
1.1 KiB
Go
package sep
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
"strconv"
|
|
|
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
|
)
|
|
|
|
// UpdateRequest struct to update SEP object
|
|
type UpdateRequest struct {
|
|
// ID of SEP to update
|
|
// Required: true
|
|
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required,min=1"`
|
|
|
|
// New SEP name
|
|
// Required: false
|
|
// Default: null
|
|
SEPName string `url:"name,omitempty" json:"name,omitempty" validate:"omitempty,min=1,max=256,sepName"`
|
|
|
|
// New description
|
|
// Required: false
|
|
// Default: null
|
|
Description string `url:"description,omitempty" json:"description,omitempty" validate:"omitempty,max=4096,sepDescription"`
|
|
}
|
|
|
|
// Update updates SEP object
|
|
func (s SEP) Update(ctx context.Context, req UpdateRequest) (bool, error) {
|
|
err := validators.ValidateRequest(req)
|
|
if err != nil {
|
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
|
}
|
|
|
|
url := "/cloudbroker/sep/update"
|
|
|
|
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
|
if err != nil {
|
|
return false, err
|
|
}
|
|
|
|
result, err := strconv.ParseBool(string(res))
|
|
if err != nil {
|
|
return false, err
|
|
}
|
|
|
|
return result, nil
|
|
}
|