v13.5.0
This commit is contained in:
@@ -10,6 +10,9 @@ type ListZones struct {
|
||||
|
||||
// Detailed information about the zone record
|
||||
type RecordZone struct {
|
||||
// If true, all nodes belonging to the given zone will be marked for autostart
|
||||
AutoStart bool `json:"autostart"`
|
||||
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
|
||||
43
pkg/cloudbroker/zone/node_autostart.go
Normal file
43
pkg/cloudbroker/zone/node_autostart.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package zone
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/internal/validators"
|
||||
)
|
||||
|
||||
// NodeAutoStartRequest struct to set node autostart in zone
|
||||
type NodeAutoStartRequest struct {
|
||||
// ID of zone
|
||||
// Required: true
|
||||
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
|
||||
|
||||
// AutoStart nodes in zone
|
||||
// Required: true
|
||||
AutoStart bool `url:"autostart" json:"autostart" validate:"required"`
|
||||
}
|
||||
|
||||
// NodeAutoStart sets node autostart in zone
|
||||
func (e Zone) NodeAutoStart(ctx context.Context, req NodeAutoStartRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/zone/node_autostart"
|
||||
|
||||
res, err := e.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
|
||||
}
|
||||
@@ -21,6 +21,10 @@ type UpdateRequest struct {
|
||||
// Description
|
||||
// Required: false
|
||||
Description string `url:"description,omitempty" json:"description,omitempty"`
|
||||
|
||||
// If true, all nodes belonging to the given zone will be marked for autostart
|
||||
// Required: false
|
||||
AutoStart interface{} `url:"autostart,omitempty" json:"autostart,omitempty" validate:"omitempty,isBool"`
|
||||
}
|
||||
|
||||
// Update updates zone object
|
||||
|
||||
Reference in New Issue
Block a user