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.
dynamix-golang-sdk/pkg/cloudbroker/rg/set_cpu_allocation_paramete...

45 lines
1.2 KiB

package rg
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter
type SetCPUAllocationParameterRequest struct {
// Resource group ID
// Required: true
RGID uint64 `url:"rgId" json:"rgId" validate:"required"`
// CPU allocation parameter.
// If "strict" VM can't be run if not enough CPU resources.
// "loose" allow running VM if not enough resources.
// Required: true
StrictLoose string `url:"strict_loose" json:"strict_loose" validate:"required,strict_loose"`
}
// SetCPUAllocationParameter sets CPU allocation parameter
func (r RG) SetCPUAllocationParameter(ctx context.Context, req SetCPUAllocationParameterRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/rg/setCpuAllocationParameter"
res, err := r.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
}