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

@@ -20,6 +20,12 @@ type SetCPUAllocationParameterRequest struct {
StrictLoose string `url:"strict_loose" json:"strict_loose" validate:"required,strict_loose"`
}
type wrapperSetCPUAllocationParameterRequest struct {
SetCPUAllocationParameterRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// SetCPUAllocationParameter sets CPU allocation parameter
func (a Account) SetCPUAllocationParameter(ctx context.Context, req SetCPUAllocationParameterRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -29,7 +35,12 @@ func (a Account) SetCPUAllocationParameter(ctx context.Context, req SetCPUAlloca
url := "/cloudbroker/account/setCpuAllocationParameter"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperSetCPUAllocationParameterRequest{
SetCPUAllocationParameterRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -41,3 +52,25 @@ func (a Account) SetCPUAllocationParameter(ctx context.Context, req SetCPUAlloca
return result, nil
}
// SetCPUAllocationParameterAsync sets CPU allocation parameter in async mode
func (a Account) SetCPUAllocationParameterAsync(ctx context.Context, req SetCPUAllocationParameterRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/setCpuAllocationParameter"
reqWrapped := wrapperSetCPUAllocationParameterRequest{
SetCPUAllocationParameterRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}