This commit is contained in:
2026-04-03 16:26:42 +03:00
parent 9258a1574b
commit 30e464e4d2
22 changed files with 251 additions and 100 deletions

View File

@@ -1,5 +1,7 @@
package sep
import "encoding/json"
// Total resource information
type Total struct {
// Capacity limit
@@ -185,3 +187,93 @@ type ListAvailableSEP struct {
// Data
Data []SEPData `json:"data"`
}
// Disk clean settings
type DiskCleanSettings struct {
// Block size
BlockSize string `json:"blocksize"`
// Write bytes per second
WBPS uint64 `json:"wbps"`
// Write I/O operations per second
WIOPS uint64 `json:"wiops"`
}
// Pool configuration
type PoolConfig struct {
// Disk clean
DiskClean *string `json:"disk_clean"`
// Disk clean settings
DiskCleanSettings DiskCleanSettings `json:"disk_clean_settings"`
// Pool name
Name string `json:"name"`
// Usage limit
UsageLimit uint64 `json:"usage_limit"`
// Additional properties
AdditionalProperties map[string]interface{} `json:"-"`
}
func (p *PoolConfig) UnmarshalJSON(data []byte) error {
type tmpAlias PoolConfig
if err := json.Unmarshal(data, (*tmpAlias)(p)); err != nil {
return err
}
all := make(map[string]interface{})
if err := json.Unmarshal(data, &all); err != nil {
return err
}
delete(all, "disk_clean")
delete(all, "disk_clean_settings")
delete(all, "name")
delete(all, "usage_limit")
if len(all) > 0 {
p.AdditionalProperties = all
}
return nil
}
// Sep configuration information
type RecordConfigFieldEdit struct {
// Format
Format string `json:"format"`
// Pools
Pools []PoolConfig `json:"pools"`
// Protocol
Protocol string `json:"protocol"`
// Additional properties
AdditionalProperties map[string]interface{} `json:"-"`
}
func (r *RecordConfigFieldEdit) UnmarshalJSON(data []byte) error {
type tmpAlias RecordConfigFieldEdit
if err := json.Unmarshal(data, (*tmpAlias)(r)); err != nil {
return err
}
all := make(map[string]interface{})
if err := json.Unmarshal(data, &all); err != nil {
return err
}
delete(all, "format")
delete(all, "pools")
delete(all, "protocol")
if len(all) > 0 {
r.AdditionalProperties = all
}
return nil
}