v1.16.0
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
package grid
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// ExecuteMaintenanceScriptRequest struct to execute script
|
||||
type ExecuteMaintenanceScriptRequest struct {
|
||||
// Grid (platform) ID
|
||||
// Required: true
|
||||
GID uint64 `url:"gid" json:"gid" validate:"required"`
|
||||
|
||||
// Type of nodes you want to apply the action on
|
||||
// Required: true
|
||||
NodesType string `url:"nodestype" json:"nodestype" validate:"required"`
|
||||
|
||||
// The script you want to run
|
||||
// Required: true
|
||||
Script string `url:"script" json:"script" validate:"required"`
|
||||
}
|
||||
|
||||
// ExecuteMaintenanceScript executes maintenance script
|
||||
func (g Grid) ExecuteMaintenanceScript(ctx context.Context, req ExecuteMaintenanceScriptRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/executeMaintenanceScript"
|
||||
|
||||
res, err := g.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
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package grid
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// ListEmailsRequest struct for getting list of email addresses of users
|
||||
type ListEmailsRequest struct {
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
// Page size
|
||||
// Required: false
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// ListEmails returns list of email addresses of users
|
||||
func (g Grid) ListEmails(ctx context.Context, req ListEmailsRequest) (*ListEmails, error) {
|
||||
url := "/cloudbroker/grid/listEmails"
|
||||
|
||||
res, err := g.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := ListEmails{}
|
||||
|
||||
err = json.Unmarshal(res, &list)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
@@ -226,6 +226,12 @@ type RecordSettingsGrid struct {
|
||||
//Prometheus
|
||||
Prometheus Prometheus `json:"prometheus"`
|
||||
|
||||
//Reserved CPU
|
||||
ReservedCPU uint64 `json:"reserved_cpu"`
|
||||
|
||||
//Reserved RAM
|
||||
ReservedRAM uint64 `json:"reserved_ram"`
|
||||
|
||||
//Vins max prereservation num
|
||||
VinsMaxPreReservationsNum int `json:"vinsMaxPreReservationsNum"`
|
||||
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
package grid
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// ServicesRestartRequest struct to restart services
|
||||
type ServicesRestartRequest struct {
|
||||
// Grid (platform) ID
|
||||
// Required: true
|
||||
GID uint64 `url:"gid" json:"gid" validate:"required"`
|
||||
|
||||
// Node ID
|
||||
// Required: true
|
||||
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 := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/servicesRestart"
|
||||
|
||||
res, err := g.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
|
||||
}
|
||||
Reference in New Issue
Block a user