v16.10.0
This commit is contained in:
aafetisov committed 2026-10-30 16:04:15 +03:00
1 parent bc8c2b40e9
commit 00994516ba
52 files changed
+2287 -98

No files matched your search

@@ -19,6 +19,12 @@ type SetCPUAllocationRatioRequest struct {
Ratio uint64 `url:"ratio" json:"ratio" validate:"required"`
}
type wrapperSetCPUAllocationRatioRequest struct {
SetCPUAllocationRatioRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// SetCPUAllocationRatio sets CPU allocation ratio
func (a Account) SetCPUAllocationRatio(ctx context.Context, req SetCPUAllocationRatioRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -28,7 +34,12 @@ func (a Account) SetCPUAllocationRatio(ctx context.Context, req SetCPUAllocation
url := "/cloudbroker/account/setCpuAllocationRatio"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperSetCPUAllocationRatioRequest{
SetCPUAllocationRatioRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -40,3 +51,25 @@ func (a Account) SetCPUAllocationRatio(ctx context.Context, req SetCPUAllocation
return result, nil
}
// SetCPUAllocationRatioAsync sets CPU allocation ratio in async mode
func (a Account) SetCPUAllocationRatioAsync(ctx context.Context, req SetCPUAllocationRatioRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/setCpuAllocationRatio"
reqWrapped := wrapperSetCPUAllocationRatioRequest{
SetCPUAllocationRatioRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}