This commit is contained in:
2026-03-27 17:29:52 +03:00
parent 444a33dc7e
commit 9258a1574b
25 changed files with 570 additions and 44 deletions

View File

@@ -16,8 +16,10 @@ type SnapshotCreateRequest struct {
// Text label for snapshot.
// Must be unique among this compute snapshots
// Allowed characters: a-z, 0-9, spaces, punctuation except '<' and '>'
// Maximum length: 36 characters
// Required: true
Label string `url:"label" json:"label" validate:"required"`
Label string `url:"label" json:"label" validate:"required,max=36,excludesall=<>"`
}
// SnapshotCreate create compute snapshot

View File

@@ -34,6 +34,9 @@ type ItemLocation struct {
// Support of SDN
SDNSupport bool `json:"sdn_support"`
// Is Zero Access enabled
ZeroAccessEnabled bool `json:"zeroaccess_enabled"`
}
// List of locations

View File

@@ -2,7 +2,7 @@ package zone
// FilterByID returns ListZones with specified ID.
func (list ListZones) FilterByID(id uint64) ListZones {
predicate := func(izone RecordZone) bool {
predicate := func(izone ItemZone) bool {
return izone.ID == id
}
@@ -11,7 +11,7 @@ func (list ListZones) FilterByID(id uint64) ListZones {
// FilterByName returns ListZones with specified Name.
func (list ListZones) FilterByName(name string) ListZones {
predicate := func(izone RecordZone) bool {
predicate := func(izone ItemZone) bool {
return izone.Name == name
}
@@ -20,7 +20,7 @@ func (list ListZones) FilterByName(name string) ListZones {
// FilterByStatus returns ListZones with specified Status.
func (list ListZones) FilterByStatus(status string) ListZones {
predicate := func(izone RecordZone) bool {
predicate := func(izone ItemZone) bool {
return izone.Status == status
}
@@ -28,7 +28,7 @@ func (list ListZones) FilterByStatus(status string) ListZones {
}
// FilterFunc allows filtering ListZones based on a user-specified predicate.
func (list ListZones) FilterFunc(predicate func(RecordZone) bool) ListZones {
func (list ListZones) FilterFunc(predicate func(ItemZone) bool) ListZones {
var result ListZones
for _, item := range list.Data {
@@ -42,11 +42,11 @@ func (list ListZones) FilterFunc(predicate func(RecordZone) bool) ListZones {
return result
}
// FindOne returns first found RecordZone
// FindOne returns first found ItemZone
// If none was found, returns an empty struct.
func (list ListZones) FindOne() RecordZone {
func (list ListZones) FindOne() ItemZone {
if list.EntryCount == 0 {
return RecordZone{}
return ItemZone{}
}
return list.Data[0]

View File

@@ -3,7 +3,7 @@ package zone
import "testing"
var zones = ListZones{
Data: []RecordZone{
Data: []ItemZone{
{
ID: 2,
@@ -76,7 +76,7 @@ func TestFilterByStatus(t *testing.T) {
}
func TestFilterFunc(t *testing.T) {
actual := zones.FilterFunc(func(ien RecordZone) bool {
actual := zones.FilterFunc(func(ien ItemZone) bool {
return ien.Deletable == true
})

View File

@@ -5,7 +5,7 @@ type ListZones struct {
EntryCount uint64 `json:"entryCount"`
// Data
Data []RecordZone `json:"data"`
Data []ItemZone `json:"data"`
}
// Detailed information about the zone record
@@ -63,4 +63,76 @@ type RecordZone struct {
// List of associated VINS IDs
VinsIDs []uint64 `json:"vinsIds"`
// DRS
DRS bool `json:"drs"`
// DRS UID
DRSUID string `json:"drs_uid"`
// App ID
AppID string `json:"app_id"`
// Decort URL
DecortURL string `json:"decort_url"`
// DRS Name
DRSName string `json:"drs_name"`
// SSO URL
SSOURL string `json:"sso_url"`
}
// A zone item from a list
type ItemZone struct {
// App ID
AppID string `json:"app_id"`
// If true, all nodes belonging to the given zone will be marked for autostart
AutoStart bool `json:"autostart"`
// Created timestamp
CreatedTime uint64 `json:"createdTime"`
// Decort URL
DecortURL string `json:"decort_url"`
// Deletable flag
Deletable bool `json:"deletable"`
// Description
Description string `json:"description"`
// DRS
DRS bool `json:"drs"`
// DRS Name
DRSName string `json:"drs_name"`
// DRS UID
DRSUID string `json:"drs_uid"`
// GID
GID uint64 `json:"gid"`
// GUID
GUID uint64 `json:"guid"`
// ID
ID uint64 `json:"id"`
// Name
Name string `json:"name"`
// List of associated Node IDs
NodeIDs []uint64 `json:"nodeIds"`
// SSO URL
SSOURL string `json:"sso_url"`
// Status
Status string `json:"status"`
// Updated timestamp
UpdatedTime uint64 `json:"updatedTime"`
}