This commit is contained in:
asteam
2025-09-23 14:34:24 +03:00
parent b924e85e49
commit f1ffb4c0fd
1108 changed files with 72020 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
package bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v9/internal/validators"
)
// GroupResizeRequest struct to resize the group
type GroupResizeRequest struct {
// ID of the Basic Service of Compute Group
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
// ID of the Compute Group to resize
// Required: true
CompGroupID uint64 `url:"compgroupId" json:"compgroupId" validate:"required"`
// Either delta or absolute value of computes
// Required: true
Count int64 `url:"count" json:"count" validate:"required"`
// Either delta or absolute value of computes
// Should be one of:
// - ABSOLUTE
// - RELATIVE
// Required: true
Mode string `url:"mode" json:"mode" validate:"bserviceMode"`
}
// GroupResize resize the group by changing the number of computes
func (b BService) GroupResize(ctx context.Context, req GroupResizeRequest) (uint64, error) {
err := validators.ValidateRequest(req)
if err != nil {
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/bservice/groupResize"
res, err := b.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
}