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/cloudbroker/sep/update_capacity_limit.go

41 lines
940 B

3 years ago
package sep
import (
"context"
"net/http"
"strconv"
3 years ago
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
3 years ago
)
// Request struct for update capacity limits
type UpdateCapacityLimitRequest struct {
// Storage endpoint provider ID
// Required: true
3 years ago
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
3 years ago
}
// UpdateCapacityLimit updates SEP capacity limit
func (s SEP) UpdateCapacityLimit(ctx context.Context, req UpdateCapacityLimitRequest) (uint64, error) {
3 years ago
err := validators.ValidateRequest(req)
3 years ago
if err != nil {
3 years ago
for _, validationError := range validators.GetErrors(err) {
return 0, validators.ValidationError(validationError)
}
3 years ago
}
url := "/cloudbroker/sep/updateCapacityLimit"
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return 0, err
}
result, err := strconv.ParseUint(string(res), 10, 64)
if err != nil {
return 0, err
}
return result, nil
}