package account import ( "context" "net/http" "strconv" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v9/internal/validators" ) // SetCPUAllocationParameterRequest struct for setting CPU allocation parameter type SetCPUAllocationParameterRequest struct { // Account ID // Required: true AccountID uint64 `url:"accountId" json:"accountId" 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 (a Account) SetCPUAllocationParameter(ctx context.Context, req SetCPUAllocationParameterRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/setCpuAllocationParameter" res, err := a.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 }