v1.3.0
This commit is contained in:
@@ -2,45 +2,34 @@ package grid
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for location code
|
||||
type AddRequest struct {
|
||||
// Grid (platform) ID
|
||||
// Required: true
|
||||
GID uint64 `url:"gid" json:"gid"`
|
||||
GID uint64 `url:"gid" json:"gid" validate:"required"`
|
||||
|
||||
// Name of the location
|
||||
// Required: true
|
||||
Name string `url:"name" json:"name"`
|
||||
Name string `url:"name" json:"name" validate:"required"`
|
||||
|
||||
// Location code typicly used in dns names
|
||||
// Required: true
|
||||
LocationCode string `url:"locationcode" json:"locationcode"`
|
||||
}
|
||||
|
||||
func (grq AddRequest) validate() error {
|
||||
if grq.GID == 0 {
|
||||
return errors.New("validation-error: field GID must be set")
|
||||
}
|
||||
if grq.Name == "" {
|
||||
return errors.New("validation-error: field Name must be set")
|
||||
}
|
||||
if grq.LocationCode == "" {
|
||||
return errors.New("validation-error: field LocationCode must be set")
|
||||
}
|
||||
|
||||
return nil
|
||||
LocationCode string `url:"locationcode" json:"locationcode" validate:"required"`
|
||||
}
|
||||
|
||||
// Add location code (e.g. DNS name of this grid)
|
||||
func (g Grid) Add(ctx context.Context, req AddRequest) (bool, error) {
|
||||
err := req.validate()
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/add"
|
||||
|
||||
@@ -2,38 +2,30 @@ package grid
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for change grid settings
|
||||
type ChangeSettingsRequest struct {
|
||||
// Grid (platform) ID
|
||||
// Required: true
|
||||
GID uint64 `url:"id" json:"id"`
|
||||
GID uint64 `url:"id" json:"id" validate:"required"`
|
||||
|
||||
// Json data of the new settings will override old data
|
||||
// Required: true
|
||||
Settings string `url:"settings" json:"settings"`
|
||||
}
|
||||
|
||||
func (grq ChangeSettingsRequest) validate() error {
|
||||
if grq.GID == 0 {
|
||||
return errors.New("validation-error: field GID must be set")
|
||||
}
|
||||
if grq.Settings == "" {
|
||||
return errors.New("validation-error: field Settings must be set")
|
||||
}
|
||||
|
||||
return nil
|
||||
Settings string `url:"settings" json:"settings" validate:"required"`
|
||||
}
|
||||
|
||||
// ChangeSettings changes grid settings
|
||||
func (g Grid) ChangeSettings(ctx context.Context, req ChangeSettingsRequest) (bool, error) {
|
||||
err := req.validate()
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/changeSettings"
|
||||
|
||||
@@ -2,31 +2,26 @@ package grid
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for check virtual machine
|
||||
type CheckVMsRequest struct {
|
||||
// Grid (platform) ID
|
||||
// Required: true
|
||||
GID uint64 `url:"gid" json:"gid"`
|
||||
}
|
||||
|
||||
func (grq CheckVMsRequest) validate() error {
|
||||
if grq.GID == 0 {
|
||||
return errors.New("validation-error: field GID must be set")
|
||||
}
|
||||
|
||||
return nil
|
||||
GID uint64 `url:"gid" json:"gid" validate:"required"`
|
||||
}
|
||||
|
||||
// CheckVMs run checkvms jumpscript
|
||||
func (g Grid) CheckVMs(ctx context.Context, req CheckVMsRequest) (bool, error) {
|
||||
err := req.validate()
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/checkVMs"
|
||||
|
||||
@@ -2,31 +2,32 @@ package grid
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for create system space
|
||||
type CreateSystemSpaceRequest struct {
|
||||
// Grid (platform) ID
|
||||
// Required: true
|
||||
GID uint64 `url:"id" json:"id"`
|
||||
GID uint64 `url:"id" json:"id" validate:"required"`
|
||||
|
||||
// Name of the account/cloudspace to be created for the system
|
||||
// Required: true
|
||||
Name string `url:"name" json:"name"`
|
||||
Name string `url:"name" json:"name" validate:"required"`
|
||||
|
||||
// ID of the specific image
|
||||
// Required: true
|
||||
ImageID uint64 `url:"imageId" json:"imageId"`
|
||||
ImageID uint64 `url:"imageId" json:"imageId" validate:"required"`
|
||||
|
||||
// Size of base volume
|
||||
// Required: true
|
||||
BootSize uint64 `url:"bootsize" json:"bootsize"`
|
||||
BootSize uint64 `url:"bootsize" json:"bootsize" validate:"required"`
|
||||
|
||||
// Data disk size in gigabytes
|
||||
// Required: true
|
||||
DataDiskSize uint64 `url:"dataDiskSize" json:"dataDiskSize"`
|
||||
DataDiskSize uint64 `url:"dataDiskSize" json:"dataDiskSize" validate:"required"`
|
||||
|
||||
// ID of the specific size
|
||||
// Required: false
|
||||
@@ -41,31 +42,13 @@ type CreateSystemSpaceRequest struct {
|
||||
Memory uint64 `url:"memory,omitempty" json:"memory,omitempty"`
|
||||
}
|
||||
|
||||
func (grq CreateSystemSpaceRequest) validate() error {
|
||||
if grq.GID == 0 {
|
||||
return errors.New("validation-error: field GID must be set")
|
||||
}
|
||||
if grq.Name == "" {
|
||||
return errors.New("validation-error: field Name must be set")
|
||||
}
|
||||
if grq.BootSize == 0 {
|
||||
return errors.New("validation-error: field BootSize must be set")
|
||||
}
|
||||
if grq.ImageID == 0 {
|
||||
return errors.New("validation-error: field ImageID must be set")
|
||||
}
|
||||
if grq.DataDiskSize == 0 {
|
||||
return errors.New("validation-error: field DataDiskSize must be set")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// CreateSystemSpace creates system space
|
||||
func (g Grid) CreateSystemSpace(ctx context.Context, req CreateSystemSpaceRequest) (string, error) {
|
||||
err := req.validate()
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return "", validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/createSystemSpace"
|
||||
|
||||
@@ -2,45 +2,34 @@ package grid
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for execute script
|
||||
type ExecuteMaintenanceScriptRequest struct {
|
||||
// Grid (platform) ID
|
||||
// Required: true
|
||||
GID string `url:"gid" json:"gid"`
|
||||
GID string `url:"gid" json:"gid" validate:"required"`
|
||||
|
||||
// Type of nodes you want to apply the action on
|
||||
// Required: true
|
||||
NodesType string `url:"nodestype" json:"nodestype"`
|
||||
NodesType string `url:"nodestype" json:"nodestype" validate:"required"`
|
||||
|
||||
// The script you want to run
|
||||
// Required: true
|
||||
Script string `url:"script" json:"script"`
|
||||
}
|
||||
|
||||
func (grq ExecuteMaintenanceScriptRequest) validate() error {
|
||||
if grq.GID == "" {
|
||||
return errors.New("validation-error: field GID must be set")
|
||||
}
|
||||
if grq.NodesType == "" {
|
||||
return errors.New("validation-error: field NodesType must be set")
|
||||
}
|
||||
if grq.Script == "" {
|
||||
return errors.New("validation-error: field Script must be set")
|
||||
}
|
||||
|
||||
return nil
|
||||
Script string `url:"script" json:"script" validate:"required"`
|
||||
}
|
||||
|
||||
// ExecuteMaintenanceScript executes maintenance script
|
||||
func (g Grid) ExecuteMaintenanceScript(ctx context.Context, req ExecuteMaintenanceScriptRequest) (bool, error) {
|
||||
err := req.validate()
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/executeMaintenanceScript"
|
||||
|
||||
@@ -3,30 +3,25 @@ package grid
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get grid details
|
||||
type GetRequest struct {
|
||||
// Grid (platform) ID
|
||||
// Required: true
|
||||
GID uint64 `url:"gridId" json:"gridId"`
|
||||
}
|
||||
|
||||
func (grq GetRequest) validate() error {
|
||||
if grq.GID == 0 {
|
||||
return errors.New("validation-error: field GID must be set")
|
||||
}
|
||||
|
||||
return nil
|
||||
GID uint64 `url:"gridId" json:"gridId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets information about grid by ID
|
||||
func (g Grid) Get(ctx context.Context, req GetRequest) (*RecordGrid, error) {
|
||||
err := req.validate()
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/get"
|
||||
|
||||
@@ -2,30 +2,25 @@ package grid
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get backup
|
||||
type GetBackupRequest struct {
|
||||
// Grid (platform) ID
|
||||
// Required: true
|
||||
GID uint64 `url:"gid" json:"gid"`
|
||||
}
|
||||
|
||||
func (grq GetBackupRequest) validate() error {
|
||||
if grq.GID == 0 {
|
||||
return errors.New("validation-error: field GID must be set")
|
||||
}
|
||||
|
||||
return nil
|
||||
GID uint64 `url:"gid" json:"gid" validate:"required"`
|
||||
}
|
||||
|
||||
// GetBackup gets platform backup
|
||||
func (g Grid) GetBackup(ctx context.Context, req GetBackupRequest) (string, error) {
|
||||
err := req.validate()
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return "", validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/getBackup"
|
||||
@@ -40,9 +35,11 @@ func (g Grid) GetBackup(ctx context.Context, req GetBackupRequest) (string, erro
|
||||
|
||||
// GetBackupGET gets platform backup
|
||||
func (g Grid) GetBackupGET(ctx context.Context, req GetBackupRequest) (string, error) {
|
||||
err := req.validate()
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return "", validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/getBackup"
|
||||
|
||||
@@ -2,30 +2,25 @@ package grid
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get platform snapshot with additional diagnosis
|
||||
type GetDiagnosisRequest struct {
|
||||
// Grid (platform) ID
|
||||
// Required: true
|
||||
GID uint64 `url:"gid" json:"gid"`
|
||||
}
|
||||
|
||||
func (grq GetDiagnosisRequest) validate() error {
|
||||
if grq.GID == 0 {
|
||||
return errors.New("validation-error: field GID must be set")
|
||||
}
|
||||
|
||||
return nil
|
||||
GID uint64 `url:"gid" json:"gid" validate:"required"`
|
||||
}
|
||||
|
||||
// GetDiagnosis get platform snapshot with additional diagnosis info like a logs, etc
|
||||
func (g Grid) GetDiagnosis(ctx context.Context, req GetDiagnosisRequest) (string, error) {
|
||||
err := req.validate()
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return "", validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/getDiagnosis"
|
||||
@@ -40,9 +35,11 @@ func (g Grid) GetDiagnosis(ctx context.Context, req GetDiagnosisRequest) (string
|
||||
|
||||
// GetDiagnosisGET get platform snapshot with additional diagnosis info like a logs, etc
|
||||
func (g Grid) GetDiagnosisGET(ctx context.Context, req GetDiagnosisRequest) (string, error) {
|
||||
err := req.validate()
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return "", validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/getDiagnosis"
|
||||
|
||||
@@ -15,7 +15,7 @@ type RecordResource struct {
|
||||
CPU uint64 `json:"cpu"`
|
||||
|
||||
// Disk size
|
||||
DiskSize uint64 `json:"disksize"`
|
||||
DiskSize float64 `json:"disksize"`
|
||||
|
||||
// Disk size max
|
||||
DiskSizeMax int64 `json:"disksizemax"`
|
||||
|
||||
@@ -2,39 +2,31 @@ package grid
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for purge logs
|
||||
type PurgeLogsRequest struct {
|
||||
// Grid (platform) ID
|
||||
// Required: true
|
||||
GID uint64 `url:"gid" json:"gid"`
|
||||
GID uint64 `url:"gid" json:"gid" validate:"required"`
|
||||
|
||||
// Age of the records to remove, e.g. -1h for records older than 1 hour, -1w - one week, etc
|
||||
// Required: true
|
||||
Age string `url:"age" json:"age"`
|
||||
}
|
||||
|
||||
func (grq PurgeLogsRequest) validate() error {
|
||||
if grq.GID == 0 {
|
||||
return errors.New("validation-error: field GID must be set")
|
||||
}
|
||||
if grq.Age == "" {
|
||||
return errors.New("validation-error: field Age must be set")
|
||||
}
|
||||
|
||||
return nil
|
||||
Age string `url:"age" json:"age" validate:"required"`
|
||||
}
|
||||
|
||||
// PurgeLogs clear Log and ECO records that are older than the specified age.
|
||||
// By default, records older than one week are removed
|
||||
func (g Grid) PurgeLogs(ctx context.Context, req PurgeLogsRequest) (bool, error) {
|
||||
err := req.validate()
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/purgeLogs"
|
||||
|
||||
@@ -2,38 +2,30 @@ package grid
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for rename grid
|
||||
type RenameRequest struct {
|
||||
// Grid (platform) ID
|
||||
// Required: true
|
||||
GID uint64 `url:"gid" json:"gid"`
|
||||
GID uint64 `url:"gid" json:"gid" validate:"required"`
|
||||
|
||||
// New name
|
||||
// Required: true
|
||||
Name string `url:"Name" json:"Name"`
|
||||
}
|
||||
|
||||
func (grq RenameRequest) validate() error {
|
||||
if grq.GID == 0 {
|
||||
return errors.New("validation-error: field GID must be set")
|
||||
}
|
||||
if grq.Name == "" {
|
||||
return errors.New("validation-error: field Name must be set")
|
||||
}
|
||||
|
||||
return nil
|
||||
Name string `url:"Name" json:"Name" validate:"required"`
|
||||
}
|
||||
|
||||
// Rename renames a grid
|
||||
func (g Grid) Rename(ctx context.Context, req RenameRequest) (bool, error) {
|
||||
err := req.validate()
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/rename"
|
||||
|
||||
@@ -2,38 +2,30 @@ package grid
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for restart services
|
||||
type ServicesRestartRequest struct {
|
||||
// Grid (platform) ID
|
||||
// Required: true
|
||||
GID uint64 `url:"gid" json:"gid"`
|
||||
GID uint64 `url:"gid" json:"gid" validate:"required"`
|
||||
|
||||
// Node ID
|
||||
// Required: true
|
||||
NID uint64 `url:"nid" json:"nid"`
|
||||
}
|
||||
|
||||
func (grq ServicesRestartRequest) validate() error {
|
||||
if grq.GID == 0 {
|
||||
return errors.New("validation-error: field GID must be set")
|
||||
}
|
||||
if grq.NID == 0 {
|
||||
return errors.New("validation-error: field NID must be set")
|
||||
}
|
||||
|
||||
return nil
|
||||
NID uint64 `url:"nid" json:"nid" validate:"required"`
|
||||
}
|
||||
|
||||
// ServicesRestart restarts decort services on the node
|
||||
func (g Grid) ServicesRestart(ctx context.Context, req ServicesRestartRequest) (bool, error) {
|
||||
err := req.validate()
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/servicesRestart"
|
||||
|
||||
@@ -2,38 +2,30 @@ package grid
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for set allocation
|
||||
type SetCPUAllocationRatioRequest struct {
|
||||
// Grid (platform) ID
|
||||
// Required: true
|
||||
GID uint64 `url:"gridId" json:"gridId"`
|
||||
GID uint64 `url:"gridId" json:"gridId" validate:"required"`
|
||||
|
||||
// Allocation ratio
|
||||
// Required: true
|
||||
Ratio float64 `url:"ratio" json:"ratio"`
|
||||
}
|
||||
|
||||
func (grq SetCPUAllocationRatioRequest) validate() error {
|
||||
if grq.GID == 0 {
|
||||
return errors.New("validation-error: field GID must be set")
|
||||
}
|
||||
if grq.Ratio == 0.0 {
|
||||
return errors.New("validation-error: field Ratio must be set")
|
||||
}
|
||||
|
||||
return nil
|
||||
Ratio float64 `url:"ratio" json:"ratio" validate:"required"`
|
||||
}
|
||||
|
||||
// SetCPUAllocationRatio sets CPU allocation ratio
|
||||
func (g Grid) SetCPUAllocationRatio(ctx context.Context, req SetCPUAllocationRatioRequest) (bool, error) {
|
||||
err := req.validate()
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/setCpuAllocationRatio"
|
||||
|
||||
@@ -2,38 +2,30 @@ package grid
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for set memory allocation
|
||||
type SetMemAllocationRatioRequest struct {
|
||||
// Grid (platform) ID
|
||||
// Required: true
|
||||
GID uint64 `url:"gridId" json:"gridId"`
|
||||
GID uint64 `url:"gridId" json:"gridId" validate:"required"`
|
||||
|
||||
// Allocation ratio
|
||||
// Required: true
|
||||
Ratio float64 `url:"ratio" json:"ratio"`
|
||||
}
|
||||
|
||||
func (grq SetMemAllocationRatioRequest) validate() error {
|
||||
if grq.GID == 0 {
|
||||
return errors.New("validation-error: field GID must be set")
|
||||
}
|
||||
if grq.Ratio == 0.0 {
|
||||
return errors.New("validation-error: field Ratio must be set")
|
||||
}
|
||||
|
||||
return nil
|
||||
Ratio float64 `url:"ratio" json:"ratio" validate:"required"`
|
||||
}
|
||||
|
||||
// SetMemAllocationRatio sets memory allocation ratio
|
||||
func (g Grid) SetMemAllocationRatio(ctx context.Context, req SetMemAllocationRatioRequest) (bool, error) {
|
||||
err := req.validate()
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/setMemAllocationRatio"
|
||||
|
||||
Reference in New Issue
Block a user